initial push

This commit is contained in:
CeeWeasel
2024-04-14 14:08:56 -04:00
commit 53bf393d14
1111 changed files with 71730 additions and 0 deletions
@@ -0,0 +1,12 @@
alias: Baby Monitor off Front Room display
id: automation_baby_monitor_off_front_room_hub
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.nursery_camera_on_hub
action:
service: media_player.turn_off
data:
entity_id: media_player.front_room_hub
@@ -0,0 +1,31 @@
alias: Baby Monitor off Front Room TV
id: automation_baby_monitor_off_front_room_tv
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.nursery_camera_on_tv
- platform: state
entity_id: media_player.front_room_tv
attribute: source
from: 'IP Camera Viewer - Pro'
action:
- choose:
- conditions:
- condition: not
conditions:
- condition: state
entity_id: media_player.front_room_tv
attribute: source
state: 'IP Camera Viewer - Pro'
sequence:
- service: timer.cancel
data:
entity_id: timer.nursery_camera_on_tv
default:
service: media_player.turn_off
data:
entity_id: media_player.front_room_tv
@@ -0,0 +1,69 @@
alias: Baby Monitor on Front Room display
id: automation_baby_monitor_on_hub
trigger:
- platform: state
entity_id: binary_sensor.black_bed_occupied
to: 'off'
for: '00:00:03'
- platform: state
entity_id: binary_sensor.white_bed_occupied
to: 'off'
for: '00:00:03'
condition:
- condition: state
entity_id: binary_sensor.kids_at_home
state: 'on'
- condition: state
entity_id: group.kids_in_bed
state: 'on'
- condition: state
entity_id: input_boolean.home_occupied
state: 'on'
- condition: state
entity_id: binary_sensor.front_room_person_occupancy
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: media_player.front_room_hub
state: 'off'
- condition: state
entity_id: media_player.front_room_hub
state: 'idle'
action:
- choose:
- conditions:
- condition: state
entity_id: timer.nursery_camera_on_hub
state: 'idle'
sequence:
- service: media_player.volume_set
data:
entity_id: media_player.front_room_hub
volume_level: 0.1
- service: media_player.play_media
target:
entity_id: media_player.front_room_hub
data:
media_content_id: camera-casting-yml/nursery-camera
media_content_type: lovelace
metadata:
title: Nursery Camera
thumbnail: https://brands.home-assistant.io/_/lovelace/logo.png
media_class: app
children_media_class: null
navigateIds:
- {}
- media_content_type: lovelace
media_content_id: ''
- media_content_type: lovelace
media_content_id: camera-casting-yml
- service: timer.start
data:
entity_id: timer.nursery_camera_on_hub
@@ -0,0 +1,94 @@
alias: Baby Monitor on TV
id: automation_baby_monitor_on_tv
trigger:
- platform: state
entity_id: binary_sensor.black_bed_occupied
to: 'off'
for: '00:00:03'
- platform: state
entity_id: binary_sensor.white_bed_occupied
to: 'off'
for: '00:00:03'
condition:
- condition: state
entity_id: input_boolean.home_occupied
state: 'on'
- condition: state
entity_id: input_boolean.front_room_occupied
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: media_player.front_room_tv
state: 'off'
- condition: state
entity_id: media_player.front_room_tv
state: 'standby'
- condition: state
entity_id: input_boolean.computer_area_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.master_bed_occupied
state: 'off'
- condition: state
entity_id: binary_sensor.master_bedroom_occupied
state: 'off'
- condition: state
entity_id: input_boolean.master_bedroom_occupied
state: 'off'
- condition: state
entity_id: input_boolean.master_bedroom_asleep
state: 'off'
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.emmett_home
state: 'on'
- condition: state
entity_id: input_boolean.emmett_in_bed
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: input_boolean.bridget_home
state: 'on'
- condition: state
entity_id: input_boolean.bridget_in_bed
state: 'on'
- condition: and
conditions:
- condition: state
entity_id: input_boolean.ebin_home
state: 'on'
- condition: state
entity_id: input_boolean.ebin_in_bed
state: 'on'
- condition: not
conditions:
- condition: state
entity_id: media_player.front_room_tv
state: playing
- condition: state
entity_id: media_player.front_room_tv
state: paused
- condition: state
entity_id: media_player.front_room_tv
attribute: source
state: 'IP Camera Viewer - Pro'
action:
- choose:
- conditions:
- condition: state
entity_id: timer.nursery_camera_on_hub
state: 'idle'
sequence:
- service: rest_command.nursery_on_roku_1
- service: timer.start
data:
entity_id: timer.nursery_camera_on_tv
@@ -0,0 +1,169 @@
alias: Front Room Light Cycle
id: automation_front_room_light_cycle
trigger:
- id: light_cycle_on
platform: state
entity_id: input_boolean.front_room_light_cycle
from: 'off'
to: 'on'
- id: setting_change
platform: state
entity_id:
- input_number.front_room_light_cycle_transition
- input_select.front_room_color_set
- input_boolean.front_room_cycle_same
condition: "{{ is_state('input_boolean.front_room_light_cycle','on') }}"
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.front_room_light_cycle
state: 'on'
sequence:
- repeat:
sequence:
- choose:
- conditions: # If all lights should be the same color and the projector is off, reference the Hue group for all the lights
- condition: state
entity_id: input_boolean.front_room_cycle_same
state: 'on'
sequence:
- service: light.turn_on
target:
entity_id: light.front_room_hue
data:
brightness: '{{ states("input_number.front_room_light_cycle_brightness") | int }}'
transition: '{{ states("input_number.front_room_light_cycle_transition") | int }}'
profile: >
{% if states('input_select.front_room_color_set') == 'Basic' %}
{% set colors = ['white','black','red','orange','yellow','green','blue','purple','pink','brown','gray'] %}
{% elif states('input_select.front_room_color_set') == 'Color Wheel' %}
{% set colors = ['red','orange','amber','yellow','chartreuse','green','teal','blue','violet','purple','magenta'] %}
{% elif states('input_select.front_room_color_set') == 'Rainbow' %}
{% set colors = ['red','orange','yellow','green','blue','indigo','violet'] %}
{% elif states('input_select.front_room_color_set') == 'Flourescent' %}
{% set colors = ['radical_red','wild_watermelon','outrageous_orange','atomic_tangerine','neon_carrot','sunglow','laser_lemon','unmellow_yellow','electric_lime','screamin_green','magic_mint','blizzard_blue','shocking_pink','razzle_dazzle_rose','hot_magenta','purple_pizzazz'] %}
{% elif states('input_select.front_room_color_set') == 'Silver Swirl' %}
{% set colors = ['aztec_gold','burnished_brown','cerulean_frost','cinnamon_satin','copper_penny','cosmic_cobalt','glossy_grape','granite_gray','green_sheen','lilac_luster','misty_moss','mystic_maroon','pearly_purple','pewter_blue','polished_pine','quick_silver','rose_dust','rusty_red','shadow_blue','shiny_shamrock','steel_teal','sugar_plum','twilight_lavender','wintergreen_dream'] %}
{% elif states('input_select.front_room_color_set') == 'Gem Tones' %}
{% set colors = ['amethyst','citrine','emerald','jade','lapis_lazuli','malachite','rose_quartz','ruby','sapphire','smokey_topaz'] %}
{% elif states('input_select.front_room_color_set') == 'Reds' %}
{% set colors = ['auburn','baby_pink','barn_red','burgundy','burnt_umber','cadmium_red','cardinal','chesnut','chili_red','congo_pink','coral_pink','desire','fire_engine_red','imperial_red','new_york_pink','paradise_pink','pastel_pink','pigment_red','rust','salmon_pink','tango_pink','turkey_red','vanilla_ice','wine'] %}
{% elif states('input_select.front_room_color_set') == 'Oranges' %}
{% set colors = ['beaver','cadmium_orange','carrot_orange','champagne','chocolate','cocoa_brown','desert_sand','flame','gamboge','international_orange','kobicha','lion','marigold','orange_peel','persian_orange','persimmon','peru','portland_orange','pumpkin','russet','safety_orange','sandy_brown','tan','taupe','tawny','tea_rose','wood_brown'] %}
{% elif states('input_select.front_room_color_set') == 'Yellows' %}
{% set colors = ['amber','beige','buff','citrine','cream','cyber_yellow','ecru','harvest_gold','jasmine','jonquil','khaki','lemon','mellow_yellow','mikado_yellow','mustard','naples_yellow','old_gold','process_yellow','royal_yellow','safety_yellow','saffron','school_bus_yellow','straw','vanilla'] %}
{% elif states('input_select.front_room_color_set') == 'Greens' %}
{% set colors = ['army_green','artichoke','asparagus','avacado','bottle_green','bright_mint','celadon','emerald','fern_green','forest_green','harlequin','hunter_green','india_green','islamic_green','jade','kelly_green','laurel_green','malachite','mantis','mint_green','moss_green','neon_green','olive','pakistan_green','paris_green','rifle_green','russian_green','sea_green','shamrock_green','slytherin_green'] %}
{% elif states('input_select.front_room_color_set') == 'Cyans' %}
{% set colors = ['aqua','aquamarine','brunswick_green','celadon_green','celeste','cerulean','charleston_green','dark_cyan','electric_blue','feldgrau','gray_green','midnight_green','morning_blue','myrtle_green','persian_green','robin_egg_blue','sky_blue','teal','teal_blue','turquoise','verdigris','viridian'] %}
{% elif states('input_select.front_room_color_set') == 'Blues' %}
{% set colors = ['azure','baby_blue','blue_gray','capri','cornflower','egyptian_blue','glaucous','independence','indigo','indigo_dye','liberty','light_blue','midnight_blue','navy_blue','periwinkle','powder_blue','resolution_blue','sapphire','space_cadet','steel_blue','ultramarine'] %}
{% elif states('input_select.front_room_color_set') == 'Purples' %}
{% set colors = ['byzantium','dark_purple','electric_indigo','eminence','heliotrope','indigo','indigo_dye','mardi_gras','mauve','medium_purple','orchid','pansy_purple','phlox','purpureus','thistle','tropical_indigo','tyrian_purple','royal_purple'] %}
{% elif states('input_select.front_room_color_set') == 'Magentas' %}
{% set colors = ['amaranth','antique_fuchsia','baby_pink','cameo_pink','carnation_pink','charm_pink','china_pink','cotton_candy','dark_magenta','fandango','french_fuchsia','french_pink','fuchsia_rose','magenta_haze','mimi_pink','persian_pink','piggy_pink','pink','pink_lace','pink_lavender','plum','queen_pink','rose','rose_quartz','shocking_pink','silver_pink','sky_magenta','super_pink'] %}
{% elif states('input_select.front_room_color_set') == 'Grays' %}
{% set colors = ['ash_gray','battleship_gray','cadet_gray','charcoal','dim_gray','gunmetal','jet','marengo','nickel','platinum','rocket_metallic','silver','slate_gray'] %}
{% endif %}
{{ colors|random }}
- conditions: # If all lights should be different colors, start referencing the individual lights that don't obscure the TV
- condition: state
entity_id: input_boolean.front_room_cycle_same
state: 'off'
sequence:
- service: light.turn_on
target:
entity_id: light.front_room_splash_left
data:
brightness: '{{ states("input_number.front_room_light_cycle_brightness") | int }}'
transition: '{{ states("input_number.front_room_light_cycle_transition") | int }}'
profile: >
{% if states('input_select.front_room_color_set') == 'Basic' %}
{% set colors = ['white','black','red','orange','yellow','green','blue','purple','pink','brown','gray'] %}
{% elif states('input_select.front_room_color_set') == 'Color Wheel' %}
{% set colors = ['red','orange','amber','yellow','chartreuse','green','teal','blue','violet','purple','magenta'] %}
{% elif states('input_select.front_room_color_set') == 'Rainbow' %}
{% set colors = ['red','orange','yellow','green','blue','indigo','violet'] %}
{% elif states('input_select.front_room_color_set') == 'Flourescent' %}
{% set colors = ['radical_red','wild_watermelon','outrageous_orange','atomic_tangerine','neon_carrot','sunglow','laser_lemon','unmellow_yellow','electric_lime','screamin_green','magic_mint','blizzard_blue','shocking_pink','razzle_dazzle_rose','hot_magenta','purple_pizzazz'] %}
{% elif states('input_select.front_room_color_set') == 'Silver Swirl' %}
{% set colors = ['aztec_gold','burnished_brown','cerulean_frost','cinnamon_satin','copper_penny','cosmic_cobalt','glossy_grape','granite_gray','green_sheen','lilac_luster','misty_moss','mystic_maroon','pearly_purple','pewter_blue','polished_pine','quick_silver','rose_dust','rusty_red','shadow_blue','shiny_shamrock','steel_teal','sugar_plum','twilight_lavender','wintergreen_dream'] %}
{% elif states('input_select.front_room_color_set') == 'Gem Tones' %}
{% set colors = ['amethyst','citrine','emerald','jade','lapis_lazuli','malachite','rose_quartz','ruby','sapphire','smokey_topaz'] %}
{% elif states('input_select.front_room_color_set') == 'Reds' %}
{% set colors = ['auburn','baby_pink','barn_red','burgundy','burnt_umber','cadmium_red','cardinal','chesnut','chili_red','congo_pink','coral_pink','desire','fire_engine_red','imperial_red','new_york_pink','paradise_pink','pastel_pink','pigment_red','rust','salmon_pink','tango_pink','turkey_red','vanilla_ice','wine'] %}
{% elif states('input_select.front_room_color_set') == 'Oranges' %}
{% set colors = ['beaver','cadmium_orange','carrot_orange','champagne','chocolate','cocoa_brown','desert_sand','flame','gamboge','international_orange','kobicha','lion','marigold','orange_peel','persian_orange','persimmon','peru','portland_orange','pumpkin','russet','safety_orange','sandy_brown','tan','taupe','tawny','tea_rose','wood_brown'] %}
{% elif states('input_select.front_room_color_set') == 'Yellows' %}
{% set colors = ['amber','beige','buff','citrine','cream','cyber_yellow','ecru','harvest_gold','jasmine','jonquil','khaki','lemon','mellow_yellow','mikado_yellow','mustard','naples_yellow','old_gold','process_yellow','royal_yellow','safety_yellow','saffron','school_bus_yellow','straw','vanilla'] %}
{% elif states('input_select.front_room_color_set') == 'Greens' %}
{% set colors = ['army_green','artichoke','asparagus','avacado','bottle_green','bright_mint','celadon','emerald','fern_green','forest_green','harlequin','hunter_green','india_green','islamic_green','jade','kelly_green','laurel_green','malachite','mantis','mint_green','moss_green','neon_green','olive','pakistan_green','paris_green','rifle_green','russian_green','sea_green','shamrock_green','slytherin_green'] %}
{% elif states('input_select.front_room_color_set') == 'Cyans' %}
{% set colors = ['aqua','aquamarine','brunswick_green','celadon_green','celeste','cerulean','charleston_green','dark_cyan','electric_blue','feldgrau','gray_green','midnight_green','morning_blue','myrtle_green','persian_green','robin_egg_blue','sky_blue','teal','teal_blue','turquoise','verdigris','viridian'] %}
{% elif states('input_select.front_room_color_set') == 'Blues' %}
{% set colors = ['azure','baby_blue','blue_gray','capri','cornflower','egyptian_blue','glaucous','independence','indigo','indigo_dye','liberty','light_blue','midnight_blue','navy_blue','periwinkle','powder_blue','resolution_blue','sapphire','space_cadet','steel_blue','ultramarine'] %}
{% elif states('input_select.front_room_color_set') == 'Purples' %}
{% set colors = ['byzantium','dark_purple','electric_indigo','eminence','heliotrope','indigo','indigo_dye','mardi_gras','mauve','medium_purple','orchid','pansy_purple','phlox','purpureus','thistle','tropical_indigo','tyrian_purple','royal_purple'] %}
{% elif states('input_select.front_room_color_set') == 'Magentas' %}
{% set colors = ['amaranth','antique_fuchsia','baby_pink','cameo_pink','carnation_pink','charm_pink','china_pink','cotton_candy','dark_magenta','fandango','french_fuchsia','french_pink','fuchsia_rose','magenta_haze','mimi_pink','persian_pink','piggy_pink','pink','pink_lace','pink_lavender','plum','queen_pink','rose','rose_quartz','shocking_pink','silver_pink','sky_magenta','super_pink'] %}
{% elif states('input_select.front_room_color_set') == 'Grays' %}
{% set colors = ['ash_gray','battleship_gray','cadet_gray','charcoal','dim_gray','gunmetal','jet','marengo','nickel','platinum','rocket_metallic','silver','slate_gray'] %}
{% endif %}
{{ colors|random }}
- service: light.turn_on
target:
entity_id: light.front_room_splash_left
data:
brightness: '{{ states("input_number.front_room_light_cycle_brightness") | int }}'
transition: '{{ states("input_number.front_room_light_cycle_transition") | int }}'
profile: >
{% if states('input_select.front_room_color_set') == 'Basic' %}
{% set colors = ['white','black','red','orange','yellow','green','blue','purple','pink','brown','gray'] %}
{% elif states('input_select.front_room_color_set') == 'Color Wheel' %}
{% set colors = ['red','orange','amber','yellow','chartreuse','green','teal','blue','violet','purple','magenta'] %}
{% elif states('input_select.front_room_color_set') == 'Rainbow' %}
{% set colors = ['red','orange','yellow','green','blue','indigo','violet'] %}
{% elif states('input_select.front_room_color_set') == 'Flourescent' %}
{% set colors = ['radical_red','wild_watermelon','outrageous_orange','atomic_tangerine','neon_carrot','sunglow','laser_lemon','unmellow_yellow','electric_lime','screamin_green','magic_mint','blizzard_blue','shocking_pink','razzle_dazzle_rose','hot_magenta','purple_pizzazz'] %}
{% elif states('input_select.front_room_color_set') == 'Silver Swirl' %}
{% set colors = ['aztec_gold','burnished_brown','cerulean_frost','cinnamon_satin','copper_penny','cosmic_cobalt','glossy_grape','granite_gray','green_sheen','lilac_luster','misty_moss','mystic_maroon','pearly_purple','pewter_blue','polished_pine','quick_silver','rose_dust','rusty_red','shadow_blue','shiny_shamrock','steel_teal','sugar_plum','twilight_lavender','wintergreen_dream'] %}
{% elif states('input_select.front_room_color_set') == 'Gem Tones' %}
{% set colors = ['amethyst','citrine','emerald','jade','lapis_lazuli','malachite','rose_quartz','ruby','sapphire','smokey_topaz'] %}
{% elif states('input_select.front_room_color_set') == 'Reds' %}
{% set colors = ['auburn','baby_pink','barn_red','burgundy','burnt_umber','cadmium_red','cardinal','chesnut','chili_red','congo_pink','coral_pink','desire','fire_engine_red','imperial_red','new_york_pink','paradise_pink','pastel_pink','pigment_red','rust','salmon_pink','tango_pink','turkey_red','vanilla_ice','wine'] %}
{% elif states('input_select.front_room_color_set') == 'Oranges' %}
{% set colors = ['beaver','cadmium_orange','carrot_orange','champagne','chocolate','cocoa_brown','desert_sand','flame','gamboge','international_orange','kobicha','lion','marigold','orange_peel','persian_orange','persimmon','peru','portland_orange','pumpkin','russet','safety_orange','sandy_brown','tan','taupe','tawny','tea_rose','wood_brown'] %}
{% elif states('input_select.front_room_color_set') == 'Yellows' %}
{% set colors = ['amber','beige','buff','citrine','cream','cyber_yellow','ecru','harvest_gold','jasmine','jonquil','khaki','lemon','mellow_yellow','mikado_yellow','mustard','naples_yellow','old_gold','process_yellow','royal_yellow','safety_yellow','saffron','school_bus_yellow','straw','vanilla'] %}
{% elif states('input_select.front_room_color_set') == 'Greens' %}
{% set colors = ['army_green','artichoke','asparagus','avacado','bottle_green','bright_mint','celadon','emerald','fern_green','forest_green','harlequin','hunter_green','india_green','islamic_green','jade','kelly_green','laurel_green','malachite','mantis','mint_green','moss_green','neon_green','olive','pakistan_green','paris_green','rifle_green','russian_green','sea_green','shamrock_green','slytherin_green'] %}
{% elif states('input_select.front_room_color_set') == 'Cyans' %}
{% set colors = ['aqua','aquamarine','brunswick_green','celadon_green','celeste','cerulean','charleston_green','dark_cyan','electric_blue','feldgrau','gray_green','midnight_green','morning_blue','myrtle_green','persian_green','robin_egg_blue','sky_blue','teal','teal_blue','turquoise','verdigris','viridian'] %}
{% elif states('input_select.front_room_color_set') == 'Blues' %}
{% set colors = ['azure','baby_blue','blue_gray','capri','cornflower','egyptian_blue','glaucous','independence','indigo','indigo_dye','liberty','light_blue','midnight_blue','navy_blue','periwinkle','powder_blue','resolution_blue','sapphire','space_cadet','steel_blue','ultramarine'] %}
{% elif states('input_select.front_room_color_set') == 'Purples' %}
{% set colors = ['byzantium','dark_purple','electric_indigo','eminence','heliotrope','indigo','indigo_dye','mardi_gras','mauve','medium_purple','orchid','pansy_purple','phlox','purpureus','thistle','tropical_indigo','tyrian_purple','royal_purple'] %}
{% elif states('input_select.front_room_color_set') == 'Magentas' %}
{% set colors = ['amaranth','antique_fuchsia','baby_pink','cameo_pink','carnation_pink','charm_pink','china_pink','cotton_candy','dark_magenta','fandango','french_fuchsia','french_pink','fuchsia_rose','magenta_haze','mimi_pink','persian_pink','piggy_pink','pink','pink_lace','pink_lavender','plum','queen_pink','rose','rose_quartz','shocking_pink','silver_pink','sky_magenta','super_pink'] %}
{% elif states('input_select.front_room_color_set') == 'Grays' %}
{% set colors = ['ash_gray','battleship_gray','cadet_gray','charcoal','dim_gray','gunmetal','jet','marengo','nickel','platinum','rocket_metallic','silver','slate_gray'] %}
{% endif %}
{{ colors|random }}
- delay:
seconds: '{{ states("input_number.front_room_light_cycle_transition") | int }}'
until:
- condition: state
entity_id: input_boolean.front_room_light_cycle
state: 'off'
- service: automation.trigger
entity_id: automation.front_room_lights_to_on
@@ -0,0 +1,77 @@
alias: Front Room Lights to Off
id: automation_front_room_lights_to_off
mode: restart
trigger:
- platform: state
entity_id: input_select.front_room_mode
- platform: state
entity_id: input_boolean.front_room_occupied
to: 'off'
- platform: state
entity_id: binary_sensor.front_room_naturally_lit
from: 'off'
to: 'on'
#- platform: time_pattern
# minutes: "/5"
condition:
- alias: "Front room light cycle not on"
condition: state
entity_id: input_boolean.front_room_light_cycle
state: "off"
- condition: or
conditions:
- condition: state
entity_id: input_select.front_room_mode
state: 'Off'
- condition: state
entity_id: input_boolean.front_room_occupied
state: 'off'
- "{{ is_state('binary_sensor.front_room_naturally_lit','on') }}"
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: or
conditions:
- condition: state
entity_id: input_select.front_room_mode
state: 'Off'
- condition: state
entity_id: input_boolean.front_room_occupied
state: 'off'
- condition: not
conditions:
- condition: state
entity_id: input_select.front_room_mode
state: 'Manual'
- "{{ is_state('binary_sensor.front_room_naturally_lit','on') }}"
sequence:
- service: scene.turn_on
data:
transition: 5
target:
entity_id: scene.front_room_hue_off
- choose:
- conditions:
- condition: state
entity_id: input_boolean.guest_mode
state: 'on'
sequence:
- alias: "Turn off z-wave switch since all lights are off"
service: homeassistant.turn_off
target:
entity_id: switch.front_room_motion_switch
@@ -0,0 +1,173 @@
alias: Front Room Lights to On
id: automation_front_room_lights_to_on
mode: single
# Hide warnings when triggered while in delay.
max_exceeded: silent
trigger:
- platform: state
id: mode_change
entity_id:
- input_select.front_room_mode
- input_select.automatic_light_profile
- platform: state
id: occupied
entity_id:
- binary_sensor.front_room_occupied
- input_boolean.front_room_occupied
to: "on"
# - platform: state
# id: motion
# entity_id: group.front_room_motion
# to: "on"
- platform: state
id: light_level
entity_id: binary_sensor.front_room_naturally_lit
from: 'on'
to: 'off'
condition:
- alias: "Home is occupied"
condition: state
entity_id: input_boolean.home_occupied
state: "on"
- alias: "Front room light cycle not on"
condition: state
entity_id: input_boolean.front_room_light_cycle
state: "off"
- alias: "Check if light should turn on"
condition: or
conditions:
- alias: "Guest mode is on"
condition: state
entity_id: input_boolean.guest_mode
state: "on"
- alias: "Motion or occupancy were detected in a dim room"
condition: and
conditions:
- alias: "Light level below trigger amount"
condition: state
entity_id: binary_sensor.front_room_naturally_lit
state: 'off'
- alias: "Motion or occupancy were detected"
condition: or
conditions:
- alias: "Motion was detected"
condition: trigger
id: "motion"
- alias: "Occupancy was detected"
condition: trigger
id: "occupied"
- alias: "A scene changed and the lights are already on"
condition: and
conditions:
- condition: trigger
id: "mode_change"
- condition: state
entity_id: input_boolean.front_room_occupied
state: "on"
- alias: "The light level changed, the room is occupied, and the light is off"
condition: and
conditions:
- condition: trigger
id: light_level
- condition: state
entity_id: input_boolean.front_room_occupied
state: 'on'
- condition: state
entity_id: light.front_room_hue
state: 'off'
variables:
switch_name: switch.front_room_motion_switch
light_name: front_room_hue
mode_name: input_select.front_room_mode
action:
- alias: "Make sure Z-Wave switch is turned on"
service: homeassistant.turn_on
target:
entity_id: "{{ switch_name }}"
- choose:
- alias: "If the room is set to manual, just turn the lights on"
conditions:
- alias: "Room set to manual"
condition: state
entity_id: input_select.front_room_mode
state: Manual
sequence:
- service: light.turn_on
target:
entity_id: light.front_room_hue
- alias: "If the room is set to auto, the lights are already on, and the room is dim, change to the Automatic Light Profile scene with a transition"
conditions:
- alias: "Room set to auto"
condition: state
entity_id: input_select.front_room_mode
state: Auto
- alias: "Lights are on"
condition: state
entity_id: light.front_room_hue
state: 'on'
- "{{ states('sensor.front_room_light_level') | float(default=0) < states('input_number.front_room_light_level_trigger') | float(default=0) }}"
sequence:
- service: scene.turn_on
data:
transition: "{{ states('input_number.light_scene_transition') }}"
target:
entity_id: "scene.{{light_name}}_{{states('input_select.automatic_light_profile').lower().replace(' ','_')}}"
- alias: "If the room is set to auto and the lights are off, change to the Automatic Light Profile scene without a transition"
conditions:
- alias: "Room set to auto"
condition: state
entity_id: input_select.front_room_mode
state: Auto
- alias: "Lights are off"
condition: state
entity_id: light.front_room_hue
state: 'off'
- "{{ states('sensor.front_room_light_level') | float(default=0) < states('input_number.front_room_light_level_trigger') | float(default=0) }}"
sequence:
- service: scene.turn_on
target:
entity_id: "scene.{{light_name}}_{{states('input_select.automatic_light_profile').lower().replace(' ','_')}}"
- alias: "If the room is not set to auto and the lights are on, change to the Front Room Mode scene with a transition"
conditions:
- alias: "Room not manual or auto and lights are on"
condition: state
entity_id: light.front_room_hue
state: 'on'
- "{{ states('sensor.front_room_light_level') | float(default=0) < states('input_number.front_room_light_level_trigger') | float(default=0) }}"
sequence:
- service: scene.turn_on
data:
transition: "{{ states('input_number.light_scene_transition') }}"
target:
entity_id: "scene.{{light_name}}_{{states(mode_name).lower().replace(' ','_')}}"
- alias: "If the room is not set to auto and the lights are on, change to the Front Room Mode scene without a transition"
conditions:
- alias: "Room not manual or auto and lights are off"
condition: state
entity_id: light.front_room_hue
state: 'off'
- "{{ states('sensor.front_room_light_level') | float(default=0) < states('input_number.front_room_light_level_trigger') | float(default=0) }}"
sequence:
- service: scene.turn_on
target:
entity_id: "scene.{{light_name}}_{{states(mode_name).lower().replace(' ','_')}}"
- delay: 1
@@ -0,0 +1,65 @@
alias: 'Front Room Not Occupied'
id: automation_front_room_not_occupied
mode: restart
trigger:
- platform: state
entity_id: input_boolean.home_occupied
from: 'on'
to: 'off'
- platform: state
entity_id:
- input_boolean.home_occupied
- binary_sensor.front_room_occupied
to: 'off'
for: '00:05:00'
# - platform: time_pattern
# minutes: "/5"
condition:
- condition: state
entity_id: input_boolean.front_room_occupied
state: 'on'
- condition: state
entity_id: input_boolean.lights_off_manually
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: input_boolean.home_occupied
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.front_room_person_occupancy
state: 'off'
for:
minutes: 5
- condition: state
entity_id: binary_sensor.front_room_occupied
state: 'off'
for:
minutes: 5
action:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.home_occupied
state: 'off'
sequence:
- service: homeassistant.turn_off
entity_id: input_boolean.front_room_occupied
- conditions:
- condition: not
conditions:
- condition: state
entity_id: input_select.house
state: 'Manual'
sequence:
- service: homeassistant.turn_off
entity_id: input_boolean.front_room_occupied
@@ -0,0 +1,18 @@
alias: 'Front Room Occupied'
id: automation_front_room_occupied
mode: restart
trigger:
- platform: state
entity_id:
- binary_sensor.front_room_occupied
to: 'on'
condition:
# Computer area was not already occupied
- condition: state
entity_id: input_boolean.front_room_occupied
state: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.front_room_occupied
@@ -0,0 +1,24 @@
alias: Front Room TV Paused
id: automation_front_room_tv_paused
trigger:
- platform: state
entity_id: media_player.front_room_tv
from: 'playing'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.front_room_mode
option: "{{ states('input_text.front_room_mode') }}"
- service: automation.trigger
entity_id: automation.front_room_lights_to_on
@@ -0,0 +1,42 @@
alias: Front Room TV Playing
id: automation_front_room_tv_playing
trigger:
- platform: state
entity_id: media_player.front_room_tv
to: 'playing'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
- condition: state
entity_id: light.front_room_hue
state: 'on'
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: not
conditions:
- condition: state
entity_id: media_player.front_room_tv
attribute: 'source'
state: 'PBS KIDS'
- condition: state
entity_id: media_player.front_room_tv
attribute: 'source'
state: 'YouTube'
action:
- service: input_text.set_value
data_template:
entity_id: input_text.front_room_mode
value: "{{ states('input_select.front_room_mode') }}"
- service: input_select.select_option
data:
entity_id: input_select.front_room_mode
option: Dimmed
- service: automation.trigger
entity_id: automation.front_room_lights_to_on
@@ -0,0 +1,20 @@
alias: Front Room TV Standby
id: automation_front_room_tv_standby
trigger:
- platform: state
entity_id: media_player.front_room_tv
to: 'standby'
for: '00:05:00'
condition:
- condition: state
entity_id: input_boolean.lighting_automations
state: 'on'
action:
- service: input_select.select_option
data_template:
entity_id: input_select.front_room_mode
option: "{{ states('input_text.front_room_mode') }}"
- service: automation.trigger
entity_id: automation.front_room_lights_to_on