Hello, I Just installed last version and the utility helper sensor get reset after ha restart causing a negative value in the sensor.
I could immediately adjust it manually in the developer tools. I hope this will be fixed soon.
Logger: homeassistant.components.utility_meter.sensor
Source: components/utility_meter/sensor.py:456
Integration: Contor de utilități (documentation, issues)
First occurred: 15:56:02 (4 occurrences)
Last logged: 15:56:02
Energie Diverse Zilnica received an invalid state change coming from sensor.misc_kwh_rmn (unavailable > 0.00)
Energie Diverse Lunara received an invalid state change coming from sensor.misc_kwh_rmn (unavailable > 0.00)
Misc Zilnica Retea received an invalid state change coming from sensor.grid_power_used_by_misc_rmn (unavailable > 0.0000)
Misc Lunara Retea received an invalid state change coming from sensor.grid_power_used_by_misc_rmn (unavailable > 0.0000
this is how the source sensor for riemann calculations looks like:
template:
- sensor:
- name: "misc_power"
unit_of_measurement: "W"
icon: mdi:power-socket-eu
device_class: power
state_class: measurement
state: >
{% if not is_number(states('sensor.shellyem_98cdac1f3e9e_channel_2_power'))
or not is_number(states('sensor.total_hvac_power')) %}
None
{% else %}
{% set total_power = states('sensor.shellyem_98cdac1f3e9e_channel_2_power') | float %}
{% set hvac_power = states('sensor.total_hvac_power') | float %}
{{ (total_power - hvac_power) | round(1) }}
{% endif %}
I am using a template sensor to obtain the POWER consumption which i then use to feed a Riemann helper. The code I use works perfectly in the HA DEVTools and it returns value or ZERO when no value available. As soon I deploy it and restart HA, the sensor returns Unavailable or Unknown. What is wrong in the code and any support to adjust? The idea is to have a Power sensor for the Riemann helper that never goes into a NO-NUMBER state.
# Power
- name: "TPL Shelly 3EM Grid net used Watt"
unique_id: tpl_shelly_3em_grid_net_used_power
state: >-
{{ max(0,
(states('sensor.shelly_3em_l1_power')|float if states('sensor.shelly_3em_l1_power')|float is number else 0) +
(states('sensor.shelly_3em_l2_power')|float if states('sensor.shelly_3em_l2_power')|float is number else 0) +
(states('sensor.shelly_3em_l3_power')|float if states('sensor.shelly_3em_l3_power')|float is number else 0)) | abs | round(2) }}
availability: >-
{{ [states('sensor.shelly_3em_l1_power'), states('sensor.shelly_3em_l2_power'), states('sensor.shelly_3em_l3_power')] | map('is_number') | max | default (0.0)}}
unit_of_measurement: W
state_class: measurement
device_class: power
Also I am facing this issue. The challenge is that quite often I cannot manually correct the values in developer tools as in there the values appear correct. Do I need to dive into the underlying MariaDB to correct the negative values or is there some other trick?
Having the same issue (no way to find the negative value anymore in the statistics…) since this morning with 2023.6.
I guess that the correction brought in the last release has made things worse at least for me.
I was able at least to manually correct the values every morning before 2023.6
Well it’s rather hard as all fixes so far during 2023.5 release didn’t help yet more and more people report this problem. Only solution for now is to get back to last working version - 2023.4.6
I’m waiting one more day before shouting YES! but this morning I didn’t see any negative value for the first time since weeks.
Maybe what I’ve seen yesterday, the day after the update to 2023.6, was just the last wrong calculation…