The new Bayesian Binary Sensor - Any additional examples?

the examples of @etsinko helped me a great deal to sort the bayesian thing out:

most importantly rephrasing the observation in plain speech helped me understand which probability-values should be set (65% chance that if shower is on humidity is > 94). with that in mind i managed to get the probabilities sorted out. you still need some solid observations, but this bayesian sensor tells me reliably when the shower is on, based on humidity, temperature and occupancy. formerly i only measured humidity, which led to much too long measurements — because of the rather long time it takes to normalize the humidity. this combination of sensor data works great now.

(my humidity sensor is mounted at the ceiling, which makes it rather sensitive to humidity and temperature changes. but this serves its purpose, to switch on ventilation, as soon as the shower is on. a sensor at the other side of the room will probably have a decent lag until it indicates changed humidity or temperature.)

platform: 'bayesian'
name: 'shower aon bayesian'
device_class: humidity
prior: 0.25
probability_threshold: 0.5
observations:
    # shower on -> high probability if humidity > 94
  - entity_id: sensor.lf_bad
    platform: numeric_state
    above: 94
    prob_given_true: 0.65 # 65% chance that if shower is on humidity is > 94
    prob_given_false: 0.10 # 10% chance that if shower is off humidity is > 94

    # shower on -> high probability if temperature > 23.5
  - entity_id: sensor.temperatur_bad
    platform: numeric_state
    above: 23.5
    prob_given_true: 0.9 # 90% chance that if shower is on t is > 23.5
    prob_given_false: 0.3 # 30% chance that if shower is off t is > 23.5

    # shower on -> probable if humidity > 80
  - entity_id: sensor.lf_bad
    platform: numeric_state
    below: 80
    prob_given_true: 0.3 # 30% chance that if shower is on humidity is < 80
    prob_given_false: 0.8 # 80% chance that if shower is off humidity is < 80

    # shower on -> probable if bathroom light is on
  - entity_id: binary_sensor.licht_bad
    platform: state
    to_state: 'on'
    prob_given_true: 0.9 # 90% chance that if shower is on light is on
    prob_given_false: 0.8 # 80% chance that if shower is off light is on

    # shower on -> probable if bathroom occupied
  - entity_id: input_boolean.occupied_bad
    platform: state
    to_state: 'on'
    prob_given_true: 0.9 # 90% chance that if shower is on bathroom is occupied
    prob_given_false: 0.8 # 80% chance that if shower is off bathroom is occupied

6 Likes