You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
energy_meter:
boiler_energy_meter:
source: sensor.boiler_energyname: Boiler Energyprice_entity: sensor.day_ahead_pricecreate_utility_meter: truetest_1:
source: sensor.boiler_energyname: Energy Meter Test 1price_entity: sensor.day_ahead_pricecreate_utility_meter: false
Describe the bug
In my configuration listed above I've created two sensors based on the same energy sensor ('sensor.boiler_energy'). The first also creates a utility meter sensor, and the second doesn't. The first costs sensor works correctly, with costs that keep getting higher and never resetting to 0. The second sensor keeps getting reset to 0 after a Home Assistant reboot:
I've looked at the behavior of the energy sensor that I use ('sensor.boiler_energy'), and after a reboot it goes through these stages:
Non-existent (it only gets loaded when the MQTT integration is loaded)
Existing with state 'unavailable'
Existing with state 'unknown'
(At some point Home Assistant is done with the startup)
After the sensor reports back for the first time it gets an actual numerical value
The costs-only sensor ('sensor.boiler_energy_day_ahead_price_cost') has these stages:
Non-existent (the Energy Meter integration gets loaded after MQTT for me, though)
Existing with state 'unknown' (at this point the energy sensor also has state 'unknown')
(At some point Home Assistant is done with the startup)
After the sensor reports back for the first time it gets an actual numerical value, which is always 0
This is after Home Assistant says it's done with the start up (see the first and the last sensor in the screenshot):
Then after the first sensor gets a numerical value, the second (energy meter cost) sensor also gets a value. Unfortunately it's gone back to 0:
In the screenshot it's actually higher than 0, but that's because I was late taking a screenshot and the energy sensor got a new value. The 'last_reset' attribute is actually when my last restart happened, so the sensor also gets reset for some reason.
I think the energy meter sensor gets tripped over the 'unknown' state, but I'm not really sure.
The energy sensor that I use is a TuYa TS0121 plug, connected via Zigbee2MQTT.
NB: As you can see, the name of the cost-only sensor is also wrong. It's just 'sensor Cost' instead of the name I gave it in the configuration. That doesn't bother me as much, since you can just easily change it in the UI.
Debug log
2024-05-22 19:04:45.640 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter.boiler_energy_meter
2024-05-22 19:04:45.640 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter.boiler_energy_meter: skip utility_meter select entity
2024-05-22 19:04:45.640 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter.boiler_energy_meter: create a single utility_meter sensor
2024-05-22 19:04:45.641 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter: setup energy cost sensor of type from_grid
2024-05-22 19:04:45.641 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter: create energy cost sensor for entity sensor.boiler_energy
2024-05-22 19:04:45.641 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter.boiler_energy_meter_cost: create a single utility_meter sensor
2024-05-22 19:04:45.642 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter.test_1
2024-05-22 19:04:45.642 DEBUG (MainThread) [custom_components.energy_meter] Setup energy_meter: setup energy cost sensor of type from_grid
The text was updated successfully, but these errors were encountered:
Hello, the resetting behavior on the cost is normal. It is the behavior of HA on energy costs. The last_reset is managed by the recorder correctly when doing long term stats.
Version of the custom_component
v1.1.0
Configuration
Describe the bug
In my configuration listed above I've created two sensors based on the same energy sensor ('sensor.boiler_energy'). The first also creates a utility meter sensor, and the second doesn't. The first costs sensor works correctly, with costs that keep getting higher and never resetting to 0. The second sensor keeps getting reset to 0 after a Home Assistant reboot:

I've looked at the behavior of the energy sensor that I use ('sensor.boiler_energy'), and after a reboot it goes through these stages:
The costs-only sensor ('sensor.boiler_energy_day_ahead_price_cost') has these stages:
This is after Home Assistant says it's done with the start up (see the first and the last sensor in the screenshot):

Then after the first sensor gets a numerical value, the second (energy meter cost) sensor also gets a value. Unfortunately it's gone back to 0:

In the screenshot it's actually higher than 0, but that's because I was late taking a screenshot and the energy sensor got a new value. The 'last_reset' attribute is actually when my last restart happened, so the sensor also gets reset for some reason.
I think the energy meter sensor gets tripped over the 'unknown' state, but I'm not really sure.
The energy sensor that I use is a TuYa TS0121 plug, connected via Zigbee2MQTT.
NB: As you can see, the name of the cost-only sensor is also wrong. It's just 'sensor Cost' instead of the name I gave it in the configuration. That doesn't bother me as much, since you can just easily change it in the UI.
Debug log
The text was updated successfully, but these errors were encountered: