-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish the pulse_meter
total when setting the total
#5475
Conversation
Hey there @cstaahl, @stevebaxter, mind taking a look at this pull request as it has been labeled with an integration ( |
By this same logic it may also makes sense to publish a 0 on boot. However that one I can see potentially causing issues if someone is attempting to restore a saved value on boot as it would publish 0, then their restored value. Also I'm not sure where the best place to publish a 0 on boot would be... |
Maybe it would be worth considering adding support for restore value. |
I think for this PR it's complete as is, and there is a method that you can use to restore on boot anyway (an on boot lambda). It might be better to do it that way since then you could restore from other sources than flash. |
What does this implement/fix?
When the pulse total count is manually set the new state should be published.
Since this sensor should be a total increasing sensor when analysing if the total drops it can be seen as a continuation point.
If the initial value you set to isn't published it's impossible to know how big the "total increase" was for the step after that.
This PR changes the set total to also publish the value.
Also added myself to the code owners since I've touched this component enough times now that at the very least I'm probably someone to be notified for future reviews.
Types of changes
Related issue or feature (if applicable): fixes esphome/issues#4941
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder).