cozylife / hass_cozylife_local_pull

home asstiant plugin
81 stars 35 forks source link

Consider including a power sensor #35

Open rjosantos opened 2 months ago

rjosantos commented 2 months ago

To make it possible to read the power, I changed a few lines of the code.

Note: I don't want any recognition for this change, just the possibility of keeping the plugin updated with your future changes and maintaining this sensor

cozylife commented 2 months ago

Hello. Thank you for submitting the PR. If you want to display the power consumption of metering equipment in Haas, you need to use the server's interface to achieve this. Currently you can know the local real-time power value by using 28. I would try running your code first and then consider merging it.

SodaWithoutSparkles commented 2 months ago

If you know the real-time power value, you can calculate the total power via a integration helper

Edit: I also captured and analysed the traffic via wireshark. It seems that it requested attribute 26 as well. What was that?

Edit2: I've created a python script to get the wattage and added that to HA via command line sensor.

cozylife commented 2 months ago

Hello. The meaning of 26 is: The increment of the daily value in the UTC time zone is set to 0 at 0 o'clock every day. For example: 20 kilowatt hours were consumed at 8 o'clock, 30 kilowatt hours were consumed at 12 o'clock, 400 million hours were consumed at 23 o'clock, and 500 million hours were consumed at 1 a.m. the next day; Then the data is probably: 8:20000 12:30000 23:40000 1:10000 This design is very poor and makes statistics difficult to implement. I don't recommend you implement statistics.