mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-06-09 23:02:59 +00:00
Move config to a subfolder
This commit is contained in:
@@ -0,0 +1,312 @@
|
||||
# https://www.home-assistant.io/integrations/light
|
||||
# https://www.home-assistant.io/integrations/light.group/
|
||||
|
||||
light:
|
||||
- platform: mqtt
|
||||
name: "PC"
|
||||
availability_topic: "tele/pc_light/LWT"
|
||||
command_topic: "cmnd/pc_light/POWER"
|
||||
state_topic: "tele/pc_light/STATE"
|
||||
state_value_template: "{{ value_json.POWER }}"
|
||||
brightness_command_topic: "cmnd/pc_light/Dimmer"
|
||||
brightness_state_topic: "tele/pc_light/STATE"
|
||||
brightness_scale: 100
|
||||
on_command_type: "brightness"
|
||||
brightness_value_template: "{{ value_json.Dimmer }}"
|
||||
hs_command_topic: "cmnd/pc_light/HSBColor"
|
||||
hs_state_topic: "tele/pc_light/STATE"
|
||||
hs_value_template: "{{ value_json.HSBColor.split(',')[0:2]|join(',') }}"
|
||||
color_temp_command_topic: "cmnd/pc_light/CT"
|
||||
color_temp_state_topic: "tele/pc_light/STATE"
|
||||
color_temp_value_template: "{{ value_json.CT }}"
|
||||
rgb_command_topic: "cmnd/pc_light/Color"
|
||||
rgb_state_topic: "tele/pc_light/STATE"
|
||||
rgb_value_template: "{{ value_json.Color.split(',')[0:3]|join(',') }}"
|
||||
payload_on: "ON"
|
||||
payload_off: "OFF"
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
retain: false
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 1"
|
||||
availability_topic: "tele/living_room_1/LWT"
|
||||
command_topic: "cmnd/living_room_1/POWER"
|
||||
state_topic: "tele/living_room_1/STATE"
|
||||
state_value_template: "{{ value_json.POWER }}"
|
||||
brightness_command_topic: "cmnd/living_room_1/Dimmer"
|
||||
brightness_state_topic: "tele/living_room_1/STATE"
|
||||
brightness_scale: 100
|
||||
on_command_type: "brightness"
|
||||
brightness_value_template: "{{ value_json.Dimmer }}"
|
||||
color_temp_command_topic: "cmnd/living_room_1/CT"
|
||||
color_temp_state_topic: "tele/living_room_1/STATE"
|
||||
color_temp_value_template: "{{ value_json.CT }}"
|
||||
payload_on: "ON"
|
||||
payload_off: "OFF"
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
retain: false
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 2"
|
||||
availability_topic: "tele/living_room_2/LWT"
|
||||
command_topic: "cmnd/living_room_2/POWER"
|
||||
state_topic: "tele/living_room_2/STATE"
|
||||
state_value_template: "{{ value_json.POWER }}"
|
||||
brightness_command_topic: "cmnd/living_room_2/Dimmer"
|
||||
brightness_state_topic: "tele/living_room_2/STATE"
|
||||
brightness_scale: 100
|
||||
on_command_type: "brightness"
|
||||
brightness_value_template: "{{ value_json.Dimmer }}"
|
||||
color_temp_command_topic: "cmnd/living_room_2/CT"
|
||||
color_temp_state_topic: "tele/living_room_2/STATE"
|
||||
color_temp_value_template: "{{ value_json.CT }}"
|
||||
payload_on: "ON"
|
||||
payload_off: "OFF"
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
retain: false
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 3"
|
||||
availability_topic: "tele/living_room_3/LWT"
|
||||
command_topic: "cmnd/living_room_3/POWER"
|
||||
state_topic: "tele/living_room_3/STATE"
|
||||
state_value_template: "{{ value_json.POWER }}"
|
||||
brightness_command_topic: "cmnd/living_room_3/Dimmer"
|
||||
brightness_state_topic: "tele/living_room_3/STATE"
|
||||
brightness_scale: 100
|
||||
on_command_type: "brightness"
|
||||
brightness_value_template: "{{ value_json.Dimmer }}"
|
||||
color_temp_command_topic: "cmnd/living_room_3/CT"
|
||||
color_temp_state_topic: "tele/living_room_3/STATE"
|
||||
color_temp_value_template: "{{ value_json.CT }}"
|
||||
payload_on: "ON"
|
||||
payload_off: "OFF"
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
retain: false
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 4"
|
||||
availability_topic: "tele/living_room_4/LWT"
|
||||
command_topic: "cmnd/living_room_4/POWER"
|
||||
state_topic: "tele/living_room_4/STATE"
|
||||
state_value_template: "{{ value_json.POWER }}"
|
||||
brightness_command_topic: "cmnd/living_room_4/Dimmer"
|
||||
brightness_state_topic: "tele/living_room_4/STATE"
|
||||
brightness_scale: 100
|
||||
on_command_type: "brightness"
|
||||
brightness_value_template: "{{ value_json.Dimmer }}"
|
||||
color_temp_command_topic: "cmnd/living_room_4/CT"
|
||||
color_temp_state_topic: "tele/living_room_4/STATE"
|
||||
color_temp_value_template: "{{ value_json.CT }}"
|
||||
payload_on: "ON"
|
||||
payload_off: "OFF"
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
retain: false
|
||||
|
||||
- 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_main_lights
|
||||
- light.pc
|
||||
|
||||
- platform: group
|
||||
name: All lights
|
||||
entities:
|
||||
- light.living_room_all_lights
|
||||
- light.bedside_light
|
||||
|
||||
sensor:
|
||||
- platform: mqtt
|
||||
name: "PC light WiFi"
|
||||
availability_topic: "tele/pc_light/LWT"
|
||||
device_class: signal_strength
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
state_topic: "tele/pc_light/STATE"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json['Wifi'].RSSI }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 1 light WiFi"
|
||||
availability_topic: "tele/living_room_1/LWT"
|
||||
device_class: signal_strength
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
state_topic: "tele/living_room_1/STATE"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json['Wifi'].RSSI }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 2 light WiFi"
|
||||
availability_topic: "tele/living_room_2/LWT"
|
||||
device_class: signal_strength
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
state_topic: "tele/living_room_2/STATE"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json['Wifi'].RSSI }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 3 light WiFi"
|
||||
availability_topic: "tele/living_room_3/LWT"
|
||||
device_class: signal_strength
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
state_topic: "tele/living_room_3/STATE"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json['Wifi'].RSSI }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 4 light WiFi"
|
||||
availability_topic: "tele/living_room_4/LWT"
|
||||
device_class: signal_strength
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
state_topic: "tele/living_room_4/STATE"
|
||||
unit_of_measurement: "%"
|
||||
value_template: "{{ value_json['Wifi'].RSSI }}"
|
||||
|
||||
switch:
|
||||
- platform: mqtt
|
||||
name: "PC Light Fade"
|
||||
availability_topic: "tele/pc_light/LWT"
|
||||
command_topic: "cmnd/pc_light/FADE"
|
||||
icon: mdi:gradient
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
state_topic: "stat/pc_light/RESULT"
|
||||
value_template: "{{ value_json.Fade }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 1 light Fade"
|
||||
availability_topic: "tele/living_room_1/LWT"
|
||||
command_topic: "cmnd/living_room_1/FADE"
|
||||
icon: mdi:gradient
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
state_topic: "stat/living_room_1/RESULT"
|
||||
value_template: "{{ value_json.Fade }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 2 light Fade"
|
||||
availability_topic: "tele/living_room_2/LWT"
|
||||
command_topic: "cmnd/living_room_2/FADE"
|
||||
icon: mdi:gradient
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
state_topic: "stat/living_room_2/RESULT"
|
||||
value_template: "{{ value_json.Fade }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 3 light Fade"
|
||||
availability_topic: "tele/living_room_3/LWT"
|
||||
command_topic: "cmnd/living_room_3/FADE"
|
||||
icon: mdi:gradient
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
state_topic: "stat/living_room_3/RESULT"
|
||||
value_template: "{{ value_json.Fade }}"
|
||||
|
||||
- platform: mqtt
|
||||
name: "Living room 4 light Fade"
|
||||
availability_topic: "tele/living_room_4/LWT"
|
||||
command_topic: "cmnd/living_room_4/FADE"
|
||||
icon: mdi:gradient
|
||||
payload_available: "Online"
|
||||
payload_not_available: "Offline"
|
||||
qos: 1
|
||||
state_topic: "stat/living_room_4/RESULT"
|
||||
value_template: "{{ value_json.Fade }}"
|
||||
|
||||
automation:
|
||||
- alias: Lighting · Turn on all lights after sunset
|
||||
trigger:
|
||||
platform: sun
|
||||
event: sunset
|
||||
offset: "+00:00:00"
|
||||
condition:
|
||||
- condition: state
|
||||
entity_id: binary_sensor.georgi_home
|
||||
state: "on"
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id: light.all_lights
|
||||
|
||||
- alias: Lighting · Turn off all lights after sunrise
|
||||
trigger:
|
||||
platform: sun
|
||||
event: sunrise
|
||||
offset: "+00:00:00"
|
||||
action:
|
||||
- service: light.turn_off
|
||||
entity_id: light.all_lights
|
||||
|
||||
- alias: Lighting · Master bedroom · Toggle bedside light on bedisde switch single click"
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret master_bedroom_bedside_switch_ieee
|
||||
command: single
|
||||
action:
|
||||
- service: light.toggle
|
||||
entity_id: light.bedside_light
|
||||
|
||||
- alias: Lighting · Living room · Turn all lights on on Magic Cube flip 90
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret magic_cube_ieee
|
||||
command: flip
|
||||
args:
|
||||
flip_degrees: 90
|
||||
action:
|
||||
- service: light.turn_on
|
||||
entity_id: light.living_room_all_lights
|
||||
|
||||
- alias: Lighting · Living room · Turn all lights off on Magic Cube flip 180
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret magic_cube_ieee
|
||||
command: flip
|
||||
args:
|
||||
flip_degrees: 180
|
||||
action:
|
||||
- service: light.turn_off
|
||||
entity_id: light.living_room_all_lights
|
||||
|
||||
- alias: Lighting · Sync Tasmota states on start-up
|
||||
initial_state: true
|
||||
trigger:
|
||||
platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- service: mqtt.publish
|
||||
data:
|
||||
topic: "cmnd/tasmotas/STATE"
|
||||
payload: ""
|
||||
@@ -0,0 +1,92 @@
|
||||
group:
|
||||
all_sonos:
|
||||
name: All Sonos
|
||||
entities:
|
||||
- media_player.master_bedroom
|
||||
- media_player.living_room
|
||||
- media_player.kitchen
|
||||
- media_player.bathroom
|
||||
|
||||
input_select:
|
||||
sonos_leader:
|
||||
name: Sonos Leader
|
||||
initial: media_player.master_bedroom
|
||||
icon: mdi:speaker
|
||||
options:
|
||||
- media_player.master_bedroom
|
||||
- media_player.living_room
|
||||
- media_player.kitchen
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
sonos_leader_paused:
|
||||
value_template: "{{ is_state(states.input_select.sonos_leader.state, 'paused') }}"
|
||||
entity_id:
|
||||
- input_select.sonos_leader
|
||||
- media_player.master_bedroom
|
||||
- media_player.kitchen
|
||||
- media_player.living_room
|
||||
|
||||
script:
|
||||
music_play:
|
||||
alias: Music · Play
|
||||
sequence:
|
||||
- service: script.music_join_sonoses
|
||||
- service: media_player.volume_set
|
||||
entity_id: group.all_sonos
|
||||
data_template:
|
||||
volume_level: "{{ volume | default(0.3) }}"
|
||||
- service: media_player.shuffle_set
|
||||
data_template:
|
||||
entity_id: "{{ states('input_select.sonos_leader') }}"
|
||||
shuffle: "{{ shuffle | default(true) }}"
|
||||
- service: media_player.select_source
|
||||
data_template:
|
||||
entity_id: "{{ states('input_select.sonos_leader') }}"
|
||||
source: "{{ playlist | default('Evening Chill') }}"
|
||||
|
||||
music_join_sonoses:
|
||||
alias: Music · Join Sonoses
|
||||
sequence:
|
||||
- service: sonos.join
|
||||
entity_id: group.all_sonos
|
||||
data_template:
|
||||
master: "{{ states('input_select.sonos_leader') }}"
|
||||
|
||||
automation:
|
||||
- alias: Music · Play/Pause on Magic Cube Knock
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret magic_cube_ieee
|
||||
command: knock
|
||||
action:
|
||||
- service: media_player.media_play_pause
|
||||
data_template:
|
||||
entity_id: "{{ states('input_select.sonos_leader') }}"
|
||||
|
||||
- alias: Music · Volume down on Magic Cube rotate left
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret magic_cube_ieee
|
||||
command: rotate_left
|
||||
action:
|
||||
- service: media_player.volume_down
|
||||
data_template:
|
||||
entity_id: "{{ states('input_select.sonos_leader') }}"
|
||||
|
||||
- alias: Music · Volume up on Magic Cube rotate right
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: zha_event
|
||||
event_data:
|
||||
device_ieee: !secret magic_cube_ieee
|
||||
command: rotate_right
|
||||
action:
|
||||
- service: media_player.volume_up
|
||||
data_template:
|
||||
entity_id: "{{ states('input_select.sonos_leader') }}"
|
||||
@@ -0,0 +1,131 @@
|
||||
#
|
||||
# ─── CONFIGURATION ──────────────────────────────────────────────────────────────
|
||||
#
|
||||
|
||||
# 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/integrations/device_tracker
|
||||
device_tracker:
|
||||
- platform: tile
|
||||
username: !secret tile_username
|
||||
password: !secret tile_password
|
||||
|
||||
#
|
||||
# ─── ENTITIES ───────────────────────────────────────────────────────────────────
|
||||
#
|
||||
|
||||
input_boolean:
|
||||
georgi_home:
|
||||
name: Georgi home
|
||||
icon: mdi:account
|
||||
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
georgi_home:
|
||||
friendly_name: Georgi
|
||||
device_class: presence
|
||||
value_template: "{{ is_state('input_boolean.georgi_home', 'on') }}"
|
||||
entity_id: input_boolean.georgi_home
|
||||
icon_template: >
|
||||
{% if is_state('input_boolean.georgi_home', 'on') %} mdi:account
|
||||
{% else %} mdi:account-off-outline
|
||||
{% endif %}
|
||||
|
||||
automation:
|
||||
# When my state changes to "home", wait for 15 minutes for the door to be opened, and then mark me as home
|
||||
- alias: Presence · Arrival detection
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: person.georgi
|
||||
to: "home"
|
||||
condition:
|
||||
condition: state
|
||||
entity_id: input_boolean.georgi_home
|
||||
state: "off"
|
||||
action:
|
||||
- service: notify.telegram
|
||||
data:
|
||||
title: "🏠 *Presence Module · Arrival detection*"
|
||||
message: "Device marked as home. Waiting for door to open!"
|
||||
- wait_template: "{{ is_state('binary_sensor.front_door_on_off', 'on') }}"
|
||||
continue_on_timeout: false
|
||||
timeout: 00:15:00
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.georgi_home
|
||||
- service: notify.telegram
|
||||
data:
|
||||
title: "🏠 *Presence Module · Arrival detection*"
|
||||
message: "✅ Hey, I've marked you as home now!"
|
||||
|
||||
- alias: Presence · Leaving home
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: person.georgi
|
||||
from: "home"
|
||||
to: "not_home"
|
||||
action:
|
||||
- service: script.routine_leaving_home
|
||||
- service: notify.telegram
|
||||
data:
|
||||
title: "🏠 *Presence Module · Leaving Home*"
|
||||
message: "I see you're leaving. Goodbye!"
|
||||
|
||||
- alias: Presence · Coming home
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: binary_sensor.georgi_home
|
||||
to: "on"
|
||||
action:
|
||||
- service: script.routine_coming_home
|
||||
- service: notify.telegram
|
||||
data:
|
||||
title: "🏠 *Presence Module · Coming Home*"
|
||||
message: "Welcome home!"
|
||||
|
||||
- alias: Presence · Leaving work
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: person.georgi
|
||||
from: "work"
|
||||
to: "not_home"
|
||||
action:
|
||||
- service: notify.telegram
|
||||
data:
|
||||
title: "🏠 *Presence Module · Leaving Work*"
|
||||
message: "Hey, I see you're leaving work. Are you coming home?"
|
||||
data:
|
||||
inline_keyboard:
|
||||
- "Yes:/leaving_work_to_home, No:/do_nothing"
|
||||
|
||||
#
|
||||
# ─── CUSTOMIZATION ──────────────────────────────────────────────────────────────
|
||||
#
|
||||
|
||||
homeassistant:
|
||||
customize:
|
||||
device_tracker.carbon:
|
||||
icon: mdi:cellphone-iphone
|
||||
|
||||
device_tracker.tile_p_6e3c33752f24f417254c039040a984bd:
|
||||
friendly_name: Georgi's iPhone Tile
|
||||
icon: mdi:cellphone-iphone
|
||||
|
||||
device_tracker.tile_1bcb2b3021b9f96b:
|
||||
friendly_name: Keys Tile
|
||||
icon: mdi:key-variant
|
||||
|
||||
automation.presence_coming_home:
|
||||
icon: mdi:home-account
|
||||
|
||||
automation.presence_leaving_home:
|
||||
icon: mdi:home
|
||||
|
||||
automation.presence_arrival_detecion:
|
||||
icon: mdi:account-plus-outline
|
||||
@@ -0,0 +1,115 @@
|
||||
binary_sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
camera_state:
|
||||
friendly_name: Security camera
|
||||
device_class: safety
|
||||
value_template: >-
|
||||
{{ state_attr('camera.amcrest_camera', 'motion_recording') != 'on' }}
|
||||
|
||||
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
|
||||
|
||||
script:
|
||||
security_camera_on:
|
||||
alias: Security camera · Turn on
|
||||
sequence:
|
||||
- service: camera.turn_on
|
||||
entity_id: camera.amcrest_camera
|
||||
- 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: Security camera · Turn 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
|
||||
- service: camera.turn_off
|
||||
entity_id: camera.amcrest_camera
|
||||
|
||||
alarm_start:
|
||||
sequence:
|
||||
- service: media_player.play_media
|
||||
data:
|
||||
entity_id: media_player.master_bedroom
|
||||
media_content_id: "https://raw.githubusercontent.com/saeedsohi/siren/master/FireTrucksSirens.mp3"
|
||||
media_content_type: music
|
||||
- service: light.turn_on
|
||||
entity_id: light.bedside_light
|
||||
data:
|
||||
brightness_pct: 100
|
||||
- service: light.turn_on
|
||||
entity_id: light.bedside_light
|
||||
data:
|
||||
effect: Police
|
||||
|
||||
alarm_stop:
|
||||
sequence:
|
||||
- service: media_player.media_stop
|
||||
entity_id: media_player.master_bedroom
|
||||
- service: light.turn_on
|
||||
entity_id: light.bedside_light
|
||||
data:
|
||||
brightness_pct: 60
|
||||
kelvin: 2400
|
||||
|
||||
# Hack - the switch.camera initial state is wrong (ON) when the server starts.
|
||||
automation:
|
||||
- id: camera_turn_off_on_startup
|
||||
alias: Camera · Startup
|
||||
trigger:
|
||||
- platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- delay: 00:00:10
|
||||
- service: switch.turn_off
|
||||
entity_id: switch.camera
|
||||
|
||||
- id: security_door_opened_while_away
|
||||
alias: Security · Door opened while away
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: binary_sensor.front_door_on_off
|
||||
to: "on"
|
||||
condition:
|
||||
condition: and
|
||||
conditions:
|
||||
- condition: state
|
||||
entity_id: person.georgi
|
||||
state: "not_home"
|
||||
- condition: state
|
||||
entity_id: input_boolean.guest_mode
|
||||
state: "off"
|
||||
action:
|
||||
- service: notify.telegram
|
||||
data:
|
||||
title: "🛡 *Security Module · Door opened while away*"
|
||||
message: "It seems like the front door was opened while you are away! Check the camera!"
|
||||
@@ -0,0 +1,103 @@
|
||||
input_boolean:
|
||||
speech_notifications:
|
||||
name: Speech notifications
|
||||
icon: mdi:chat
|
||||
|
||||
sarah_talking:
|
||||
name: SARAH talking
|
||||
icon: mdi:chat
|
||||
initial: off
|
||||
|
||||
script:
|
||||
say:
|
||||
alias: Speech · Say
|
||||
sequence:
|
||||
# Don't talk while in sleep mode.
|
||||
- condition: state
|
||||
entity_id: input_boolean.sleep_mode
|
||||
state: "off"
|
||||
# Combine partials for speech message.
|
||||
- service: script.say_discretely
|
||||
data_template:
|
||||
message: >-
|
||||
{%- if partials is defined -%}
|
||||
{%- for partial in partials -%}
|
||||
{{ partial }}{{ " " }}
|
||||
{%- endfor -%}
|
||||
{%- else -%}
|
||||
{{ message }}
|
||||
{%- endif -%}
|
||||
|
||||
say_discretely:
|
||||
alias: Speech · Say discretely
|
||||
sequence:
|
||||
# Figure out whether to talk or send a text.
|
||||
- service_template: >
|
||||
{% if is_state(states('input_select.sonos_leader'), 'playing')
|
||||
or is_state('input_boolean.speech_notifications', 'off')
|
||||
or is_state('input_boolean.georgi_home', 'off') %}
|
||||
notify.telegram
|
||||
{% else %}
|
||||
script.sonos_blast
|
||||
{% endif %}
|
||||
data_template:
|
||||
title: "💬 *Speech Module*" # For telegram only
|
||||
message: "{{ message }}"
|
||||
|
||||
sonos_blast:
|
||||
alias: Speech · Sonos blast
|
||||
sequence:
|
||||
# Mark SARAH as talking.
|
||||
- service: input_boolean.turn_on
|
||||
entity_id: input_boolean.sarah_talking
|
||||
# Don't shout :)
|
||||
- service: media_player.volume_set
|
||||
entity_id: group.all_sonos
|
||||
data_template:
|
||||
volume_level: >-
|
||||
{% if now().strftime('%H')|int < 6 and now().strftime('%H')|int > 0 %}
|
||||
0.2
|
||||
{% else %}
|
||||
0.4
|
||||
{% endif %}
|
||||
# Say message.
|
||||
- service: tts.amazon_polly_say
|
||||
data_template:
|
||||
entity_id: "{{ states('input_select.sonos_leader') }}"
|
||||
message: "{{ message }}"
|
||||
# Wait for phrase to be over and mark as not talking.
|
||||
- delay: 00:00:01
|
||||
- wait_template: "{{ is_state('binary_sensor.sonos_leader_paused', 'on') }}"
|
||||
timeout: 00:02:00
|
||||
- service: input_boolean.turn_off
|
||||
entity_id: input_boolean.sarah_talking
|
||||
|
||||
sonos_say:
|
||||
alias: Speech · Sonos say
|
||||
sequence:
|
||||
- service: sonos.snapshot
|
||||
data_template:
|
||||
with_group: yes
|
||||
entity_id: media_player.master_bedroom
|
||||
- delay: 00:00:02
|
||||
- service: script.sonos_blast
|
||||
data_template:
|
||||
message: "{{ message }}"
|
||||
- delay: 00:00:05
|
||||
- service: sonos.restore
|
||||
data_template:
|
||||
with_group: yes
|
||||
entity_id: media_player.master_bedroom
|
||||
|
||||
automation:
|
||||
- alias: Speech · Telegram · Action · Do nothing
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: telegram_callback
|
||||
event_data:
|
||||
command: "/do_nothing"
|
||||
action:
|
||||
- service: telegram_bot.delete_message
|
||||
data_template:
|
||||
message_id: "{{ trigger.event.data.message.message_id}}"
|
||||
chat_id: "{{ trigger.event.data.chat_id }}"
|
||||
@@ -0,0 +1,53 @@
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
sarah_url:
|
||||
friendly_name: "SARAH's URL"
|
||||
value_template: !secret sarah_url
|
||||
|
||||
script:
|
||||
sarah_restart:
|
||||
alias: System · Restart SARAH
|
||||
sequence:
|
||||
service: homeassistant.restart
|
||||
|
||||
automation:
|
||||
- alias: System · Announce start
|
||||
trigger:
|
||||
platform: homeassistant
|
||||
event: start
|
||||
action:
|
||||
- delay: 00:00:06
|
||||
- service: script.say
|
||||
data:
|
||||
message: "Hey! I was out for a bit, but I'm back online!"
|
||||
- service: notify.telegram
|
||||
data:
|
||||
title: "⚙️ *System Module*"
|
||||
message: "Ask me to do something anytime!"
|
||||
data:
|
||||
keyboard:
|
||||
- "/guest_mode_on, /guest_mode_off"
|
||||
- "/status"
|
||||
|
||||
- alias: System · Telegram · Announce status
|
||||
trigger:
|
||||
platform: event
|
||||
event_type: telegram_command
|
||||
event_data:
|
||||
command: "/status"
|
||||
action:
|
||||
- service: notify.telegram
|
||||
data_template:
|
||||
title: "⚙️ *System Module*"
|
||||
message: >-
|
||||
|
||||
Guest mode: {{ states('input_boolean.guest_mode') }}
|
||||
|
||||
Windows:
|
||||
Living room: {{ states('binary_sensor.living_room_right_window_on_off') }}
|
||||
Master bedroom: {{ states('binary_sensor.master_bedroom_right_window_on_off') }}
|
||||
|
||||
Lights:
|
||||
Living room: {{ states('light.living_room_all_lights') }}
|
||||
Master bedroom: {{ states('light.bedside_light') }}
|
||||
@@ -0,0 +1,86 @@
|
||||
sensor:
|
||||
- platform: youtube
|
||||
channel_id: UClFSU9_bUb4Rc6OYfTt5SPw
|
||||
- platform: command_line
|
||||
name: Available PDS
|
||||
command: ls -1 /config/www/audio/youtube/pds | grep mp3 | paste -sd "," -
|
||||
scan_interval: 30
|
||||
- platform: command_line
|
||||
name: Available Youtube clips
|
||||
command: ls -1 /config/www/audio/youtube | grep mp3 | paste -sd "," -
|
||||
scan_interval: 30
|
||||
|
||||
input_text:
|
||||
youtube_download_url:
|
||||
name: Youtube download URL
|
||||
icon: mdi:link
|
||||
initial: ""
|
||||
youtube_download_name:
|
||||
name: Youtube download name
|
||||
icon: mdi:format-letter-case
|
||||
initial: ""
|
||||
|
||||
shell_command:
|
||||
youtube_download: python3.7 /config/custom_scripts/youtube_download.py {{ url }} {{ name }} {{ folder }}
|
||||
|
||||
script:
|
||||
youtube_play_latest_pds:
|
||||
alias: Youtube · Play latest PDS
|
||||
sequence:
|
||||
- service: script.music_join_sonoses
|
||||
- service: media_player.play_media
|
||||
data_template:
|
||||
entity_id: media_player.master_bedroom
|
||||
media_content_id: "{{ states('sensor.sarah_url') }}/local/audio/youtube/pds/{{ states('sensor.available_pds').split(',') | last }}"
|
||||
media_content_type: "music"
|
||||
|
||||
youtube_download_selected:
|
||||
alias: Youtube · Download selected video
|
||||
sequence:
|
||||
- service: shell_command.youtube_download
|
||||
data_template:
|
||||
url: "{{ states('input_text.youtube_download_url') }}"
|
||||
name: "{{ states('input_text.youtube_download_name') }}"
|
||||
- service: input_text.set_value
|
||||
entity_id:
|
||||
- input_text.youtube_download_url
|
||||
- input_text.youtube_download_name
|
||||
data:
|
||||
value: ""
|
||||
|
||||
youtube_download_and_play:
|
||||
alias: Youtube · Download and play selected video
|
||||
sequence:
|
||||
- service: shell_command.youtube_download
|
||||
data_template:
|
||||
url: "{{ states('input_text.youtube_download_url') }}"
|
||||
name: "{{ states('input_text.youtube_download_name') }}"
|
||||
|
||||
- service: script.music_join_sonoses
|
||||
- service: media_player.play_media
|
||||
data_template:
|
||||
entity_id: media_player.master_bedroom
|
||||
media_content_id: "{{ states('sensor.sarah_url') }}/local/audio/youtube/{{ states('input_text.youtube_download_name') }}.mp3"
|
||||
media_content_type: "music"
|
||||
|
||||
- service: input_text.set_value
|
||||
entity_id:
|
||||
- input_text.youtube_download_url
|
||||
- input_text.youtube_download_name
|
||||
data:
|
||||
value: ""
|
||||
|
||||
automation:
|
||||
- alias: Youtube · Download latest PDS
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.philip_defranco
|
||||
action:
|
||||
- service: shell_command.youtube_download
|
||||
data_template:
|
||||
url: "{{ state_attr('sensor.philip_defranco', 'url') }}"
|
||||
name: "{{ state_attr('sensor.philip_defranco', 'published')[0:10] }}"
|
||||
folder: "pds/"
|
||||
- service: script.say
|
||||
data:
|
||||
message: "Just wanted to let you know - a new PDS is available!"
|
||||
Reference in New Issue
Block a user