Allow multiple observations of same entity#9391
Merged
MartinHjelmare merged 3 commits intoSep 12, 2017
Merged
Conversation
|
@jlmcgehee21, thanks for your PR! By analyzing the history of the files in this pull request, we identified @arsaboo to be a potential reviewer. |
houndci-bot
reviewed
Sep 11, 2017
There was a problem hiding this comment.
continuation line missing indentation or outdented
Why: * There may be different probabilities for multiple states of the same entity. This change addresses the need by: * Keeping a list of observations for each entity to check on each state change of the given entity. * Adding a numeric id to each observation so that they can be effectively added and removed from `self.current_obs`. * Adding a test to confirm functionality.
MartinHjelmare
previously requested changes
Sep 12, 2017
| self.probability = prior | ||
|
|
||
| self.hass.async_add_job(self.async_update_ha_state, True) | ||
| self.hass.async_add_job(self.async_update_ha_state, True) |
Member
There was a problem hiding this comment.
This entity only needs to be updated after the new probability is calculated, ie outside the loop.
Contributor
Author
There was a problem hiding this comment.
Thanks for catching this, got carried away with the indenting, and all the tests passed so I guess I didn't notice 😱
Member
|
Remove the change to the frontend and this is good to go. 👍 |
MartinHjelmare
approved these changes
Sep 12, 2017
pvizeli
approved these changes
Sep 12, 2017
Member
|
@MartinHjelmare It's yours :) |
Merged
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why:
entity.
This change addresses the need by:
change of the given entity.
effectively added and removed from
self.current_obs.Description:
Related issue (if applicable): fixes #
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>
Example entry for
configuration.yaml(if applicable):Checklist:
If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass