# Mode config input_select: bedroom_mode: name: Bedroom mode options: - day - bed - night guest_bedroom_mode: name: Guest Bedroom mode options: - day - night binary_sensor: - platform: template sensors: bedroom_mode: friendly_name: Bedroom mode value_template: "{{ states('input_select.bedroom_mode') }}" icon_template: >- {% if is_state('input_select.bedroom_mode', 'day') %} mdi:weather-sunny {% elif is_state('input_select.bedroom_mode', 'bed') %} mdi:bed-king-outline {% else %} mdi:weather-night {% endif %} someone_sleeping: friendly_name: Someone sleeping value_template: >- {% if is_state('input_boolean.guest_bedroom', 'off') %} {{ is_state('input_select.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') or is_state('input_select.bedroom_mode', 'bed')) and is_state('input_select.guest_bedroom_mode', 'night') %} night {% else %} day {% endif %} {% endif %} script: toggle_bedroom_mode: alias: Toggle bedroom mode sequence: - service: input_select.select_option entity_id: input_select.bedroom_mode data_template: option: "{{ is_state('input_select.bedroom_mode', 'day') | iif('night', 'day') }}" automation: - alias: Bedroom mode · Set to day trigger: platform: state entity_id: input_select.bedroom_mode to: "day" action: - service: script.routine_bedroom_morning - alias: Bedroom mode · Set to bed trigger: platform: state entity_id: input_select.bedroom_mode to: "bed" action: - service: script.routine_bedroom_bedtime - alias: Bedroom mode · Set to night trigger: platform: state entity_id: input_select.bedroom_mode to: "night" action: - service: script.bedroom_good_night - alias: Guest Bedroom mode · Set to night trigger: platform: state 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 - alias: Bedroom mode · Set to day if bedroom door was opened trigger: - platform: state entity_id: binary_sensor.bedroom_door to: "on" - platform: state entity_id: group.bedroom_windows condition: - "{{ now().hour >= states('input_datetime.alarm_time')[0:2]|int }}" - condition: not conditions: - condition: state entity_id: input_select.bedroom_mode state: "day" - condition: state entity_id: input_boolean.georgi_home state: "on" action: - service: input_select.select_option entity_id: input_select.bedroom_mode data: option: "day"