Cancel rearm if parameter safety switch is otherwise turned back on #263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been making great use out of this component to automate some temperature / humidity control in my house and ran into a funny scenario. My automations will essentially turn off the safety switch, make their modifications, then rearm the switch manually. This mostly works just fine, but I was noticing spurious failures caused by the safety switch being enabled even though I just disabled it. I then checked the documentation to see that there was this rearm logic for 60 seconds... and my temperature and humidity sensors updated every 60 seconds....
So long story long, extra logging proved that since this rearm is unconditionally fired, the safety switch was (occasionally) being turned on again right between when I'd turn it off and edit a parameter or two. Quite the luck!
This change intends to fix that by keeping track of the rearm task and simply cancelling it if the switch has otherwise been rearmed.
(Note: This is the first pull request I've made in some time; apologies for any procedural errors.)