My home-assistant configuration files.
I run a hassio on a pi 3.
I am using a cheap 10 euro USB webcam with a Motion Hassio addon as described here.
I have Philips Hue remotes and motion sensors. I wrote a custom component to integrate them here.
My leak detector is a DIY sensor using micropython, with a writeup on Hackster.
CURRENTLY NOT USING: I branched a Pimoroni library for the BME680 to publish data over MQTT, repo here.
I own an Appkettle which is integrated with HA via IFTTT. Write up on Hackster.
If my train is late, a Hue light turns red. On Hackster.
My Elgato door sensor cannot be integrated directly into HA since it is HomeKit only. To get around this I use the Homebridge addon for Hassio. See this thread. The same trick works for my Fibaro leak sensor.
I have a sensor which is ON when I am using my MacBook. I did this using Hammerspoon as described here.
I integrate an RF doorbell using an Arduino which relays signals over the serial port, as described here.
I am a big fan of using python_scripts over long YAML automations. I have a dedicated repo here.
I use a Google cloud SQL database as a recorder, as described here.
My own bayesian 'in bed bayesian sensor' is working nicely after a lot of experimentation. I found that the 'sun below horizon' input wasn't particularly useful, since in the UK at this time of year the sun is setting before 5pm.! Instead I'm using a template sensor which is ON at 'late night'.
- platform: template
sensors:
late_night_sensor:
value_template: >-
{{ strptime("22:00", "%H%M") < now().strftime("%H:%M")
or now().strftime("%H:%M") < strptime("07:00", "%H%M") }}
As a couple of others have done I also have a sensor to detect when there has been no motion in the house for 5 minutes. I implemented that using an input_select and an automation:
- id: '1513346519354'
alias: House_idle
trigger:
- entity_id: binary_sensor.motion_at_home
for:
minutes: 5
from: 'on'
platform: state
to: 'off'
action:
- data:
entity_id: input_boolean.house_idle
service: input_boolean.turn_on
Finally the bayesian sensor is:
- platform: 'bayesian'
name: 'in_bed_bayesian'
prior: 0.25
observations:
- entity_id: 'input_boolean.house_idle'
prob_given_true: 0.6
platform: 'state'
to_state: 'on'
- entity_id: 'binary_sensor.late_night_sensor'
prob_given_true: 0.8
platform: 'state'
to_state: 'on'
- entity_id: 'binary_sensor.motion_at_home'
prob_given_true: 0.1
platform: 'state'
to_state: 'on'
- entity_id: 'switch.macbook_power'
prob_given_true: 0.1
platform: 'state'
to_state: 'on'
- entity_id: 'switch.tv'
prob_given_true: 0.1
platform: 'state'
to_state: 'on'
I am using the history statistics component and a template sensor to display the number of hours I spent in bed last night.
- platform: history_stats
name: Time in bed
entity_id: binary_sensor.in_bed_bayesian
state: 'on'
type: time
end: '{{ now() }}'
duration:
hours: 24
And the template sensor:
- platform: template
sensors:
time_in_bed_template:
friendly_name: 'Time in bed'
value_template: '{{states.sensor.time_in_bed.attributes.value}}'
Lastly, I wrote a notebook discussing the ideas behind the bayesian sensor, and many thanks to @jlmcgehee21 for all his edits: http://nbviewer.jupyter.org/github/robmarkcole/HASS-data-science/blob/master/Bayesian%20sensor%20tutorial.ipynb
Try to limit your addons, as too many will make your system unstable.
- IDE: https://github.com/hassio-addons/addon-ide
- SSH & Web Terminal: https://github.com/hassio-addons/addon-ssh/blob/v3.2.0/README.md
- MQTT Server & Web client: https://github.com/hassio-addons/addon-mqtt/blob/master/README.md
- Motion camera detection: https://github.com/HerrHofrat/hassio-addons
- Glances: https://github.com/hassio-addons/addon-glances
- Jupyterlab Lite: https://github.com/hassio-addons/addon-jupyterlab-lite
- Log Viewer: https://github.com/hassio-addons/addon-log-viewer