Commit e797131b authored by Rob Connolly's avatar Rob Connolly

Merge branch 'new-stuff' into 'master'

New stuff

See merge request robconnolly/hass-config!5
parents 164aa03d 2f523a26
secrets.yaml filter=git-crypt diff=git-crypt
appdaemon.cfg filter=git-crypt diff=git-crypt
appdaemon.yaml filter=git-crypt diff=git-crypt
apps/apps.yaml filter=git-crypt diff=git-crypt
known_devices.yaml filter=git-crypt diff=git-crypt
mysensors.json filter=git-crypt diff=git-crypt
html5_push_registrations.conf filter=git-crypt diff=git-crypt
entity_registry.yaml filter=git-crypt diff=git-crypt
shell_commands/secrets.sh filter=git-crypt diff=git-crypt
......@@ -6,3 +6,12 @@ home-assistant.log
home-assistant_v2.db*
*.pem
deps/
tts/
dashboards/
.storage
custom_components/
www/community/
script-env/
broadlink-env/
shell_commands/__pycache__/
ip_bans.yaml
stages:
- check
- preflight
- homeassistant
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
before_script:
- apt-get update
- apt-get install -y mosquitto-clients
- mv fake_secrets.yaml secrets.yaml
# Generic preflight template
.preflight: &preflight
stage: preflight
tags:
- hass
check_config:
stage: check
image: homeassistant/home-assistant:latest
# Generic Home Assistant template
.ha: &ha
stage: homeassistant
variables:
PYTHONPATH: "/usr/src/app:$PYTHONPATH"
before_script:
- python -m homeassistant --version
- mv fake_secrets.yaml secrets.yaml
- rm packages/hacs.yaml
script:
- cd /usr/src/app
- python -m homeassistant -c $CI_PROJECT_DIR --script check_config
- |
python -m homeassistant \
--config $CI_PROJECT_DIR \
--script check_config \
--info all
tags:
- hass
#before_script:
# - apt-get update
# - apt-get install -y mosquitto-clients
# Preflight jobs
shellcheck:
<<: *preflight
image:
name: koalaman/shellcheck-alpine:stable
entrypoint: [""]
before_script:
- ln -s $CI_PROJECT_DIR /config
- mv shell_commands/fake_secrets.sh shell_commands/secrets.sh
- shellcheck --version
- apk --no-cache add grep
script:
- |
for file in $(grep -IRl "#\!\(/usr/bin/env \|/bin/\)" --exclude-dir ".git" .); do
if ! shellcheck -x $file; then
export FAILED=1
else
echo "$file OK"
fi
done
if [ "${FAILED}" = "1" ]; then
exit 1
fi
yamllint:
<<: *preflight
image: sdesbure/yamllint
before_script:
- yamllint --version
- mv fake_secrets.yaml secrets.yaml
- rm known_devices.yaml appdaemon.yaml apps/apps.yaml
script:
- yamllint .
allow_failure: true
jsonlint:
<<: *preflight
image: sahsu/docker-jsonlint
before_script:
- jsonlint --version || true
script:
- |
for file in $(find . -type f -name "*.json" -path "mysensors.json" -prune); do
if ! jsonlint -q $file; then
export FAILED=1
else
echo "$file OK"
fi
done
if [ "${FAILED}" = "1" ]; then
exit 1
fi
markdownlint:
<<: *preflight
image:
name: ruby:alpine
entrypoint: [""]
before_script:
- apk --no-cache add git
- gem install mdl
- mdl --version
script:
- mdl --style all --warnings --git-recurse .
# Home Assistant test jobs
ha-latest:
<<: *ha
image:
name: homeassistant/home-assistant:latest
entrypoint: [""]
ha-rc:
<<: *ha
image:
name: homeassistant/home-assistant:rc
entrypoint: [""]
allow_failure: true
ha-dev:
<<: *ha
image:
name: homeassistant/home-assistant:dev
entrypoint: [""]
allow_failure: true
# Home Assistant Configuration
Configuration files for [Home Assistant](https://home-assistant.io).
......
File added
File added
Subproject commit 7294b7d1824fab16319e9de155b07aa9a49e3833
Subproject commit 09d2635e5d8a4e42b682608bf951718268f268de
#- alias: 'Morning (Mon-Tue)'
# trigger:
# platform: time
# # mon & tue mornings at 7.00
# minutes: 0
# hours: 7
# seconds: 0
# condition:
# condition: and
# conditions:
# - condition: time
# weekday:
# - mon
# - tue
# - condition: state
# entity_id: group.presence
# state: home
# - condition: sun
# before: sunrise
# before_offset: "0:20:00"
# action:
# service: script.turn_on
# entity_id: script.morning
#
#- alias: 'Morning (Wed-Fri)'
# trigger:
# platform: time
# # wed, thurs, fri mornings at 6.45
# minutes: 45
# hours: 6
# seconds: 0
# condition:
# condition: and
# conditions:
# - condition: time
# weekday:
# - wed
# - thu
# - fri
# - condition: state
# entity_id: group.presence
# state: home
# - condition: sun
# before: sunrise
# before_offset: "0:20:00"
# action:
# service: script.turn_on
# entity_id: script.morning
#
#- alias: 'Lights off in morning'
# trigger:
# platform: time
# # weekday mornings at 7.25
# minutes: 25
# hours: 7
# seconds: 0
# condition:
# condition: time
# weekday:
# - mon
# - tue
# - wed
# - thu
# - fri
# action:
# service: light.turn_off
# entity_id: light.main_lights
......@@ -4,9 +4,6 @@
- platform: state
entity_id: media_player.tv
to: playing
- platform: state
entity_id: media_player.living_room
to: playing
condition:
condition: and
conditions:
......@@ -14,6 +11,10 @@
after: sunset
- condition: time
after: '20:00:00'
- condition: template
value_template: '{{ states.media_player.tv.attributes.media_content_type != "music" }}'
- condition: template
value_template: '{{ states.media_player.tv.attributes.media_title != "Home And Away" }}'
action:
service: scene.turn_on
entity_id: scene.movie
......@@ -26,15 +27,6 @@
- platform: state
entity_id: media_player.tv
to: idle
- platform: state
entity_id: media_player.living_room
to: paused
- platform: state
entity_id: media_player.living_room
to: idle
- platform: state
entity_id: media_player.living_room
to: 'off'
condition:
condition: and
conditions:
......@@ -43,5 +35,6 @@
- condition: time
after: '20:00:00'
action:
service: scene.turn_on
entity_id: scene.downlights_bright
service: script.turn_on
entity_id: script.downlights_bright
- alias: 'Hallway and toilet lights on in evening'
- alias: 'Night light 1 on at bedtime'
trigger:
platform: sun
event: sunset
offset: "-0:10:00"
platform: time
at: '19:30:00'
action:
#- service: light.turn_on
# data:
# entity_id: light.hallway
# brightness_pct: 1
- service: light.turn_on
data:
entity_id: light.toilet
brightness_pct: 1
entity_id: !secret night_light1
rgb_color: [255, 0, 190]
brightness_pct: 80
- alias: 'Hallway and toilet lights off in morning'
- alias: 'Night light 2 on at bedtime'
trigger:
platform: sun
event: sunrise
offset: "0:10:00"
platform: time
at: '19:15:00'
action:
#- service: light.turn_off
# data:
# entity_id: light.hallway
- service: light.turn_off
- service: light.turn_on
data:
entity_id: light.toilet
entity_id: !secret night_light2
rgb_color: [255, 0, 190]
brightness_pct: 80
- alias: 'Night light on at bedtime'
- alias: 'Night lights red at 5am'
trigger:
platform: time
at: '19:30:00'
at: '05:00:00'
action:
- service: light.turn_on
data:
entity_id: light.night_light
entity_id: !secret night_light1
rgb_color: [255, 0, 0]
brightness_pct: 80
- service: light.turn_on
data:
entity_id: !secret night_light2
rgb_color: [255, 0, 0]
brightness_pct: 80
- alias: 'Night light off in morning (workdays)'
trigger:
- alias: 'Night lights green in morning (workdays)'
trigger:
platform: time
at: '07:30:00'
condition:
......@@ -50,14 +51,27 @@
entity_id: 'input_boolean.on_holiday'
state: 'off'
action:
- service: light.turn_off
- service: light.turn_on
data:
entity_id: light.night_light
entity_id: !secret night_light1
rgb_color: [0, 255, 0]
brightness_pct: 80
- service: light.turn_on
data:
entity_id: !secret night_light2
rgb_color: [0, 255, 0]
brightness_pct: 80
- delay:
minutes: 15
- service: light.turn_off
entity_id: !secret night_light1
- service: light.turn_off
entity_id: !secret night_light2
- alias: 'Night light off in morning (non-workdays)'
trigger:
- alias: 'Night light green in morning (non-workdays)'
trigger:
platform: time
at: '08:00:00'
at: '08:15:00'
condition:
condition: or
conditions:
......@@ -68,7 +82,21 @@
entity_id: 'input_boolean.on_holiday'
state: 'on'
action:
- service: light.turn_off
- service: light.turn_on
data:
entity_id: light.night_light
entity_id: !secret night_light1
rgb_color: [0, 255, 0]
brightness_pct: 80
- service: light.turn_on
data:
entity_id: !secret night_light2
rgb_color: [0, 255, 0]
brightness_pct: 80
- delay:
minutes: 15
- service: light.turn_off
entity_id: !secret night_light1
- service: light.turn_off
entity_id: !secret night_light2
......@@ -9,11 +9,8 @@
entity_id: group.presence
state: home
action:
service: light.turn_on
entity_id: light.main_lights
data:
brightness: 255
rgb_color: [255, 255, 255]
service: scene.turn_on
entity_id: scene.main_lights
- alias: 'Lights on at sunset, cloudy days'
trigger:
......@@ -30,11 +27,8 @@
entity_id: sensor.dark_sky_cloud_coverage
above: 50
action:
service: light.turn_on
entity_id: light.main_lights
data:
brightness: 255
rgb_color: [255, 255, 255]
service: scene.turn_on
entity_id: scene.main_lights
- alias: 'Lights on if someone comes home, after sunset'
trigger:
......@@ -47,9 +41,6 @@
after: sunset
after_offset: "-00:20:00"
action:
service: light.turn_on
entity_id: light.main_lights
data:
brightness: 255
rgb_color: [255, 255, 255]
service: scene.turn_on
entity_id: scene.main_lights
- alias: '5pm Temperature Notofications (Wed-Fri)'
trigger:
platform: time
# wed, thur, fri at 5pm
minutes: 0
hours: 17
seconds: 0
condition:
- condition: time
weekday:
- wed
- thu
- fri
- condition: state
entity_id: group.presence
state: not_home
action:
service: notify.html5_family
data:
title: "Temperature Report"
message: "The temperature in {{ states.sensor.bed1_temperature.friendly_name }} is {{ states('sensor.bed1_temperature') }}{{ states.sensor.bed1_temperature.attributes['unit_of_measurement'] }} and {{ states.sensor.bed2_temperature.friendly_name }} is {{ states('sensor.bed2_temperature') }}{{ states.sensor.bed2_temperature.attributes['unit_of_measurement'] }}"
- alias: 'Motion detection notifications'
trigger:
platform: state
entity_id: binary_sensor.bed1_motion
from: "off"
to: "on"
condition:
condition: time
after: "20:00:00"
before: "23:30:00"
action:
service: script.turn_on
entity_id: script.motion_sense_notify_wait_10mins
- alias: 'Internal motion detection alarm'
trigger:
- platform: state
entity_id: binary_sensor.bed1_motion
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.garage_motion
from: 'off'
to: 'on'
- platform: state
entity_id: binary_sensor.kitchen_motion
from: 'off'
to: 'on'
condition:
condition: state
entity_id: group.presence
state: not_home
action:
service: notify.html5_notify1
data:
title: "ALERT: Internal Motion Detection"
message: >
Internal motion detection was triggered at {{ now }}. The following sensors were triggered:
{% for sensor in states.group.internal_motion.attributes.entity_id %}
{% if states(sensor) == "on" %}{{ sensor.split(".")[1].split("_")[0].capitalize() }}
{% endif %}
{% endfor %}.
tag: "internal-motion-notification"
- alias: 'Update Available Notifications'
trigger:
platform: state
entity_id: updater.updater
action:
service: notify.smtp_notify1
data:
title: "Update Available"
message: 'Update for Home Assistant is available.'
- alias: "Electric blankets prompt"
trigger:
platform: time
at: "21:30:00"
condition:
condition: and
conditions:
# - condition: template
# value_template: "{{ states.weather.home.attributes.temperature <= 10.0 }}"
- condition: state
entity_id: group.presence
state: "home"
action:
- service: homeassistant.turn_on
entity_id: group.electric_blankets
- service: notify.gotify_1
data:
title: "It's cold tonight!"
message: "Go and make sure the electric blankets are turned on."
......@@ -2,13 +2,15 @@
- alias: 'Kettle off at night'
trigger:
platform: time
minutes: 0
hours: 23
seconds: 0
at: "23:00:00"
condition:
condition: state
entity_id: switch.kettle
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.kettle
- service: notify.html5_notify1
- service: notify.smtp_notify1
data:
title: "Set up the Kettle"
message: 'Remember to set up the kettle!'
- alias: 'Motion detection notifications'
trigger:
platform: state
entity_id: !secret motion_sensor1
from: "off"
to: "on"
condition:
condition: time
after: "20:00:00"
before: "23:00:00"
action:
service: script.turn_on
entity_id: script.motion_sense_notify_wait_10mins
#- alias: 'Internal motion detection alarm'
# trigger:
# - platform: state
# entity_id: !secret motion_sensor1
# from: 'off'
# to: 'on'
# condition:
# condition: state
# entity_id: group.presence
# state: not_home
# action:
# service: !secret notify_service1
# data:
# title: "ALERT: Internal Motion Detection"
# message: >
# Internal motion detection was triggered at {{ now }}. The following sensors were triggered:
# {% for sensor in states.group.internal_motion.attributes.entity_id %}
# {% if states(sensor) == "on" %}{{ sensor.split(".")[1].split("_")[0].capitalize() }}
# {% endif %}
# {% endfor %}.
# tag: "internal-motion-notification"
......@@ -2,14 +2,14 @@
- alias: !secret n1_alias
trigger:
platform: zone
entity_id: device_tracker.rob_ot_nexus
entity_id: !secret device_1
zone: zone.zone_1
event: enter
condition:
condition: time
before: !secret n1_time
action:
service: notify.html5_notify2
service: notify.smtp_notify2
data:
title: !secret n1_title
message: !secret n1_message
......@@ -19,14 +19,14 @@
- alias: !secret n2_alias
trigger:
platform: zone
entity_id: device_tracker.rob_ot_nexus
entity_id: !secret device_1
zone: zone.zone_2
event: enter
condition:
condition: time
after: !secret n2_time
action:
service: notify.html5_notify2
service: notify.smtp_notify2
data:
title: !secret n2_title
message: !secret n2_message
......@@ -36,14 +36,14 @@
- alias: !secret n3_alias
trigger:
platform: zone
entity_id: device_tracker.rob_ot_nexus
entity_id: !secret device_1
zone: zone.zone_3
event: enter
condition:
condition: time
before: !secret n3_time
action:
service: notify.html5_notify2
service: notify.smtp_notify2
data:
title: !secret n3_title
message: !secret n3_message
......@@ -53,14 +53,14 @@
- alias: !secret n4_alias
trigger:
platform: zone
entity_id: device_tracker.rob_ot_nexus
entity_id: !secret device_1
zone: zone.zone_3
event: leave
condition:
condition: time
after: !secret n4_time
action:
service: notify.html5_notify2
service: notify.smtp_notify2
data:
title: !secret n4_title
message: !secret n4_message
......
- alias: 'Update Available Notifications'
trigger:
platform: state
entity_id: updater.updater
action:
service: notify.smtp_notify1
data:
title: "Update Available"
message: 'Update for Home Assistant is available.'
......@@ -5,9 +5,9 @@
topic: !secret sc_topic
payload: !secret sc_b1_payload
action:
service: scene.turn_on
service: script.turn_on
data:
entity_id: scene.downlights_bright
entity_id: script.downlights_bright
- alias: 'Switch off kitchen downlights'
trigger:
......@@ -15,7 +15,7 @@
topic: !secret sc_topic
payload: !secret sc_b2_payload
action:
service: homeassistant.turn_off
service: light.turn_off
data:
entity_id: group.kitchen_downlights
entity_id: light.kitchen_downlights
# the kettle switch will almost always be on when HASS starts
- alias: "Sync kettle on startup"
trigger:
platform: homeassistant
event: start
action:
service: switch.turn_on
entity_id: switch.kettle
......@@ -33,7 +33,17 @@
event_data:
entity_id: timer.tv_off
action: