francispoisson / hilo

Hilo integration for Home Assistant
The Unlicense
26 stars 8 forks source link

Strange energy sensors results using integration/utility_meter #34

Closed Fox350 closed 2 years ago

Fox350 commented 2 years ago

He everyone, did you try to create energy sensors from the thermostat power entity ? First, you need to create an energy sensor with the integration platform wich will transform raw power in W to kWh, it integrates the power over a time lapse to give kWh. Here is how I did it :

Here is the raw Hilo sensor data in graph : image

https://www.home-assistant.io/integrations/integration/ 1st step is to use sensor - platform: integration (takes a sensor in W) to create kWh sensor:

It creates the entity sensor.energy_chambre_d_emilie with the following attibutes : state_class: total source: sensor.chambre_d_emilie unit_of_measurement: kWh friendly_name: energy_chambre_d_emilie icon: mdi:chart-histogram device_class: energy

Here is the graph of the energy sensor created and it keep increasing over time as his job is just that : always increase over time and never reset. It does go to 0 when you reboot HA just fyi. Just look at the strange increase, it should not be that high and just start to rise from the same level as before... image

https://www.home-assistant.io/integrations/utility_meter/ 2nd step is to use this integration sensor to feed the utility meter

utility_meter: energy_chambre_d_emilie_daily: source: sensor.energy_chambre_d_emilie cycle: daily

It creates the entity sensor.energy_chambre_d_emilie_daily with the following attibutes : state_class: total_increasing last_reset: 2021-10-21T04:00:00.034194+00:00 source: sensor.energy_chambre_d_emilie status: collecting last_period: 5.11 meter_period: daily unit_of_measurement: kWh friendly_name: energy_chambre_d_emilie_daily icon: mdi:counter device_class: energy

Be aware that you need to switch the thermostat in heating mode and it need to apply power to change status to collecting.

Great seems to work, also in energy dashboard.

Unfortunately, I see the utility meter does the job to reset the sensor at midnight but for an unknow reason the power consumption is not beginning at 0, but at another number like if the last value was used by the integration sensor and is cummulating overt time ...

image

I did use the same method before on tuya smart plug with power measurement capability and it is working fine.

I use the same method for my main entry, with the sensor.smartenergy that creates sensor.enregy_smartenergy but since it always increase and never stop consumming, it is almost invisible!

image

Do you have the same behavior ?

Any idea is welcome!

valleedelisle commented 2 years ago

Hello,

I believe there's some issues with the PowerSensor generation. I really the idea so I'll try to reproduce and see if I can help.

Thanks for sharing the detailed steps, it helps a lot.

DVD

valleedelisle commented 2 years ago

Hello,

I think that the PR [1] will solve this issue.

I hope this helps.

DVD

[1] https://github.com/francispoisson/hilo/pull/35/commits/6729b9ca37990ce475a7b5357dbad8ee656fccda

Fox350 commented 2 years ago

Thanks a lot DVD I will try that and let you know. Have a good one!

Fox350 commented 2 years ago

Hy guys. Huge thanks for the effort but I did have the same behavior after 4c88cd0. What looks like have solved the problem is to use the method : left instead of method : trapezoidal when creating the energy sensor.

So this: platform: integration source: sensor.chambre_d_emilie name: energy_chambre_d_emilie unit_time: h round: 2 unit_prefix: k

method: trapezoidal

method: left.

I will post new screenshot after going back to trapezoidal to confirm that. Thanks Screenshot_20211029-074314

Fox350 commented 2 years ago

It is confirmed. You need to use the method: left Screenshot_20211030-081158-323

Trapezoidal is going to give you those strange results way too high cause it continue to increase even at 0. Screenshot_20211030-081007-197