{ services.home-assistant.extraComponents = [ "deconz" "shelly" "sun" ]; services.home-assistant.config = { homeassistant = { customize_domain = { light = { assumed_state = false; }; }; }; "automation light_sunrise" = { alias = "light_sunrise"; hide_entity = true; trigger = { platform = "sun"; event = "sunrise"; }; action = { service = "light.turn_on"; target = { entity_id = "{{ states.light | selectattr(\"state\",\"eq\",\"on\") | map(attribute=\"entity_id\") | list }}"; }; data = { brightness_pct = 254; color_temp = 250; }; }; }; "automation light_sunset" = { alias = "light_sunset"; hide_entity = true; trigger = { platform = "sun"; event = "sunset"; }; action = { service = "light.turn_on"; target = { entity_id = "{{ states.light | selectattr(\"state\",\"eq\",\"on\") | map(attribute=\"entity_id\") | list }}"; }; data = { brightness_pct = 30; color_temp = 450; }; }; }; "automation light_on" = { alias = "light_on"; hide_entity = true; trigger = { platform = "state"; entity_id = [ "light.bedroom_lights" "light.kitchen_lights" "light.livingroom_lights" "light.hallway_lights" "light.bathroom_lights" "light.toilett_lights" "light.storage_lights" ]; to = "on"; }; action = [ { choose = [ { conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.toilett_lights' }}" ]; sequence = [ { delay = 10; } { service = "light.turn_on"; target = { entity_id = "{{ trigger.entity_id }}"; }; data = { brightness_pct = 10; color_temp = 450; }; } ]; } { conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.hallway_lights' }}" ]; sequence = [ { delay = 10; } { service = "light.turn_on"; target = { entity_id = "{{ trigger.entity_id }}"; }; data = { brightness_pct = 1; color_temp = 450; }; } ]; } { conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.bathroom_lights' }}" ]; sequence = [ { delay = 10; } { service = "light.turn_on"; target = { entity_id = "{{ trigger.entity_id }}"; }; data = { brightness_pct = 30; color_temp = 450; }; } ]; } { conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.livingroom_lights' }}" ]; sequence = [ { delay = 10; } { service = "light.turn_on"; target = { entity_id = "{{ trigger.entity_id }}"; }; data = { brightness_pct = 5; color_temp = 450; }; } ]; } { conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.bedroom_lights' }}" ]; sequence = [ { delay = 10; } { service = "light.turn_on"; target = { entity_id = "light.bedroom_lights"; }; data = { brightness_pct = 5; color_temp = 450; }; } ]; } { conditions = [ "{{ state_attr('sun.sun', 'elevation') < 5 and trigger.entity_id == 'light.kitchen_lights' }}" ]; sequence = [ { delay = 10; } { service = "light.turn_on"; target = { entity_id = "light.kitchen_lights"; }; data = { brightness_pct = 30; color_temp = 450; }; } ]; } { conditions = [ "{{ state_attr('sun.sun', 'elevation') > 4 }}" ]; sequence = [ { delay = 10; } { service = "light.turn_on"; target = { entity_id = "{{ trigger.entity_id }}"; }; data = { brightness_pct = 100; color_temp = 250; }; } ]; } ]; } ]; }; "automation bathroom light small" = { alias = "bathroom light small"; mode = "restart"; hide_entity = true; trigger = { platform = "state"; entity_id = [ "light.bathroom_switch_channel_1" ]; from = "on"; to = "off"; }; action = [ { service = "switch.turn_off"; target = { entity_id = "switch.bathroom_small"; }; } ]; }; "automation bathroom light" = { alias = "bathroom light"; mode = "restart"; hide_entity = true; trigger = { platform = "state"; entity_id = [ "light.bathroom_switch_channel_1" ]; from = "off"; to = "on"; }; action = [ { delay = 3600; } { service = "light.turn_off"; target = { entity_id = "light.bathroom_switch_channel_1"; }; } ]; }; "automation bed_led" = { alias = "bed_led"; mode = "restart"; hide_entity = true; trigger = { platform = "state"; entity_id = [ "light.bedroom_led" ]; from = "off"; to = "on"; }; action = [ { delay = 10800; } { service = "light.turn_off"; target = { entity_id = "{{ trigger.entity_id }}"; }; } ]; }; "automation hallway_motion" = { alias = "Hallway Motion"; hide_entity = true; trigger = { platform = "state"; entity_id = "binary_sensor.hallway_motion_motion"; }; action = { service_template = "light.turn_{{ trigger.to_state.state }}"; target = { entity_id = "light.hallway_lights"; }; }; }; "automation bed_button_1" = { alias = "bed_button_1"; trigger = { platform = "event"; event_type = "shelly.click"; event_data = { device = "shellybutton1-E8DB84AA196D"; }; }; action = [ { choose = [ { conditions = [ "{{ trigger.event.data.click_type == \"single\" }}" ]; sequence = [ { service = "light.toggle"; entity_id = "light.bed_reading_1"; } ]; } { conditions = [ "{{ trigger.event.data.click_type == \"double\" }}" ]; sequence = [ { service = "light.toggle"; entity_id = "light.bedroom_lights"; } ]; } { conditions = [ "{{ trigger.event.data.click_type == \"triple\" }}" ]; sequence = [ { service = "light.toggle"; entity_id = "light.bedroom_bed"; } ]; } ]; } ]; }; "automation bed_button_2" = { alias = "bed_button_2"; trigger = { platform = "event"; event_type = "shelly.click"; event_data = { device = "shellybutton1-E8DB84AA136D"; }; }; action = [ { choose = [ { conditions = [ "{{ trigger.event.data.click_type == \"single\" }}" ]; sequence = [ { service = "light.toggle"; entity_id = "light.bed_reading_2"; } ]; } { conditions = [ "{{ trigger.event.data.click_type == \"double\" }}" ]; sequence = [ { service = "light.toggle"; entity_id = "light.bedroom_lights"; } ]; } { conditions = [ "{{ trigger.event.data.click_type == \"triple\" }}" ]; sequence = [ { service = "light.toggle"; entity_id = "light.bedroom_bed"; } ]; } ]; } ]; }; }; }