-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get power consumption with Matter; watts, volts, amps, etc., etc. (CON-1314) #1063
Comments
Could you please try to add an error check at Please try the above suggestion so that we get clear understanding of the issue. |
@JoseAntonioMG In your code, you have created a
|
esp_matter::attribute::update does not produce an error, I have changed the type esp_matter_val_type_t::ESP_MATTER_VAL_TYPE_INT16 to esp_matter_val_type_t::ESP_MATTER_VAL_TYPE_INT64, however I still have the same problem. I have also tried the following device types: electrical_sensor
electrical_power_measurement
device_energy_management
and none of them work properly. Also, I have compiled and flashed the All_devices_types_app example, and created the electrical_power_measurement device, which is listed in the list of available devices, however it does not solve the problem. I have the feeling that the devices for power measurements of different devices are not implemented correctly. |
@JoseAntonioMG Did you create the |
Does this mean I need to create the optional attributes for the Matter SDK? |
It is possible to construct the attribute in this way:
|
Please go through the docs of create your own data model. |
I have created a new Voltage attribute and it works:
However, I need to create the "electrical power measurement" cluster on a new endpoint, independent of "main_endpoint", where I have other clusters.
"node" is the main node from which all the clusters hang. I have created another example for a temperature sensor:
This example does work |
The handler can be set to an endpoint and not the cluster. So please create |
@jadhavrohit924 I have created the "ElectricalSensor" endpoint and I have also created the "electrical_power_measurement" cluster, to which I have assigned the endpoint corresponding to ElectricalSensor, but the log shows that the cluster and also the attributes already exist, and therefore they are not created.
This is the log of the device
|
@JoseAntonioMG Yes |
@jadhavrohit924 There are errors when updating the values of the "Electrical Power Measurement" endpoint. I have removed the code fragment corresponding to the creation of the "Electrical_Power_Measurement" cluster and also the creation of attributes, since if I include them I also get the same errors.
This is the function that allows you to update attributes with energy consumption values.
Device log
|
@JoseAntonioMG, I suggest you first read the attribute list on that cluster and then add those attributes that are not on your device. Also while updating the attribute please refer to the code to update the attribute. |
Did you manage to get this working? (and are willing to share your code?) |
@RichardPar, i have managed to get it working but not correctly. I am using the "electrical_sensor" device as described above, but in the device log I get the warnings:
With the following code in app_main.cpp:
And in the app_drive.cpp file:
If I remove the attribute creation lines:
errors appear like:
So I leave the attribute creation lines even though I get warnings, but I can get the energy consumption data with the chip-tool. However, when commissioning the device in HomeAssistant, the sensor data is not displayed. Chip-Tool:
Although in this case it is an example where the voltage is 0, but I have tested it with an electrical device and it gives me the correct voltage. |
@JoseAntonioMG Electrical sensor is not supported yet in HomeAssistant, so the sensor data is not displayed. This should work with Home Assistant 2024.10. |
THanks @JoseAntonioMG and @lboue ! Will be staying tuned! |
Beta release-202410 is out. You can try a test. |
Since the main issue is addressed can we close this issue? |
How can I get the accumulated energy in KWatts/hour or Watts/hour?
At the same endpoint as electrical_power_measurement, and I have created the corresponding attributes:
Then in the app_driver.cpp file I added the lines to update the attributes:
However, the following errors appear:
|
@JoseAntonioMG Are you still facing the issue? If yes, please share the state that you are in and if not, can you please close the issue? |
@JoseAntonioMG Any update? |
I have built a device with Esp32c6 and PZEM-004T to get the current and accumulated energy consumption in my house. This device works fine with arduino, however I want to implement Matter + thread technology in this device to connect it to other devices I have already created with esp matter.
I have developed a firmware from examples I have obtained from the internet with the "Electrical Energy Measurement" cluster, however it does not work.
app_main.cpp
In the code I am using this fragment which I don't know if it is correct
app_driver.cpp
pzem004tv3.cpp
pzem004tv3.h
The device starts correctly and can be commissioned with CHIP-TOOL, however it does not report data, such as the DC voltage of the electrical installation:
As can be seen, the function for obtaining data from the PZEM-004T is running correctly,
however the method:
does not collect the attributes correctly.
Can someone help me build the Matter schematic for obtaining energy data from pzem004t please.
The text was updated successfully, but these errors were encountered: