应该是根据贝叶斯公式,用概率去判断一个事件的发生概率,要比单纯叠加if else更灵活些吧。官方给了个例子
binary_sensor:
name: 'in_bed'
platform: 'bayesian'
prior: 0.25
probability_threshold: 0.95
observations:
- entity_id: 'sensor.living_room_motion'
prob_given_true: 0.4
prob_given_false: 0.2
platform: 'state'
to_state: 'off'
- entity_id: 'sensor.basement_motion'
prob_given_true: 0.5
prob_given_false: 0.4
platform: 'state'
to_state: 'off'
- entity_id: 'sensor.bedroom_motion'
prob_given_true: 0.5
platform: 'state'
to_state: 'on'
- entity_id: 'sensor.sun'
prob_given_true: 0.7
platform: 'state'
to_state: 'below_horizon'
可以用多个传感器的状态改变和定义好的概率,去判断你有多大概率是要去睡觉。 |