-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Add Bayesian Binary Sensor documentation #3268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fabaff
merged 2 commits into
home-assistant:next
from
jlmcgehee21:feature/bayesian_binary
Aug 30, 2017
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| layout: page | ||
| title: "Bayesian Binary Sensor" | ||
| description: "Instructions how to integrate threshold Bayesian sensors into Home Assistant." | ||
| date: 2017-08-27 20:05 | ||
| sidebar: true | ||
| comments: false | ||
| sharing: true | ||
| footer: true | ||
| logo: home-assistant.png | ||
| ha_category: Binary Sensor | ||
| ha_iot_class: "Local Polling" | ||
| ha_release: 0.53 | ||
| --- | ||
|
|
||
|
|
||
| The `bayesian` binary sensor platform observes the state from multiple sensors | ||
| and uses Bayes' rule to estimate the probability that an event has occurred | ||
| given the state of the observed sensors. If the estimated posterior probability | ||
| is above the `probabiliy_threshold`, the value of the sensor is `on`. | ||
| Otherwise, the sensor is `off`. | ||
|
|
||
| This allows for the detection of complex events that may not be readily | ||
| observable, i.e. cooking, showering, in bed, start of morning routine, etc. It | ||
| can also be used to gain greater confidence about events that _are_ directly | ||
| observable, but for which the sensors can be unreliable, i.e. presence. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spelling & Grammar:
|
||
|
|
||
| To enable the Bayesian sensor, add the following lines to your `configuration.yaml`: | ||
|
|
||
| ```yaml | ||
| # Example configuration.yaml entry | ||
| binary_sensor: | ||
| name: 'currently_cooking' | ||
| platform: 'bayesian' | ||
| prior: 0.1 | ||
| probability_threshold: 0.7 | ||
| observations: | ||
| - entity_id: 'switch.kitchen_lights' | ||
| prob_given_true: 0.6 | ||
| prob_given_false: 0.2 | ||
| platform: 'state' | ||
| to_state: 'on' | ||
| - entity_id: 'sensor.stove_temperature' | ||
| prob_given_true: 0.9 | ||
| platform: 'numeric_state' | ||
| above: 100 | ||
| - entity_id: 'sensor.kitchen_motion' | ||
| prob_given_true: 0.5 | ||
| prob_given_false: 0.2 | ||
| platform: 'state' | ||
| to_state: 'on' | ||
|
|
||
| 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' | ||
| ``` | ||
|
|
||
| Configuration variables: | ||
| - **prior** (*Required*): The prior probability of the event. At any point in | ||
| time (ignoring all external influences) how likely is this event to occur? | ||
| - **observations** (*Required*): The observations which should influence the | ||
| likelihood that the given event has occurred. The only supported observation | ||
| platforms are `state` and `numeric_state`, which are modeled after their | ||
| corresponding triggers for automations. In addition to the automation syntax, | ||
| the observations also require `prob_given_true` (the probability of the | ||
| observation occurring, given the event is true). The optional | ||
| `prob_given_false` (the probability of the observation occurring, given the | ||
| event is false) can be set as well. If `prob_given_false` is not set, it will | ||
| default to `1 - prob_given_true`. | ||
| - **probability_threshold** (*Optional*): The probability at which the sensor | ||
| should trigger to `on`. | ||
| - **name** (*Optional*): Name of the sensor to use in the frontend. Defaults to | ||
| `Bayesian Binary`. | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling & Grammar:
i.e.->i.e., cooking, showeringstart of morning routine->the start of a morning routine