Add the ability to reload bayesian platforms from yaml (#39771)

This commit is contained in:
J. Nick Koston authored and Paulus Schoutsen committed 2020-09-08 15:35:27 +00:00
1 parent 2a879afc7a
commit c9ec533aa5
5 files changed
+77 -2

No files matched your search

@@ -25,8 +25,11 @@ from homeassistant.helpers.event import (
async_track_state_change_event,
async_track_template_result,
)
from homeassistant.helpers.reload import async_setup_reload_service
from homeassistant.helpers.template import result_as_boolean
from . import DOMAIN, PLATFORMS
ATTR_OBSERVATIONS = "observations"
ATTR_OCCURRED_OBSERVATION_ENTITIES = "occurred_observation_entities"
ATTR_PROBABILITY = "probability"
@@ -106,6 +109,8 @@ def update_probability(prior, prob_given_true, prob_given_false):
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Bayesian Binary sensor."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
name = config[CONF_NAME]
observations = config[CONF_OBSERVATIONS]
prior = config[CONF_PRIOR]