Initial commit

This commit is contained in:
2020-02-13 09:38:44 +02:00
commit 13f9d2651a
17 changed files with 829 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
custom_components/
secrets.yaml
+5
View File
@@ -0,0 +1,5 @@
{
"files.associations": {
"*.yaml": "home-assistant"
}
}
+151
View File
@@ -0,0 +1,151 @@
# https://www.home-assistant.io/integrations/automation
#
# ─── PUBLIC ─────────────────────────────────────────────────────────────────────
#
- id: leaving_home
alias: Leaving home
trigger:
platform: state
entity_id: person.georgi
to: "not_home"
action:
- service: script.security_camera_on
- service: media_player.turn_off
entity_id: media_player.living_room_tv
- service: media_player.turn_off
entity_id: media_player.living_room_tv_2
- service: light.turn_off
entity_id: light.living_room_all_lights
- id: coming_home
alias: Coming home
trigger:
platform: state
entity_id: person.georgi
to: "home"
action:
- service: script.security_camera_off
- service: light.turn_on
entity_id: light.living_room_all_lights
- alias: Play welcome music when I come back
trigger:
platform: state
entity_id: person.georgi
to: "home"
action:
- service: media_player.turn_on
entity_id: media_player.living_room_tv_2
- delay: "00:00:10"
- service: spotcast.start
data:
device_name: "Living Room TV"
uri: "spotify:playlist:1dstTefWFQaBFTC6CjcEHd"
random_song: true
#
# ─── PRIVATE ────────────────────────────────────────────────────────────────────
#
# Hack - the switch.camera initial state is wrong (ON) when the server starts.
- id: hass_startup
alias: "Hass startup"
trigger:
- platform: homeassistant
event: start
action:
- service: switch.turn_off
entity_id: switch.camera
- id: enable_guest_mode
alias: Enable Guest Mode
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "off"
to: "on"
action:
- service: automation.turn_off
entity_id: automation.leaving_home
- service: automation.turn_off
entity_id: automation.coming_home
- id: disable_guest_mode
alias: Disable Guest Mode
trigger:
platform: state
entity_id: input_boolean.guest_mode
from: "on"
to: "off"
action:
- service: automation.turn_on
entity_id: automation.leaving_home
- service: automation.turn_on
entity_id: automation.coming_home
- id: enable_sleep_mode
alias: Enable Sleep Mode
trigger:
platform: state
entity_id: input_boolean.sleep_mode
from: "off"
to: "on"
action:
- service: media_player.turn_off
entity_id: media_player.living_room_tv
- service: media_player.turn_off
entity_id: media_player.living_room_tv_2
- service: light.turn_off
entity_id: light.living_room_all_lights
- alias: Trigger Domestina Start
trigger:
platform: time
at: "08:30:00"
condition:
- condition: time
weekday: thu
action:
- service: input_boolean.turn_on
entity_id: input_boolean.domestina
- alias: On Domestina Start
trigger:
platform: state
entity_id: input_boolean.domestina
from: "off"
to: "on"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.guest_mode
- service: notify.mobile_app_carbon
data:
message: "Enabling Domestina Mode"
- alias: Trigger Domestina End
trigger:
platform: time
at: "13:00:00"
condition:
- condition: time
weekday: thu
action:
- service: input_boolean.turn_off
entity_id: input_boolean.domestina
- alias: On Domestina End
trigger:
platform: state
entity_id: input_boolean.domestina
from: "on"
to: "off"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.guest_mode
- service: automation.turn_on
entity_id: automation.leaving_home
- service: notify.mobile_app_carbon
data:
message: "Disabling Domestina Mode"
+9
View File
@@ -0,0 +1,9 @@
# https://www.home-assistant.io/integrations/binary_sensor
- platform: template
sensors:
camera_state:
friendly_name: "Security camera"
device_class: safety
value_template: >-
{{ state_attr('camera.amcrest_camera', 'motion_recording') != 'on' }}
+178
View File
@@ -0,0 +1,178 @@
homeassistant:
name: Sarah
latitude: !secret home_latitude
longitude: !secret home_longitude
elevation: !secret home_elevation
unit_system: metric
time_zone: Europe/Sofia
customize: !include_dir_merge_named customize
#
# ─── HOME ASSISTANT COMPONENTS ENABLED ──────────────────────────────────────────
#
# https://www.home-assistant.io/components/config
config:
# https://home-assistant.io/components/http
http:
login_attempts_threshold: 20
# lovelace:
# mode: yaml
# https://www.home-assistant.io/components/logbook
logbook:
# https://www.home-assistant.io/components/map
map:
# https://www.home-assistant.io/integrations/mobile_app
mobile_app:
# https://www.home-assistant.io/components/person
person:
- name: Georgi
id: !secret georgi_user_id
user_id: !secret georgi_user_id
device_trackers:
- device_tracker.carbon
# https://www.home-assistant.io/components/system_health
system_health:
# https://www.home-assistant.io/components/updater
updater:
# https://www.home-assistant.io/components/logger
# logger:
# default: notset
#
# ─── INTEGRATIONS ───────────────────────────────────────────────────────────────
#
# https://www.home-assistant.io/integrations/amcrest
amcrest:
- host: !secret amcrest_ip
username: !secret amcrest_username
password: !secret amcrest_password
resolution: low
scan_interval: 5
binary_sensors:
- motion_detected
- online
# https://www.home-assistant.io/integrations/automation
automation: !include automations.yaml
# https://www.home-assistant.io/integrations/binary_sensor
binary_sensor: !include binary_sensor.yaml
# https://www.home-assistant.io/integrations/device_tracker
device_tracker:
- platform: tile
username: !secret tile_username
password: !secret tile_password
# https://www.home-assistant.io/integrations/ffmpeg
ffmpeg:
# https://www.home-assistant.io/integrations/frontend
frontend:
themes: !include_dir_merge_named themes
# https://www.home-assistant.io/integrations/group
group: !include groups.yaml
# https://www.home-assistant.io/integrations/history
history:
# https://www.home-assistant.io/integrations/input_boolean
input_boolean: !include input_boolean.yaml
# https://www.home-assistant.io/integrations/light
light: !include light.yaml
# https://www.home-assistant.io/integrations/media_extractor
media_extractor:
# https://www.home-assistant.io/integrations/scene
scene: !include scenes.yaml
# https://www.home-assistant.io/integrations/script
script: !include scripts.yaml
# https://www.home-assistant.io/integrations/sensor
sensor: !include sensor.yaml
# https://www.home-assistant.io/integrations/spotify
spotify:
client_id: !secret spotify_client_id
client_secret: !secret spotify_client_secret
# https://www.home-assistant.io/integrations/sun
sun:
# https://www.home-assistant.io/integrations/switch
switch: !include switch.yaml
# https://www.home-assistant.io/integrations/tts
tts:
- platform: amazon_polly
aws_access_key_id: !secret aws_polly_client_id
aws_secret_access_key: !secret aws_polly_client_secret
region_name: eu-central-1
voice: Emma
# https://www.home-assistant.io/integrations/tuya
tuya:
username: !secret tuya_username
password: !secret tuya_password
country_code: bg
# https://www.home-assistant.io/integrations/upnp
upnp:
# https://www.home-assistant.io/integrations/wake_on_lan
wake_on_lan:
# https://www.home-assistant.io/integrations/webostv
webostv:
- host: !secret living_room_tv_ip
name: Living Room TV
turn_on_action:
service: wake_on_lan.send_magic_packet
data:
mac: !secret living_room_tv_mac
# customize:
# sources:
# - livetv
# - youtube
# - makotv
# - netflix
# https://www.home-assistant.io/integrations/zeroconf
zeroconf:
# https://www.home-assistant.io/integrations/zone
zone: !include zone.yaml
#
# ─── PLUGINS ────────────────────────────────────────────────────────────────────
#
spotcast:
username: !secret spotify_spotcast_username
password: !secret spotify_spotcast_password
hacs:
token: !secret hacs_github_token
appdaemon: true
# Philips Purifier
fan:
platform: philips-airpurifier
host: !secret philips_purifier_ip
uilogs:
+249
View File
@@ -0,0 +1,249 @@
elements:
- icon: 'mdi:fan'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
opacity: 0.7
top: 7%
tap_action: none
type: icon
- entity: sensor.purifier_speed
style:
border-color: 'rgb(34, 154, 210)'
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 6%
opacity: 1
pointer-events: none
text-shadow: 1px 1px black
top: 7%
transform: 'translate(0%,-50%)'
type: state-label
- icon: 'mdi:water-percent'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
top: 20%
tap_action: none
type: icon
- attribute: humidity
color_stops: null
entity: fan.philips_airpurifier
fill: 'rgba(0,0,0,0.3)'
font_style:
color: white
gradient: true
max: 100
min: 0
show_card: null
stroke_width: 10
style:
height: 60px
left: 10%
top: 20%
width: 60px
type: 'custom:circle-sensor-card'
units: '%'
- icon: 'mdi:thermometer'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
top: 35%
tap_action: none
type: icon
- attribute: temperature
color_stops: null
entity: fan.philips_airpurifier
fill: 'rgba(0,0,0,0.3)'
font_style:
color: white
gradient: true
max: 100
min: 0
show_card: null
stroke_width: 10
style:
height: 60px
left: 10%
top: 35%
width: 60px
type: 'custom:circle-sensor-card'
units: °C
- icon: 'mdi:bug'
style:
'--iron-icon-height': 45px
'--iron-icon-width': 45px
color: dodgerblue
left: 10%
top: 50%
tap_action: none
type: icon
- attribute: allergen_index
color_stops: null
entity: fan.philips_airpurifier
fill: 'rgba(0,0,0,0.3)'
font_style:
color: white
gradient: true
max: 10
min: 0
show_card: null
stroke_width: 10
style:
height: 60px
left: 10%
top: 50%
width: 60px
type: 'custom:circle-sensor-card'
- entity: sensor.purifier_mode
prefix: 'Mode: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 80%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_target_humidity
prefix: 'Target humidity: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 85%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_water_level
prefix: 'Water level: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 90%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_brightness
prefix: 'Brightness: '
style:
border-color: 'rgb(34, 154, 210)'
border-right-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
opacity: 0.8
pointer-events: none
right: 1%
text-shadow: 1px 1px black
top: 95%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_air_quality
style:
border-color: 'rgb(34, 154, 210)'
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 120%
font-weight: bold
left: 46%
opacity: 1
pointer-events: none
text-shadow: 1px 1px black
top: 22%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_pre_filter
prefix: 'Pre-filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 80%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_wick_filter
prefix: 'Wick filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 85%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_carbon_filter
prefix: 'Carbon filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 90%
transform: 'translate(0%,-50%)'
type: state-label
- entity: sensor.purifier_hepa_filter
prefix: 'HEPA filter: '
style:
border-color: 'rgb(34, 154, 210)'
border-left-style: solid
color: 'rgb(255, 255, 255)'
font-family: Trebuchet MS
font-size: 90%
font-weight: bold
left: 1%
opacity: 0.8
pointer-events: none
text-shadow: 1px 1px black
top: 95%
transform: 'translate(0%,-50%)'
type: state-label
image: /local/images/purifier-image.png
type: picture-elements
+5
View File
@@ -0,0 +1,5 @@
automation.coming_home:
icon: mdi:home-account
automation.leaving_home:
icon: mdi:home
+5
View File
@@ -0,0 +1,5 @@
device_tracker.tile_p_6e3c33752f24f417254c039040a984bd:
friendly_name: "Georgi's iPhone Tile"
device_tracker.tile_1bcb2b3021b9f96b:
friendly_name: "Keys Tile"
View File
+16
View File
@@ -0,0 +1,16 @@
# https://www.home-assistant.io/integrations/input_boolean
sleep_mode:
name: Sleep Mode
initial: off
icon: mdi:sleep
guest_mode:
name: Guest Mode
initial: off
icon: mdi:human-greeting
domestina:
name: Domestina Time
initial: off
icon: mdi:broom
+17
View File
@@ -0,0 +1,17 @@
# https://www.home-assistant.io/integrations/light
- platform: group
name: Living Room Main Lights
entities:
- light.living_room_1
- light.living_room_2
- light.living_room_3
- light.living_room_4
- platform: group
name: Living Room All Lights
entities:
- light.living_room_1
- light.living_room_2
- light.living_room_3
- light.living_room_4
- light.pc
View File
+74
View File
@@ -0,0 +1,74 @@
# https://www.home-assistant.io/integrations/script
sarah_restart:
alias: Restart SARAH
sequence:
service: homeassistant.restart
security_camera_on:
alias: Turn Security Camera on
sequence:
- service: amcrest.goto_preset
entity_id: camera.amcrest_camera
data:
preset: 1
- service: amcrest.enable_motion_recording
entity_id: camera.amcrest_camera
- service: amcrest.enable_recording
entity_id: camera.amcrest_camera
- service: amcrest.enable_audio
entity_id: camera.amcrest_camera
security_camera_off:
alias: Turn Security Camera off
sequence:
- service: amcrest.goto_preset
entity_id: camera.amcrest_camera
data:
preset: 3
- service: amcrest.disable_motion_recording
entity_id: camera.amcrest_camera
- service: amcrest.disable_recording
entity_id: camera.amcrest_camera
- service: amcrest.disable_audio
entity_id: camera.amcrest_camera
tv_chill:
alias: TV Chill
sequence:
- service: media_extractor.play_media
data:
entity_id: media_player.living_room_tv_2
media_content_id: "https://www.youtube.com/watch?v=UgHKb_7884o"
media_content_type: video/youtube
latest_pds:
alias: Play the latest PDS
sequence:
- service: media_extractor.play_media
data_template:
entity_id: media_player.living_room_tv_2
media_content_id: "{{ state_attr('sensor.philip_defranco', 'url') }}"
media_content_type: video/youtube
say:
alias: Sonos TTS
sequence:
- service: sonos.snapshot
data_template:
entity_id: media_player.master_bedroom
- delay: "00:00:03"
# - service: media_player.play_media
# data:
# entity_id: media_player.master_bedroom
# media_content_id: http://REDACTED33:8123/local/sounds/two-tone-chime.mp3
# media_content_type: music
# - delay: '00:00:02'
- service: tts.amazon_polly_say
data_template:
entity_id: media_player.master_bedroom
message: "{{ what }}"
- delay: "00:00:03"
- service: sonos.restore
data_template:
entity_id: media_player.master_bedroom
+55
View File
@@ -0,0 +1,55 @@
# Youtube sensor
- platform: youtube
channel_id: UClFSU9_bUb4Rc6OYfTt5SPw
# Philips Purifier sensors
- platform: template
sensors:
purifier_air_quality:
friendly_name: "Air quality"
value_template: "{{ states.fan.philips_airpurifier.attributes.pm25 }}"
purifier_humidity:
friendly_name: "Humidity"
unit_of_measurement: "%"
value_template: "{{ states.fan.philips_airpurifier.attributes.humidity }}"
purifier_temperature:
friendly_name: "Temperature"
unit_of_measurement: "°C"
value_template: "{{ states.fan.philips_airpurifier.attributes.temperature }}"
purifier_speed:
friendly_name: "Speed"
value_template: "{{ states.fan.philips_airpurifier.attributes.speed }}"
purifier_allergens:
friendly_name: "Allergen index"
value_template: "{{ states.fan.philips_airpurifier.attributes.allergen_index }}"
purifier_mode:
friendly_name: "Mode"
value_template: "{{ states.fan.philips_airpurifier.attributes.function }}"
purifier_pre_filter:
friendly_name: "Pre-filter"
unit_of_measurement: "Hrs"
value_template: "{{ states.fan.philips_airpurifier.attributes.pre_filter }}"
purifier_wick_filter:
friendly_name: "Wick filter"
unit_of_measurement: "Hrs"
value_template: "{{ states.fan.philips_airpurifier.attributes.wick_filter }}"
purifier_carbon_filter:
friendly_name: "Carbon filter"
unit_of_measurement: "Hrs"
value_template: "{{ states.fan.philips_airpurifier.attributes.carbon_filter }}"
purifier_hepa_filter:
friendly_name: "HEPA filter"
unit_of_measurement: "Hrs"
value_template: "{{ states.fan.philips_airpurifier.attributes. hepa_filter}}"
purifier_target_humidity:
friendly_name: "Target humidity"
unit_of_measurement: "%"
value_template: "{{ states.fan.philips_airpurifier.attributes.target_humidity }}"
purifier_water_level:
friendly_name: "Water level"
unit_of_measurement: "%"
value_template: "{{ states.fan.philips_airpurifier.attributes.water_level }}"
purifier_brightness:
friendly_name: "brightness"
unit_of_measurement: "%"
value_template: "{{ states.fan.philips_airpurifier.attributes.light_brightness }}"
+15
View File
@@ -0,0 +1,15 @@
# https://www.home-assistant.io/integrations/switch
- platform: template
switches:
camera:
friendly_name: "Security Camera"
value_template: "{{ state_attr('camera.amcrest_camera', 'motion_recording') == 'on' }}"
icon_template: >
{% if state_attr('camera.amcrest_camera', 'motion_recording') == 'on' %} mdi:shield-home
{% else %} mdi:shield-off
{% endif %}
turn_on:
service: script.security_camera_on
turn_off:
service: script.security_camera_off
+35
View File
@@ -0,0 +1,35 @@
# WIP
title: Home
views:
- path: home
title: Home
panel: false
badges:
- entity: binary_sensor.updater
- entity: sun.sun
- entity: person.georgi
cards:
- entities:
- entity: device_tracker.tile_p_6e3c33752f24f417254c039040a984bd
- entity: device_tracker.tile_1bcb2b3021b9f96b
theme: default
title: Tiles
type: entities
- entity: weather.home
type: weather-forecast
- entity: light.pc_light
name: PC Light
type: light
- path: media
title: Media
cards:
- entity: media_player.living_room_chromecast
type: media-control
- entity: media_player.living_room_tv
type: media-control
- entity: media_player.spotify
type: media-control
+13
View File
@@ -0,0 +1,13 @@
# https://www.home-assistant.io/components/zone
- name: Home
latitude: !secret home_latitude
longitude: !secret home_longitude
radius: 20
icon: mdi:home
- name: Work
latitude: !secret work_latitude
longitude: !secret work_longitude
radius: 60
icon: mdi:worker