Skip to content
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

Fix misleading numeric_state trigger documentation #6054

Closed

Conversation

pnbruckner
Copy link
Contributor

Description:

Existing documentation says numeric_state trigger will fire once when the numeric value of an entity's state "crosses a threshold." However, that's not how the code actually works. It will fire for any state change (from any of the specified entities) if the numeric value of the new state satisfies the above and/or below conditions.

Checklist:

  • Branch: Fixes, changes and adjustments should be created against current. New documentation for platforms/components and features should go to next.
  • The documentation follow the standards.

Existing documentation says numeric_state trigger will fire once when the numeric value of an entity's state "crosses a threshold." However, that's not how the code actually works. It will fire for any state change (from any of the specified entities) if the numeric value of the new state satisfies the above and/or below conditions.
@ghost ghost added the to-do label Aug 21, 2018
@frenck frenck added enhancement ready-for-review This PR needs to be reviewed current This PR goes into the current branch and removed to-do labels Aug 22, 2018
@pnbruckner
Copy link
Contributor Author

I seem to be wrong. I'll close this PR until I'm sure. If I'm right I'll reopen. Otherwise I'll leave it closed.

@pnbruckner pnbruckner closed this Sep 1, 2018
@ghost ghost removed the ready-for-review This PR needs to be reviewed label Sep 1, 2018
@pnbruckner
Copy link
Contributor Author

pnbruckner commented Sep 2, 2018

FWIW, I did look at the code again, and indeed I was wrong. I had originally misunderstood how it worked. I also did some more extensive experimenting to convince myself. But, having said that, there is some behavior that isn't well documented. First, after a restart, if the entity's state satisfies the above and/or below conditions, it doesn't fire. This seems to trip some people up, even though it shouldn't, because with only one state value it can't have "crossed a threshold." But, there is another behavior which is probably unexpected to most. That is, if the first entity state change after restart satisfies the above and/or below conditions, the trigger will fire, even if it doesn't cross a threshold! To be clear, if the state satisfies the conditions after restart, it won't immediately fire, but if it changes to a new state value that also satisfies the conditions, the automation will trigger (again, even though it didn't cross a threshold.) It might be worth describing this behavior. Actually, that behavior should probably get "fixed", but that might break existing automations.

@pnbruckner pnbruckner deleted the numeric_state-trigger branch September 2, 2018 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
current This PR goes into the current branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants