Hi There,
I have a manual MQTT entity configured that gets data for an entity I have configued for my Gas Meter. This gives me the kWh consumption,
However for some reason the entity is setting to 0, I believe possibly this is the MQTT data being sent is reading 0 at these odd points for some reason and it’s not HASSIO randomly resetting it to 0.
But the issue with this is, that the energy consumption dashboard then sees the meter as using the entire 0 to current kwh value as the consumption for that period. Like so.
Ideally I need some help on making it so HASSIO either keeps the previous value if the reading is super low (<100) Or lower than the previous reading.
The MQTT configuration for this entity is below.
- platform: mqtt
name: "Home Gas"
state_topic: "SMART/HILD/"
last_reset_topic: "SMART/HILD/"
last_reset_value_template: homeassistant.util.dt.utc_from_timestamp(0)
unit_of_measurement: 'kWh'
device_class: energy
state_class: total_increasing
value_template: "{{ value_json['gasMtr']['0702']['00']['00']|int(base=16) * value_json['gasMtr']['0702']['03']['01']|int(base=16) / value_json['gasMtr']['0702']['03']['02']|int(base=16) }}"
icon: 'mdi:fire-circle'
Here’s an example of the “value_json” if it helps in debugging the above.
{"gasMtr":{"0702":{"03":{"01":"000001","05":"43","04":"9B","02":"0003E8","07":"9345133905","08":"","03":"43","00":"00","06":"80"},"00":{"07":"2953A4A9","01":"000000000000","00":"000000CCF074","14":"02","02":"000000000000"},"04":{"01":"009BA0","00":"000000"},"02":{"00":"00"}}}}
Thanks in advance.