Closed jezzaaa closed 1 month ago
Hello,
Energy sensor is persistant and is restored at restart. I can't do more than this on my own. Did you stop and restart HA properly ? I guess on a hard restart, the db have not the time to be updated and you may have some delta is not persisted correctly.
The other point you could check, the persistance delay, named commit_interval
. This is in the recorder.yaml
file.
The value in my env:
That mean I can loose up to 10 sec of data in case of haard stop.
I can't find a file called recorder.yaml, sorry. Is it part of VT or HA? Reducing commit_interval would probably reduce the chances of negative consumption but not eliminate it - this seems to be more of a work-around than a solution.
I'm fairly sure my HA restarts were graceful (via the GUI), as part of HA or integration upgrades.
I'm wondering if a better solution might be to reset the energy accumulator to zero every time VT starts up. I believe this is what happens with smart plugs providing their own energy counters, when they are power cycled, and Home Assistant seems to recognise this special case and handle it correctly - that is, power usage doesn't suddenly go negative when a smart plug is disconnected and re-connected.
In my configuration.yaml, I have this:
# Recorder and purge config
recorder: !include recorder.yaml
may be the recorder specification is directly in your configuration.yaml and not in the recorder.yaml which is included in the configuration.yaml
I have no recorder specification in configuration.yaml.
Perhaps I need to create it in configuration.yaml (or add "recorder: !include recorder.yaml" and create recorder.yaml). I'll give that a try.
Reading the documentation, the commit_interval default is 5 seconds. As I don't have any "recorder:" settings in my configuration.yaml or included files, my commit interval must be 5. Increasing to 10 (as you have it) would increase the likelihood of lost data samples during a reboot, so I don't think that is advisable.
If a commit_interval delay were causing this issue, then I would expect to see a negative energy consumption value that is around 5 seconds of consumption. Instead, I see several hours of samples before the value reverts. It's as if the total consumed energy goes back 8 or more hours in time. Certainly not 5 or 10 seconds.
So I believe that the commit_interval value is unrelated to the problem, and changing its value is not going to make things better or worse by the quantity of error that I'm seeing.
Hello @jezzaaa
It seems the problem was not a restoration problem but more than the energy was not saved every time it should.
I try this fix with beta release https://github.com/jmcollin78/versatile_thermostat/releases/tag/6.3.4.beta3
If you can give it a try because I'm not able to reproduce the case at home. I will publish a release tomorrow if you can give it a try
It seems the problem was not a restoration problem but more than the energy was not saved every time it should.
Great news.
I try this fix with beta release https://github.com/jmcollin78/versatile_thermostat/releases/tag/6.3.4.beta3
I don't know how to run a beta version. I believe HACS used to allow enabling beta versions, but since HACS 2.0, that option is not present.
If you can give it a try because I'm not able to reproduce the case at home. I will publish a release tomorrow if you can give it a try
I would give it a try if I could install it. But a day isn't long enough to test. It would sometimes take 2 or more weeks for the problem to show up. So with a day's testing, I wouldn't be able to say with confidence that the problem had been fixed.
You should click on the three dot and select "retélécharger" (in French)
Then you can choose the release you want.
I installed 6.3.4 when it came out. It's been a few weeks, and I haven't seen any problems with the integration, so I believe the problem is fixed. Thankyou!
I use VT with two electric heaters powered by smart plugs. When Home Assistant is restarted, the "Energy" sensor sometimes goes back to a previous value, causing the Energy dashboard to show negative consumption.
Version of the custom_component
6.2.9 -->
Configuration
My VTherm attributes are the following:
If it is releveant to regulation performance or optimisation some curves are needed
Describe the bug
I have two virtual thermostats setup using VT. Both are using a smart plug to switch off/on electric heaters via ZigBee temperature sensors. The VT energy sensors are used in the Energy dashboard to show consumption over time. The Energy dashboard sometimes shows negative usage.
Energy sensors are supposed to be be ever-increasing, or reset to zero in some situations. However I have found that the energy sensors sometimes revert to a previous value around the time of restarting Home Assistant.
I'm trying to: have accurate graphs in the Energy dashboard, that show only non-negative power consumption.
And I expect: the energy accumulators provided by VT to always increase, or reset to zero when required, but to not go "back in time" to a previous non-zero value.
But I observe this .... the energy accumulators sometimes reduce to a positive value, when Home Assistant is restarted.
I read the documentation on the README.md file and I don't find any relevant information about this issue.
Debug log
I no longer have the logs from the last time this happened. If it would be helpful, I can try to reproduce the behaviour by restarting Home Assistant (or VT) while the heaters are consuming energy.