Energy monitor (new HA feature)
Minims opened this issue ยท 8 comments
Can we add those sensor as long term statistics for the Energy panel. Thanks !
https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics
Not quite sure it would work. LTS sensors require that the entity include "current" values and gazpar only provides yesterday value. But it should not be quite difficult to add the required attributes to the sensor (note that gaz LTS is not yet released inside HA, it will be in an upcoming release)
Just to notify that things are moving quickly about this subject:
https://developers.home-assistant.io/blog/2021/08/16/state_class_total
With last_reset
, it could have make sense to set it as day n-2 for day n-1 value but since it will be removed, I am not sure that it will be possible to use non-current gazpar statistics. ๐
From what I understand gazpar statistics will be OK as a total_increasing
sensor which makes sense for water, gaz... Now the problem is to make sure that gazpar api can send a true total_increasing value. If not we will have to stick with measurement and find a way to make sure the daily basis is well understood by HA
Indeed total_increasing
could work with sensor.gazpar_energy_month
but the value should not decrease during the period otherwise it will be considered as a period reset. You could tell me it should not happen, but GRDF got our back to f*ck it up:
Sad workarounds:
- The custom_components keeps tracks of the values to prevent this
- A template sensor: https://community.home-assistant.io/t/how-to-filter-sensor-to-get-monotone-increasing-values/254352/5?u=mincka
I tried a poor man's approach to get it working and use a fake volume based on kWh (reversed operation...).
It almost looks nice. :)
I use two sensor templates and I set the mandatory attributes for the energy dashboard:
- sensor:
- unique_id: gazpar_energy_total_increasing
unit_of_measurement: "kWh"
state: >
{{ states('sensor.gazpar_energy_month') }}
attributes:
friendly_name: Gazpar energy total increasing
state_class: total_increasing
- unique_id: gazpar_volume_total_increasing
unit_of_measurement: "mยณ"
state: >
{{ states('sensor.gazpar_energy_month') | float * 10.7 }}
attributes:
friendly_name: Gazpar volume total increasing
state_class: total_increasing
However, because sometimes the returned values for the calculated volume are completely wrong, the stat counter gets reset and I get a huge volume of gaz in the dashboard.
Anyway, since the values are the ones reported for the previous day, the gaz is shifted and overall consumption for the home is not real.
I have added month m3 sensor and the total_increasing state class on it, so you can now use the energy monitor without any additionnal step.
Let me know if you have any issue ๐
I have added month m3 sensor and the total_increasing state class on it, so you can now use the energy monitor without any additionnal step.
Let me know if you have any issue ๐
Thanks, it works great !