Repository navigation
Fix #2461: Funktionsplan: Verhalten von STATE_OUT bei Analogwert - #2464
Merged
Merged
Conversation
Function block diagrams compared the value a STATE_OUT wrote with the value the state holds exactly. Adapters like esphome store numbers as float32, so a written 11.768 comes back as 11.76799964904785. The online view then showed a deviation although both values look the same, and with "Write the value back" the diagram would correct the state again and again and finally report it as contested. `sameValue()` now treats two numbers within a relative tolerance of 1e-6 (`NUMBER_TOLERANCE`) as equal, also when one of them is a string or a boolean. The exact comparisons that decide whether a new value has to be written are unchanged. Tests cover the float32 case for the deviation display and for enforced outputs. Fixes #2461. Fixes #2461
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Function block diagrams compared the value a STATE_OUT wrote with the value the state holds exactly. Adapters like esphome store numbers as float32, so a written 11.768 comes back as 11.76799964904785. The online view then showed a deviation although both values look the same, and with "Write the value back" the diagram would correct the state again and again and finally report it as contested.
sameValue()now treats two numbers within a relative tolerance of 1e-6 (NUMBER_TOLERANCE) as equal, also when one of them is a string or a boolean. The exact comparisons that decide whether a new value has to be written are unchanged. Tests cover the float32 case for the deviation display and for enforced outputs. Fixes #2461.Fixes #2461