Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.bayesian.binary_sensor Namespace Reference

Classes

class  BayesianBinarySensor
 

Functions

dict[str, Any] _above_greater_than_below (dict[str, Any] config)
 
list[dict] _no_overlapping (list[dict] configs)
 
None async_setup_platform (HomeAssistant hass, ConfigType config, AddEntitiesCallback async_add_entities, DiscoveryInfoType|None discovery_info=None)
 
float update_probability (float prior, float prob_given_true, float prob_given_false)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
 NUMERIC_STATE_SCHEMA
 
 PLATFORM_SCHEMA
 
 STATE_SCHEMA
 
 TEMPLATE_SCHEMA
 

Detailed Description

Use Bayesian Inference to trigger a binary sensor.

Function Documentation

◆ _above_greater_than_below()

dict[str, Any] homeassistant.components.bayesian.binary_sensor._above_greater_than_below ( dict[str, Any]  config)
private

Definition at line 71 of file binary_sensor.py.

◆ _no_overlapping()

list[dict] homeassistant.components.bayesian.binary_sensor._no_overlapping ( list[dict]  configs)
private

Definition at line 110 of file binary_sensor.py.

◆ async_setup_platform()

None homeassistant.components.bayesian.binary_sensor.async_setup_platform ( HomeAssistant  hass,
ConfigType  config,
AddEntitiesCallback  async_add_entities,
DiscoveryInfoType | None   discovery_info = None 
)
Set up the Bayesian Binary sensor.

Definition at line 189 of file binary_sensor.py.

◆ update_probability()

float homeassistant.components.bayesian.binary_sensor.update_probability ( float  prior,
float  prob_given_true,
float   prob_given_false 
)
Update probability using Bayes' rule.

Definition at line 180 of file binary_sensor.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.bayesian.binary_sensor._LOGGER = logging.getLogger(__name__)
private

Definition at line 68 of file binary_sensor.py.

◆ NUMERIC_STATE_SCHEMA

homeassistant.components.bayesian.binary_sensor.NUMERIC_STATE_SCHEMA
Initial value:
1 = vol.All(
2  vol.Schema(
3  {
4  CONF_PLATFORM: CONF_NUMERIC_STATE,
5  vol.Required(CONF_ENTITY_ID): cv.entity_id,
6  vol.Optional(CONF_ABOVE): vol.Coerce(float),
7  vol.Optional(CONF_BELOW): vol.Coerce(float),
8  vol.Required(CONF_P_GIVEN_T): vol.Coerce(float),
9  vol.Optional(CONF_P_GIVEN_F): vol.Coerce(float),
10  },
11  required=True,
12  ),
13  _above_greater_than_below,
14 )

Definition at line 94 of file binary_sensor.py.

◆ PLATFORM_SCHEMA

homeassistant.components.bayesian.binary_sensor.PLATFORM_SCHEMA
Initial value:
1 = BINARY_SENSOR_PLATFORM_SCHEMA.extend(
2  {
3  vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
4  vol.Optional(CONF_UNIQUE_ID): cv.string,
5  vol.Optional(CONF_DEVICE_CLASS): cv.string,
6  vol.Required(CONF_OBSERVATIONS): vol.Schema(
7  vol.All(
8  cv.ensure_list,
9  [vol.Any(TEMPLATE_SCHEMA, STATE_SCHEMA, NUMERIC_STATE_SCHEMA)],
10  _no_overlapping,
11  )
12  ),
13  vol.Required(CONF_PRIOR): vol.Coerce(float),
14  vol.Optional(
15  CONF_PROBABILITY_THRESHOLD, default=DEFAULT_PROBABILITY_THRESHOLD
16  ): vol.Coerce(float),
17  }
18 )

Definition at line 160 of file binary_sensor.py.

◆ STATE_SCHEMA

homeassistant.components.bayesian.binary_sensor.STATE_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  CONF_PLATFORM: CONF_STATE,
4  vol.Required(CONF_ENTITY_ID): cv.entity_id,
5  vol.Required(CONF_TO_STATE): cv.string,
6  vol.Required(CONF_P_GIVEN_T): vol.Coerce(float),
7  vol.Optional(CONF_P_GIVEN_F): vol.Coerce(float),
8  },
9  required=True,
10 )

Definition at line 139 of file binary_sensor.py.

◆ TEMPLATE_SCHEMA

homeassistant.components.bayesian.binary_sensor.TEMPLATE_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  CONF_PLATFORM: CONF_TEMPLATE,
4  vol.Required(CONF_VALUE_TEMPLATE): cv.template,
5  vol.Required(CONF_P_GIVEN_T): vol.Coerce(float),
6  vol.Optional(CONF_P_GIVEN_F): vol.Coerce(float),
7  },
8  required=True,
9 )

Definition at line 150 of file binary_sensor.py.