1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-30 06:33:51 +00:00

Add Bayesian type for binary_sensor_map component (#4640)

* initial support for Bayesian type

* Cast bool state of binary_sensor to uint64_t

* Rename channels to observations with Bayesian

* Improve/standardize comments for all types

* Use black to correct sensor.py formatting

* Add SUM and BAYESIAN binary sensor map tests

* Remove unused variable

* Update esphome/components/binary_sensor_map/binary_sensor_map.cpp

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>

---------

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
kahrendt
2023-04-12 21:48:29 -04:00
committed by GitHub
parent cc1eb648f9
commit afc848bf22
4 changed files with 190 additions and 34 deletions

View File

@@ -368,6 +368,32 @@ sensor:
- binary_sensor: bin3
value: 100.0
- platform: binary_sensor_map
name: Binary Sensor Map
type: sum
channels:
- binary_sensor: bin1
value: 10.0
- binary_sensor: bin2
value: 15.0
- binary_sensor: bin3
value: 100.0
- platform: binary_sensor_map
name: Binary Sensor Map
type: bayesian
prior: 0.4
observations:
- binary_sensor: bin1
prob_given_true: 0.9
prob_given_false: 0.4
- binary_sensor: bin2
prob_given_true: 0.7
prob_given_false: 0.05
- binary_sensor: bin3
prob_given_true: 0.8
prob_given_false: 0.2
- platform: bl0939
uart_id: uart_8
voltage: