Incorrect last_valid_state for utility meter
The problem
I created utility meter for energy consumption (reset once a year)
and this sensor have incorrect value for last_valid_state
Bigger than the state has ever had.
I have a few utility metters (increased), and all have bigger value that actual state.
What version of Home Assistant Core has the issue?
core-2025.9.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
utility_meter
Link to integration documentation on our website
https://www.home-assistant.io/integrations/utility_meter/
Diagnostics information
No response
Example YAML snippet
utility_meter:
returned_energy_year_enea:
unique_id: energia_oddana_roczna_enea_utility_meter
name: returned energy
source: sensor.pro3em_dom_total_active_returned_energy
cron: "59 23 31 7 *"
Anything in the logs that might be useful for us?
Additional information
No response
Hey there @dgomes, mind taking a look at this issue as it has been labeled with an integration (utility_meter) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of utility_meter can trigger bot actions by commenting:
@home-assistant closeCloses the issue.@home-assistant rename Awesome new titleRenames the issue.@home-assistant reopenReopen the issue.@home-assistant unassign utility_meterRemoves the current integration label and assignees on the issue, add the integration domain after the command.@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue.@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
utility_meter documentation utility_meter source (message by IssueLinks)
Or maybe this is not the last state of the utility meter but the last state of the input sensor?
Or maybe this is not the last state of the utility meter but the last state of the input sensor?
precisely: https://github.com/home-assistant/core/blob/1e14fb6dab4cfde1a1605addff327f821f2d5cd9/homeassistant/components/utility_meter/sensor.py#L526C34-L526C47
This value is kept to recover utility meter normal functioning after a reboot of HA
But is this the last state of the utility meter or source sensor?
source sensor state - the purpose is to keep information from the source in the even the source misbehaves or is unavailable on HA restart
Thanks for information
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.