Refactor bayesian observations using dataclass (#79590)

* refactor

* remove some changes

* remove typehint

* improve codestyle

* move docstring to comment

* < 88 chars

* avoid short var names

* more readable

* fix rename

* Update homeassistant/components/bayesian/helpers.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/bayesian/binary_sensor.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* Update homeassistant/components/bayesian/binary_sensor.py

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>

* no intermediate

* comment why set before list

Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
This commit is contained in:
HarvsG 2022-10-04 16:16:39 +01:00 committed by GitHub
parent 56dd0a6867
commit dd1463da28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 195 additions and 105 deletions

View file

@ -0,0 +1,17 @@
"""Consts for using in modules."""
ATTR_OBSERVATIONS = "observations"
ATTR_OCCURRED_OBSERVATION_ENTITIES = "occurred_observation_entities"
ATTR_PROBABILITY = "probability"
ATTR_PROBABILITY_THRESHOLD = "probability_threshold"
CONF_OBSERVATIONS = "observations"
CONF_PRIOR = "prior"
CONF_TEMPLATE = "template"
CONF_PROBABILITY_THRESHOLD = "probability_threshold"
CONF_P_GIVEN_F = "prob_given_false"
CONF_P_GIVEN_T = "prob_given_true"
CONF_TO_STATE = "to_state"
DEFAULT_NAME = "Bayesian Binary Sensor"
DEFAULT_PROBABILITY_THRESHOLD = 0.5