Include Guest Bedroom in house mode

This commit is contained in:
2021-10-18 23:28:42 +03:00
parent af5e969c2b
commit c4e977b345
25 changed files with 241 additions and 119 deletions
@@ -17,7 +17,7 @@ trigger:
condition:
condition: state
entity_id: input_select.bedroom_mode
entity_id: sensor.house_mode
state: "day"
action:
@@ -46,6 +46,8 @@ cards:
- input_boolean.routine_welcome_home
- automation.presence_georgi_arrival_detection
- automation.presence_player_2_arrival_detection
- automation.presence_georgi_leaving
- automation.presence_player_2_leaving
- automation.presence_coming_home
- automation.presence_leaving_home
- automation.routine_coming_home_left_work
@@ -60,7 +62,7 @@ cards:
- automation.living_room_desk_switch
- automation.bedroom_opple
- automation.bedroom_bedside_switch
- automation.bedroom_aqara_switch
- automation.guest_bedroom_aqara_switch
- automation.bathroom_switch
- type: entities
@@ -134,7 +136,9 @@ cards:
entities:
- automation.bedroom_mode_set_to_day
- automation.bedroom_mode_set_to_bed
- automation.bedroom_mode_set_to_night
- automation.guest_bedroom_mode_set_to_night
- automation.house_mode_set_to_day
- automation.house_mode_set_to_night
- automation.bedroom_mode_set_to_day_if_bedroom_door_was_opened
- type: entities
@@ -38,10 +38,20 @@
- type: custom:decluttering-card
template: v3_section_title
variables:
- title: Lights
- title: Controls
- type: horizontal-stack
cards:
- type: custom:button-card
template: v3_button_light
entity: light.light_lohas_6
name: Night stand
- type: custom:button-card
template: v3_button
entity: input_select.guest_bedroom_mode
icon: mdi:bed
name: Mode
tap_action:
action: call-service
service: input_select.select_next
service_data:
entity_id: input_select.guest_bedroom_mode
@@ -80,6 +80,15 @@
template: v3_button
entity: input_boolean.guest_bedroom
name: G. Bedroom Occupied
- type: custom:button-card
template: v3_button
entity: input_select.guest_bedroom_mode
name: G. Bedroom
tap_action:
action: call-service
service: input_select.select_next
service_data:
entity_id: input_select.guest_bedroom_mode
- type: custom:decluttering-card
template: v3_section_title
@@ -118,3 +127,17 @@
- input_number.toshiba_heat_temp
- input_number.toshiba_cool_temp
- input_number.toshiba_trigger_temp
- type: custom:decluttering-card
template: v3_section_title
variables:
- title: Monitoring
- type: horizontal-stack
cards:
- type: custom:button-card
template: v3_button
entity: binary_sensor.someone_sleeping
- type: custom:button-card
template: v3_button
entity: binary_sensor.someone_home
@@ -18,29 +18,3 @@ sensor:
icon: "mdi:signal"
unit_of_measurement: "lqi"
value_template: "{{ value_json.linkquality }}"
script:
bed_led_on:
sequence:
- delay: "00:00:01"
- service: light.turn_on
entity_id: light.bed_led
- delay: "00:00:03"
- service: light.turn_on
entity_id: light.bed_led
data_template:
brightness_pct: "{{ brightness_pct | default(100) }}"
bed_led_toggle:
sequence:
- choose:
- conditions:
- condition: state
entity_id: light.bed_led
state: "off"
sequence:
- service: script.bed_led_on
default:
- service: light.turn_off
entity_id: light.bed_led
@@ -35,11 +35,8 @@ automation:
button_2_single:
- service: light.turn_on
data_template:
entity_id: light.master_bedroom
brightness_pct: >-
{% if not is_state('input_select.bedroom_mode', 'day') %} 40 {% else %} 100 {% endif %}
- service: script.bed_led_on
data_template:
entity_id:
- light.master_bedroom
brightness_pct: >-
{% if not is_state('input_select.bedroom_mode', 'day') %} 40 {% else %} 100 {% endif %}
@@ -70,6 +67,7 @@ automation:
data_template:
entity_id:
- light.bedside
- light.bed_led
brightness_pct: >-
{% if not is_state('input_select.bedroom_mode', 'day') %}
@@ -77,7 +75,6 @@ automation:
{% else %}
100
{% endif %}
- service: script.bed_led_on
button_3_single:
- service: media_player.media_play_pause
@@ -16,24 +16,33 @@ sensor:
automation:
- alias: Bedroom · Aqara Switch
- alias: Guest Bedroom · Aqara Switch
use_blueprint:
path: aqara_switch.yaml
input:
z2m_topic: "z2m_deconz/bedroom_wall_switch"
click:
- service: script.apply_bedroom_pink
- service: script.music_play
data:
playlist: "Songs for a Romantic Evening"
volume: 0.1
shuffle: false
- service: script.sonos_volume_10
- choose:
- conditions:
- condition: state
entity_id: input_select.guest_bedroom_mode
state: 'night'
sequence:
- service: light.toggle
entity_id: light.light_lohas_6
data:
brightness_pct: 10
default:
- service: light.toggle
entity_id: light.light_lohas_6
data:
brightness_pct: 100
double_click:
- service: input_select.select_next
entity_id: input_select.light_color_mode
- service: light.toggle
entity_id: light.light_lohas_6
hold:
- service: media_player.media_play_pause
entity_id: media_player.master_bedroom
- service: script.guest_bedroom_bedside_confirm
- service: input_select.select_next
entity_id: input_select.guest_bedroom_mode
@@ -26,6 +26,10 @@ automation:
platform: state
entity_id: input_select.hallway_dashboard_mode
to: "Leaving"
condition:
condition: state
entity_id: input_boolean.guest_bedroom
state: "off"
action:
- service: script.say
data:
@@ -40,5 +44,6 @@ automation:
- service: script.say
data:
message: "Goodbye!"
# TODO: add conditions
- service: input_boolean.turn_off
entity_id: input_boolean.georgi_home
@@ -27,7 +27,7 @@ automation:
entity_id: light.living_room_main
brightness_pct: >-
{% if is_state('input_select.bedroom_mode', 'night') %}
{% if is_state('sensor.house_mode', 'night') %}
40
{% else %}
100
@@ -39,7 +39,7 @@ automation:
entity_id: light.living_room_ambient
brightness_pct: >-
{% if is_state('input_select.bedroom_mode', 'night') %}
{% if is_state('sensor.house_mode', 'night') %}
40
{% else %}
100
+1 -1
View File
@@ -98,7 +98,7 @@ automation:
to: "off"
condition:
condition: state
entity_id: input_select.bedroom_mode
entity_id: sensor.house_mode
state: "day"
action:
- service: script.sonos_join_bedroom
@@ -2,11 +2,15 @@
input_select:
bedroom_mode:
name: Bedroom mode
icon: mdi:home-analytics
options:
- day
- bed
- night
guest_bedroom_mode:
name: Guest Bedroom mode
options:
- day
- night
binary_sensor:
- platform: template
@@ -24,6 +28,37 @@ binary_sensor:
mdi:weather-night
{% endif %}
someone_sleeping:
friendly_name: Someone sleeping
value_template: >-
{% if is_state('input_boolean.guest_bedroom', 'off') %}
{{ is_state('input_boolean.bedroom_mode', 'night') }}
{% else %}
{{ is_state('input_select.bedroom_mode', 'night') or is_state('input_select.guest_bedroom_mode', 'night') }}
{% endif %}
sensor:
- platform: template
sensors:
house_mode:
friendly_name: House mode
value_template: >-
{% if is_state('input_boolean.guest_bedroom', 'off') %}
{% if is_state('input_select.bedroom_mode', 'night') %}
night
{% else %}
day
{% endif %}
{% else %}
{% if is_state('input_select.bedroom_mode', 'night') and is_state('input_select.guest_bedroom_mode', 'night') %}
night
{% else %}
day
{% endif %}
{% endif %}
automation:
- alias: Bedroom mode · Set to day
@@ -32,7 +67,7 @@ automation:
entity_id: input_select.bedroom_mode
to: "day"
action:
- service: script.routine_waking_up
- service: script.routine_bedroom_morning
- alias: Bedroom mode · Set to bed
trigger:
@@ -40,12 +75,29 @@ automation:
entity_id: input_select.bedroom_mode
to: "bed"
action:
- service: script.routine_bedtime
- service: script.routine_bedroom_bedtime
- alias: Bedroom mode · Set to night
- alias: Guest Bedroom mode · Set to night
trigger:
platform: state
entity_id: input_select.bedroom_mode
entity_id: input_select.guest_bedroom_mode
to: "night"
action:
- service: light.turn_off
entity_id: light.light_lohas_6
- alias: House mode · Set to day
trigger:
platform: state
entity_id: sensor.house_mode
to: "day"
action:
- service: script.routine_waking_up
- alias: House mode · Set to night
trigger:
platform: state
entity_id: sensor.house_mode
to: "night"
action:
- service: script.routine_good_night
@@ -0,0 +1,20 @@
script:
guest_bedroom_bedside_confirm:
sequence:
- service: scene.create
data:
scene_id: guest_bedroom_before_confirm
snapshot_entities:
- light.light_lohas_6
- service: light.turn_on
entity_id: light.light_lohas_6
data:
rgb_color: [110, 255, 0]
- delay: 00:00:02
- service: light.turn_on
entity_id: light.light_lohas_6
data:
color_temp: "{{ 400 if is_state('sun.sun', 'above_horizon') else 500 }}"
- service: scene.turn_on
entity_id: scene.guest_bedroom_before_confirm
- delay: 00:00:01
@@ -13,8 +13,8 @@ automation:
# Turn on in Day Mode
- conditions:
- condition: state
entity_id: input_select.bedroom_mode
state: 'day'
entity_id: binary_sensor.someone_sleeping
state: "off"
sequence:
- service: light.turn_on
entity_id:
@@ -41,9 +41,9 @@ automation:
- choose:
# Turn off in Day Mode
- conditions:
condition: state
entity_id: input_select.bedroom_mode
state: 'day'
- condition: state
entity_id: binary_sensor.someone_sleeping
state: 'off'
sequence:
- service: light.turn_off
entity_id: light.hallway
@@ -13,7 +13,7 @@ automation:
# Turn on in Day Mode
- conditions:
- condition: state
entity_id: input_select.bedroom_mode
entity_id: sensor.house_mode
state: 'day'
sequence:
- service: light.turn_on
@@ -57,7 +57,7 @@ automation:
condition: not
conditions:
- condition: state
entity_id: input_select.bedroom_mode
entity_id: sensor.house_mode
state: 'day'
action:
# Turn off in Night Mode
@@ -85,7 +85,7 @@ automation:
minutes: 15
condition:
condition: state
entity_id: input_select.bedroom_mode
entity_id: sensor.house_mode
state: 'day'
action:
# Turn off in Day Mode
@@ -151,6 +151,7 @@ light:
- light.living_room
- light.master_bedroom
- light.hallway
- light.light_lohas_6
- platform: group
name: Ceiling
@@ -135,6 +135,10 @@ light:
# rgb_value_template: "{{ (value_json.Color[0:2]|int(base=16),value_json.Color[2:4]|int(base=16),value_json.Color[4:6]|int(base=16)) | join(',')}}"
qos: 1
retain: false
effect_command_topic: "cmnd/light_lohas_2/Scheme"
effect_state_topic: "tele/light_lohas_2/STATE"
effect_value_template: "{{value_json.Scheme}}"
effect_list: [0, 1, 2, 3, 4]
# - platform: mqtt
# name: "light_lohas_3"
@@ -246,6 +250,10 @@ light:
# rgb_value_template: "{{ (value_json.Color[0:2]|int(base=16),value_json.Color[2:4]|int(base=16),value_json.Color[4:6]|int(base=16)) | join(',')}}"
qos: 1
retain: false
effect_command_topic: "cmnd/light_lohas_6/Scheme"
effect_state_topic: "tele/light_lohas_6/STATE"
effect_value_template: "{{value_json.Scheme}}"
effect_list: [0, 1, 2, 3, 4]
- platform: "mqtt"
name: "ledvance_1"
+8
View File
@@ -39,10 +39,14 @@ script:
sonos_join_bedroom:
alias: Sonos · Join to Bedroom
sequence:
- condition: state
entity_id: input_select.bedroom_mode
state: "day"
- service: sonos.join
entity_id: group.all_sonos
data:
master: media_player.master_bedroom
sonos_join_tv:
alias: Sonos · Join to TV
sequence:
@@ -54,6 +58,7 @@ script:
entity_id: media_player.living_room
data:
source: TV
sonos_bathroom_up:
alias: Sonos · Bathroom up
sequence:
@@ -61,6 +66,7 @@ script:
entity_id: media_player.bathroom
data:
volume_level: 0.5
sonos_bathroom_down:
alias: Sonos · Bathroom down
sequence:
@@ -68,6 +74,7 @@ script:
entity_id: media_player.bathroom
data:
volume_level: 0.2
sonos_volume_10:
alias: Sonos · Volume 10
sequence:
@@ -79,6 +86,7 @@ script:
- media_player.living_room
data:
volume_level: 0.1
sonos_volume_20:
alias: Sonos · Volume 20
sequence:
+20
View File
@@ -119,6 +119,26 @@ automation:
person: person.player_2
input_boolean: input_boolean.player_2
- alias: Presence · Georgi leaving
trigger:
- platform: state
entity_id: person.georgi
from: "home"
to: "not_home"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.georgi_home
- alias: Presence · Player 2 leaving
trigger:
- platform: state
entity_id: person.player_2
from: "home"
to: "not_home"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.player_2_home
- alias: Presence · Leaving home
trigger:
- platform: state
+1 -1
View File
@@ -33,7 +33,7 @@ automation:
to: "on"
condition:
condition: state
entity_id: input_select.bedroom_mode
entity_id: sensor.house_mode
state: "night"
action:
- service: light.turn_on
+1 -1
View File
@@ -33,7 +33,7 @@ script:
- condition: not
conditions:
- condition: state
entity_id: input_select.bedroom_mode
entity_id: sensor.house_mode
state: 'night'
# Combine partials for speech message.
- service: script.say_discretely
+12 -33
View File
@@ -1,7 +1,13 @@
script:
routine_bedtime:
alias: Routine · Bedtime
routine_bedroom_bedtime:
alias: Routine · Bedroom · Bedtime
sequence:
- service: sonos.unjoin
entity_id:
- media_player.living_room
- media_player.kitchen
- media_player.bathroom
- service: script.say_discretely
data:
message: "Entering bed time."
@@ -15,41 +21,14 @@ script:
option: "sleep"
- service: light.turn_on
entity_id: light.bedside
- service: script.bed_led_on
entity_id:
- light.bedside
- light.bed_led
- service: light.turn_off
entity_id: light.master_bedroom_main
- service: sonos.unjoin
entity_id:
- media_player.living_room
- media_player.kitchen
- media_player.bathroom
- service: media_player.volume_set
entity_id: media_player.master_bedroom
data:
volume_level: 0.15
# Turn off everything else
- service: media_player.media_stop
entity_id:
- media_player.living_room
- media_player.kitchen
- media_player.bathroom
- service: homeassistant.turn_off
entity_id:
- media_player.nvidia_shield
- media_player.living_room_tv
- light.master_bedroom_main
- light.living_room_ceiling
- light.kitchen_main
- light.kitchen_secondary
- light.hallway_main
- light.hallway_entrance
- switch.titanium
- service: light.turn_on
entity_id:
- light.browser_kitchen
- light.browser_hallway
data:
brightness_pct: 1
+1 -1
View File
@@ -22,9 +22,9 @@ script:
- light.browser_hallway
- light.living_room_ambient
- light.bedside
- light.bed_led
data:
brightness_pct: 100
- service: script.bed_led_on
# Cameras
- service: switch.turn_on
+3 -1
View File
@@ -11,7 +11,8 @@ script:
message: "Entering night mode. Good night!"
# Prepare Bed LED brightness to be turned on during night time
- service: script.bed_led_on
- service: light.turn_on
entity_id: light.bed_led
data:
brightness_pct: 40
@@ -31,6 +32,7 @@ script:
- light.kitchen_secondary
- light.hallway_main
- light.hallway_entrance
- light.light_lohas_6
- media_player.nvidia_shield
- media_player.living_room_tv
- switch.titanium
@@ -18,6 +18,7 @@ script:
- service: media_player.media_stop
entity_id: group.all_sonos
- service: script.dashboards_light_down
- service: input_select.select_option
entity_id: input_select.hallway_dashboard_mode
data:
+27 -18
View File
@@ -2,19 +2,6 @@ script:
routine_waking_up:
alias: Routine · Waking up
sequence:
- service: fan.turn_off
entity_id: fan.philips_airpurifier
- service: media_player.media_stop
entity_id: media_player.master_bedroom
- delay: 00:00:01
- service: script.routine_morning_briefing
- wait_template: "{{ is_state('input_boolean.sarah_talking', 'off') }}"
timeout: 00:02:00
- delay: 00:00:01
- service: light.turn_on
entity_id: light.hallway
data:
@@ -23,21 +10,43 @@ script:
- service: light.turn_on
entity_id:
- light.living_room_ambient
- light.bed_led
- light.bedside
- service: script.open_living_room_cover
- service: script.shield_screensaver
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
# Only when no guests are present
- condition: and
conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- condition: state
entity_id: input_boolean.guest_bedroom
state: "off"
- service: script.say
data:
message: "Here's some music to start the day!"
- delay: 00:00:02
- service: script.music_play
routine_bedroom_morning:
alias: Routine · Bedroom · Morning
sequence:
- service: fan.turn_off
entity_id: fan.philips_airpurifier
- service: media_player.media_stop
entity_id: media_player.master_bedroom
- delay: 00:00:01
- service: light.turn_on
entity_id:
- light.bed_led
- light.bedside
- service: script.routine_morning_briefing
- wait_template: "{{ is_state('input_boolean.sarah_talking', 'off') }}"
timeout: 00:02:00
- delay: 00:00:01
routine_morning_briefing:
alias: Routine · Morning Briefing
sequence: