Skip to content

Instantly share code, notes, and snippets.

@Blackshome
Last active March 25, 2024 00:14
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save Blackshome/85d6e7dbfa3390afbcf3e801b8be6294 to your computer and use it in GitHub Desktop.
Save Blackshome/85d6e7dbfa3390afbcf3e801b8be6294 to your computer and use it in GitHub Desktop.
sensor-light-add-on.yaml
blueprint:
name: Sensor Light Add On
description: >
# ♾️ Sensor Light Add On - Media & Movie - House Alarm - Smoke Alarm + More
**Version: 2.0**
Lights, Camera, Action! Get ready to grab the popcorn because it's movie time with a touch of cinematic magic! 🎬✨
**If you like my blueprints, and would like to show your support or just say thank you? [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8)** 🙂
Below are some examples on how the automation can be used:
- Media (Cinema Room): Turn on different lights when watching a movie.
- House Alarm: Turn on lights when your house alarm has been activated.
- Smoke Detector: Turn on lights and exhaust fans when the smoke detector has been activated.
<details>
<summary><b>The Automation Process:</b> - Click here to expand</summary>
The example below is suitable for movie nights or use in a cinema room. Additionally, it can be used to turn on lights when your house alarm has been activated or activate lights and exhaust fans when a smoke detector has been triggered.
- **Movie Start (Playing):**
- Lights, switches, and scenes are activated to a customizable movie mode when a movie starts.
- You can also specify the app used in the media player (e.g., Apple TV, Netflix, etc.) and only activate the automation if these apps are used.
- Optionally, you can select which lights and switches to be turned off at the start of the movie.
- Optionally, you can also choose to create a snapshot of your lights and switches before the movie starts, allowing you to return them to their original state after the movie ends.
- **Delay Time:**
- The delay time is a buffer period before the automation switches OFF or enters an intermission mode. It provides a grace period to rectify accidental actions, like mistakenly pressing the wrong button on the remote, which might unintentionally turn the automation OFF or trigger the intermission mode.
- **Intermission:**
- Intermission allows for versatile lighting adjustments, including turning on different lights, adjusting brightness levels, changing colour temperature settings, or selecting specific scenes. It's particularly handy for setting slightly brighter lights during an intermission break when pausing a movie.
- **Movie End:**
- When the movie ends, all lights, switches, scenes and scripts are turned off. Alternatively, if you're using the automation link option, your sensor light automation will be activated, returning your lights to your sensor light automation settings.
- Optionally, you can select any lights, switches, and scenes to be turned on after the movie ends.
- If you have chosen to create a snapshot of your lights and switches at the start, they will be returned to their original state when the movie ends.
- **Automation Link Option:**
- The "Automation Link Option" seamlessly integrates with other blueprints, such as the "Sensor Light Blueprint," allowing you to disable additional automations when a movie is activated. This feature takes control of the lights, switches, scenes, and scripts, ensuring a smooth movie experience. Once the movie ends, the other automations are re-enabled, restoring the lights, switches, scenes, and scripts to their normal operation.
- **Manual Override:**
- Utilize "Bypass Options" for manual bypassing of trigger sensors, providing manual control and additional customization.
- **Sun Elevation Options:**
- Implement "Sun Elevation" to restrict automation to darker conditions aligned with the sun's position.
- **Ambient Light Sensing Options:**
- Set up an Ambient Light Sensor for activation in low-light conditions, customizable with specified LUX values.
- **Blueprint Add-On Integration:**
- 💡 Sensor Light: Illuminate your space with customizable lighting experiences. Discover how to customize it to perfection! [Learn more](https://community.home-assistant.io/t/481048).
- 🚿 Bathroom Humidity Exhaust Fan: Turns exhaust fans on when smoke detector is activated. [Learn more](https://community.home-assistant.io/t/509992).
</details>
Need help? See our FAQ: [Click Here](https://community.home-assistant.io/t/591824/2?u=blacky)
Let us know what you think of this blueprint and for community support including updates: [Click Here](https://community.home-assistant.io/t/591824?u=blacky)
Required = *
domain: automation
input:
trigger_entities:
name: Media Player - House Alarm - Smoke Alarm - Etc*
description: This input plays a crucial role in activating the automation and controls the state changes of lights, switches and scenes.
It responds when devices such as media players, Apple TV, Chromecast, alarms, smoke detectors, etc., reach the specified state configured in the
'Trigger - ON State,' thereby triggering the automation. Please select the desired devices or entities you would like to use
selector:
entity:
multiple: true
trigger_on_state:
name: Trigger - ON State *
description: Choose the trigger state(s) from the dropdown menu required to activate the automation.
If your desired state is not listed, simply type it in and press enter.
selector:
select:
multiple: true
custom_value: true
options:
- label: ON.
value: "on"
- label: Playing
value: "playing"
app_attribute:
name: Use The APP Option (Optional)
description: You can select the apps used in the media player (e.g., Apple TV, Netflix, etc.) that will activate the automation only when these apps are being used.
A list of apps is provided in the dropdown menu, but if your app is not shown or if it doesn't work, please [click here](https://community.home-assistant.io/t/591824/81?u=blacky) for more information on how to set this up correctly.
default: []
selector:
select:
multiple: true
custom_value: true
sort: true
options:
- label: Amazon Prime (Apple TV)
value: com.amazon.aiv.AIVApp
- label: Apple TV & TV+
value: com.apple.TVWatchList
- label: HBO Max (Apple TV)
value: com.wbd.stream
- label: MLB (Apple TV)
value: com.mlb.AtBatUniversal
- label: NBA (Apple TV)
value: com.nbaimd.gametime.universal
- label: Netflix (Apple TV)
value: com.netflix.Netflix
- label: NFL (Apple TV)
value: com.nfl.gamecenter
- label: Plex (Apple TV)
value: com.plexapp.plex
- label: Rumble (Apple TV)
value: com.rumble.battles
- label: YouTube (Apple TV)
value: com.google.ios.youtube
- label: YouTube TV (Apple TV)
value: com.google.ios.youtubeunplugged
- label: Netflix (Chromecast TV)
value: Netflix
- label: Plex (Chromecast TV)
value: Plex
- label: YouTube (Chromecast TV)
value: YouTube
- label: YouTube TV (Chromecast TV)
value: YouTube TV
- label: PlayStation - Game
value: game
trigger_off_state:
name: Trigger - OFF State *
description: Choose the trigger state(s) from the dropdown menu required to deactivate the automation.
If your desired state is not listed, simply type it in and press enter.
selector:
select:
multiple: true
custom_value: true
options:
- label: OFF.
value: "off"
- label: Idle
value: "idle"
- label: Paused
value: "paused"
- label: Standby
value: "standby"
time_delay:
name: Time Delay
description: This time delay acts as a buffer before the automation turns OFF or enters intermission mode.
It prevents accidental actions, such as pressing stop or pause on your remote, by providing a brief window
to correct any mistakes before your lights change keeping you in the mode you are currently in.
default: 1.5
selector:
number:
min: 0
max: 10
step: 0.5
unit_of_measurement: seconds
light_switch:
name: Lights - Switches - Scenes *
description: Enter the lights, switches, and scenes that will be activated based on the selected entities corresponding to the 'Trigger - ON State' settings.
When the entity is activated to the ON state, these specified lights, switches, and scenes are activated accordingly.
If adding a scene, please refer to the 'Scenes To Turn OFF' section below.
**NOTE** - You can only use entities. Areas and devices are not supported.
selector:
target:
entity:
domain:
- light
- switch
- scene
end_scenes:
name: Scenes To Turn OFF
description: If you've opted to activate a scene in either the "Lights - Switches - Scenes" or
"Intermission - Lights - Switches - Scenes" sections and wish for the entities to turn OFF afterwards,
you'll need to create an additional scene. This scene should include all the entities (e.g., lights, switches, etc.)
utilized in those scenes, ensuring they're turned OFF. Then input the scene here.
default: []
selector:
entity:
multiple: true
filter:
domain:
- scene
include_light_control:
name: Use The Light Control Options (Optional)
description: Select if you would like to use brightness, colour temperature, or transition.
These settings will only affect a 'light' entity that supports each selected option.
The settings for brightness, colour temperature, and transition are provided below.
default: []
selector:
select:
multiple: true
options:
- label: Use brightness
value: "use_brightness"
- label: Use colour temperature
value: "use_colour_temperature"
- label: Use transition
value: "use_transition"
light_brightness:
name: Brightness
description: The brightness setting for the lights when they are turned ON.
default: 100
selector:
number:
min: 1
max: 100
mode: slider
step: 1
unit_of_measurement: '%'
light_colour_temperature:
name: Colour Temperature
description: The colour temperature setting for the lights when they are turned ON.
default: 5000
selector:
number:
min: 2000
max: 8000
mode: slider
step: 100
unit_of_measurement: 'kelvin'
light_transition_on:
name: Transition - ON
description: The transition setting for the lights when they are turned ON.
default: 1
selector:
number:
min: 0
max: 5
mode: slider
step: 0.5
unit_of_measurement: seconds
light_transition_off:
name: Transition - OFF
description: The transition setting for the lights when they are turned OFF.
default: 1
selector:
number:
min: 0
max: 30
mode: slider
step: 1
unit_of_measurement: seconds
include_start_turn_off:
name: Use the Start Turn OFF Options (Optional)
description: The lights and switches to turn OFF when the automation first starts.
default: disable_start_turn_off
selector:
select:
options:
- label: Enable the start turn OFF options
value: "enable_start_turn_off"
- label: Disable the start turn OFF options
value: "disable_start_turn_off"
off_light_switch:
name: Start Turn OFF - Lights - Switches
description: Enter the lights and switches you would like to turn OFF when the automation first starts.
**NOTE** - You can only use entities. Areas and devices are not supported.
default: {}
selector:
target:
entity:
domain:
- light
- switch
off_include_light_control:
name: Start Turn OFF - Use The Light Control Options (Optional)
description: Select if you would like to use transition.
This setting will only affect a 'light' entity that supports the selected option.
The settings for transition are provided below.
default: []
selector:
select:
multiple: true
options:
- label: Use transition
value: "use_transition"
off_light_transition_off:
name: Start Turn OFF - Transition - OFF
description: The transition setting for the lights when they are turned OFF.
default: 1
selector:
number:
min: 0
max: 30
mode: slider
step: 1
unit_of_measurement: seconds
include_intermission:
name: Use The Intermission Option (Optional)
description: Intermission allows for versatile lighting adjustments, including turning on different lights,
adjusting brightness levels, changing colour temperature settings, or selecting specific scenes.
It's particularly handy for setting slightly brighter lights during an intermission break when pausing a movie.
It also can activate/deactivate lights, switches, and scenes when a smoke detector or alarm system is silenced but still active.
default: intermission_disable
selector:
select:
options:
- label: Enable intermission option
value: "intermission_enable"
- label: Disable intermission option
value: "intermission_disable"
intermission_state:
name: Intermission - Trigger State
description: Choose the state that triggers intermission mode from the dropdown list.
If your desired state isn't listed, simply type it in and press enter
**Note** - The selection cannot match the options chosen in the 'Trigger - ON State' or 'Trigger - OFF State' sections.
default: paused
selector:
select:
multiple: true
custom_value: true
options:
- label: Paused
value: "paused"
- label: Idle
value: "idle"
intermission_light_switch:
name: Intermission - Lights - Switches - Scenes
description: The lights, switches, and scenes to activate during intermission mode.
If adding a scene, please refer to the 'Intermission - Scenes To Turn OFF' section below.
**NOTE** - You can only use entities. Areas and devices are not supported.
default: {}
selector:
target:
entity:
domain:
- light
- switch
- scene
intermission_end_scenes:
name: Intermission - Scenes To Turn OFF
description: If you've chosen to activate a scene in 'Intermission - Lights - Switches - Scenes' and it includes
different entities (e.g., lights, switches, etc.) from those used in 'Lights - Switches - Scenes' above,
you'll need to create another scene to include the different entities used, ensuring they're turned OFF.
Then input the scene here.
If your entities are the same as those used in 'Intermission - Lights - Switches - Scenes', then you can leave this input blank
default: []
selector:
entity:
multiple: true
filter:
domain:
- scene
intermission_include_light_control:
name: Intermission - Light Control Options (Optional)
description: Select if you would like to use brightness, colour temperature, or transition.
These settings will only affect a 'light' entity that supports each selected option.
The settings for brightness, colour temperature, and transition are provided below.
default: []
selector:
select:
multiple: true
options:
- label: Use brightness
value: "use_brightness"
- label: Use colour temperature
value: "use_colour_temperature"
- label: Use transition
value: "use_transition"
intermission_light_brightness:
name: Intermission - Brightness
description: The brightness setting for the lights when they are turned ON.
default: 100
selector:
number:
min: 1
max: 100
mode: slider
step: 1
unit_of_measurement: '%'
intermission_light_colour_temperature:
name: Intermission - Colour Temperature
description: The colour temperature setting for the lights when they are turned ON.
default: 5000
selector:
number:
min: 2000
max: 8000
mode: slider
step: 100
unit_of_measurement: 'kelvin'
intermission_light_transition_on:
name: Intermission - Transition - ON
description: The transition setting for the lights when they are turned ON.
default: 1
selector:
number:
min: 0
max: 5
mode: slider
step: 0.5
unit_of_measurement: seconds
intermission_light_transition_off:
name: Intermission - Transition - OFF
description: The transition setting for the lights when they are turned OFF.
default: 1
selector:
number:
min: 0
max: 30
mode: slider
step: 1
unit_of_measurement: seconds
include_end_turn_on:
name: Use the End Turn ON Options (Optional)
description: The lights, switches and scenes that will be activated when the automation ends.
You can choose to create a snapshot of your lights and switches, allowing them to return to their previous state before this automation started. Alternatively, you can select specific lights, switches, or scenes to be turned on.
**Note** - If you opt to create a snapshot, ensure to input a unique snapshot name, create a toggle helper and specify the lights and switches you intend to include in the snapshot.
This ensures that the snapshot feature functions correctly. The settings to do this are listed below.
default: disable_end_turn_on
selector:
select:
options:
- label: Enable to create a snapshot - Lights - Switches
value: "enable_end_turn_on_snapshot"
- label: Enable to turn ON - Lights - Switches - Scenes
value: "enable_end_turn_on"
- label: Disable, end turn ON options
value: "disable_end_turn_on"
end_snapshot_name:
name: End Turn ON - Snapshot Name
description: If you've chosen to create a snapshot of your lights and switches above, please ensure to provide a unique name for the snapshot.
Each automation you create using this blueprint with snapshots must have a unique snapshot name that you create here.
**Note** - The name must all be in lower case and if you would like a space then it must be "_". Example - "before" or "lights_before_movie"
default: enter_unique_snapshot_name_here
selector:
text:
end_snapshot_helper:
name: End Turn ON - Snapshot Toggle Helper
description: If you have selected to create a snapshot of your lights and switches above, then you must create a toggle helper and enter it here.
The toggle helper must be in the OFF state when the automation starts.
How to create a Snapshot Toggle Helper [Click Here](https://community.home-assistant.io/t/591824/15?u=blacky)
default: []
selector:
entity:
filter:
domain:
- input_boolean
end_light_switch:
name: End Turn ON - Lights - Switches - Scenes - Scripts
description: Specify the lights, switches, scenes and scripts you want to activate at the end of this automation.
If you've chosen to create a snapshot above, input the lights and switches you want to include in the snapshot.
Note that you can't create a snapshot of a scene.
**NOTE** - You can only use entities. Areas and devices are not supported.
default: {}
selector:
target:
entity:
domain:
- light
- switch
- scene
- script
end_include_light_control:
name: End Turn ON - Use The Light Control Options (Optional)
description: Select if you would like to use brightness, colour temperature, or transition.
These settings will only affect a 'light' entity that supports each selected option.
The settings for brightness, colour temperature, and transition are provided below.
default: []
selector:
select:
multiple: true
options:
- label: Use brightness
value: "use_brightness"
- label: Use colour temperature
value: "use_colour_temperature"
- label: Use transition
value: "use_transition"
end_light_brightness:
name: End Turn ON - Brightness
description: The brightness setting for the lights when they are turned ON.
default: 100
selector:
number:
min: 1
max: 100
mode: slider
step: 1
unit_of_measurement: '%'
end_light_colour_temperature:
name: End Turn ON - Colour Temperature
description: The colour temperature setting for the lights when they are turned ON.
default: 5000
selector:
number:
min: 2000
max: 8000
mode: slider
step: 100
unit_of_measurement: 'kelvin'
end_light_transition_on:
name: End Turn ON - Transition - ON
description: The transition setting for the lights when they are turned ON.
default: 1
selector:
number:
min: 0
max: 5
mode: slider
step: 0.5
unit_of_measurement: seconds
include_automation_link:
name: Use The Automation Link Option (Optional)
description: This feature enables you to automatically disable other automations, which can be particularly useful
if you're utilizing another blueprint of mine (e.g.' [Sensor Light](https://community.home-assistant.io/t/481048))
to manage lights, switches, or scenes and wish to deactivate it when this automation is active.
For more information on how to use the automation link option [Click Here](https://community.home-assistant.io/t/591824/4?u=blacky)
default: disable_automation_link
selector:
select:
options:
- label: Enable automation link
value: "enable_automation_link"
- label: Disable automation link
value: "disable_automation_link"
automation_link:
name: Automation Link - By-pass Control
description: Enter the other automations you would like to disable when this automation is ON.
To do this your other automations must include a by-pass switch that you enter here.
default: []
selector:
entity:
multiple: true
filter:
domain:
- input_boolean
include_sun:
name: Use The Sun Option (Optional)
description: This option is used to add a condition that only allows the automation to run when it is dark or below the 'Sun Elevation' settings.
It's a global condition that can work alongside other options. Enabling this option is not necessary for the night lights sun elevation condition to work.
default: sun_disabled
selector:
select:
options:
- label: Enable the sun option
value: "sun_enabled"
- label: Disable the sun option
value: "sun_disabled"
sun_elevation:
name: Sun Elevation Falling
description: The sun elevation falling refers to the angle between the sun and the horizon when the sun is setting.
A negative value indicates that the sun is BELOW the horizon. For example, a setting guide of -1.5 corresponds to dusk
default: -1.5
selector:
number:
min: -10
max: 5
step: 0.5
unit_of_measurement: degrees
sun_elevation_rising:
name: Sun Elevation Rising
description: The sun elevation rising refers to the angle between the sun and the horizon during sunrise.
A negative value indicates that the sun is BELOW the horizon. For example, a setting guide of -4.0 corresponds to dawn.
default: -4.0
selector:
number:
min: -10
max: 5
step: 0.5
unit_of_measurement: degrees
include_ambient:
name: Use The Ambient Options (Optional)
description: This option is used to add a condition that only allows the automation to run when it is dark or below the 'Ambient' settings.
It's a global condition that can work alongside other options.
default: ambient_disabled
selector:
select:
options:
- label: Enable the ambient options
value: "ambient_enabled"
- label: Disable the ambient options
value: "ambient_disabled"
ambient_light_sensor:
name: Ambient Light Sensor
description: Select the ambient sensor to be used.
default: []
selector:
entity:
filter:
domain: sensor
device_class: illuminance
ambient_light_options:
name: Ambient Light Sensor - Site Conditions
description: In some cases when your lights turn ON, your ambient light sensor is affected, increasing its LUX value.
This can cause the lights to go OFF prematurely. Please select an option that best suits your installation.
**NOTE** - If using an offset between the high and low lux value, then please select NO.
default: ambient_light_option_disabled
selector:
select:
options:
- label: YES - My Ambient Light Sensor is affected by the Lights
value: "ambient_light_option_enabled"
- label: NO - My Ambient Light Sensor is not affected by the Lights
value: "ambient_light_option_disabled"
ambient_light_value:
name: Ambient Light - Low Lux Value
description: Set the Ambient Light Low Lux Value. The light will turn ON when the lux level is below the set value.
This value must be equal or lower than the "High Lux Value" below. Guide is 20 lux (dusk).
default: 20
selector:
number:
min: 0
max: 500
step: 10
unit_of_measurement: lux
ambient_light_high_value:
name: Ambient Light - High Lux Value
description: Set the Ambient Light High Lux Value. The light will turn OFF when the lux level is above the set value.
This value must be equal or higher than the "Low Lux Value" above.
Setting a value higher than the low value allows for an offset. Guide is 80 lux (dawn).
default: 80
selector:
number:
min: 0
max: 1000
step: 10
unit_of_measurement: lux
scene_toggle_helper:
name: Ambient Light - Scenes Toggle Helper
description: To ensure the smooth operation of the automation, it's recommended to create a separate toggle helper specifically for enabling ambient options.
This step is only necessary if you have entered scenes without any entities into 'Lights - Switches - Scenes' or 'Intermission - Lights - Switches - Scenes' above.
default: []
selector:
entity:
filter:
domain:
- input_boolean
include_bypass:
name: Use The By-pass Options (Optional)
description: Select whether you would like to enable an option.
Each option will disable this automation but alters its behavior by either turning ON the automation link entity,
turning the automation ON, turning the automation OFF, or pausing the automation while keeping its current state
when the bypass is switched ON.
default: bypass_disabled
selector:
select:
options:
- label: 1 - Enable the By-pass - Turn automation link entity ON
value: "bypass_enabled_linked_automations"
- label: 2 - Enable the By-pass - Turn automation ON
value: "bypass_enabled_turn_on_automations"
- label: 3 - Enable the By-pass - Turn automation OFF
value: "bypass_enabled_turn_off_automations"
- label: 4 - Enable the By-pass - Pause automation
value: "bypass_enabled_pause_automation"
- label: Disable the By-pass option
value: "bypass_disabled"
trigger_bypass:
name: By-pass - Switch
description: Select a switch that will bypass (disable) the automation.
This entity cannot be included in the "Lights - Switches - Scenes" and/or "Intermission - Lights - Switches - Scenes" selections.
default: []
selector:
entity:
mode: restart
max_exceeded: silent
variables:
trigger_entities: !input trigger_entities
trigger_on_state: !input trigger_on_state
app_attribute: !input app_attribute
trigger_off_state: !input trigger_off_state
light_switch: !input light_switch
end_scenes: !input end_scenes
time_delay: !input time_delay
include_light_control: !input include_light_control
light_brightness: !input light_brightness
brightness_value: "{{ iif ('use_brightness' in include_light_control , light_brightness, ) }}"
light_colour_temperature: !input light_colour_temperature
temperature_value: "{{ iif ('use_colour_temperature' in include_light_control , light_colour_temperature, [] ) }}"
light_transition_on: !input light_transition_on
light_transition_off: !input light_transition_off
transition_on_value: "{{ iif ('use_transition' in include_light_control, light_transition_on, ) }}"
transition_off_value: "{{ iif ('use_transition' in include_light_control, light_transition_off, ) }}"
include_start_turn_off: !input include_start_turn_off
off_light_switch: !input off_light_switch
off_include_light_control: !input off_include_light_control
off_light_transition_off: !input off_light_transition_off
off_transition_off_value: "{{ iif ('use_transition' in off_include_light_control, off_light_transition_off, ) }}"
include_intermission: !input include_intermission
intermission_state: !input intermission_state
intermission_light_switch: !input intermission_light_switch
intermission_end_scenes: !input intermission_end_scenes
intermission_include_light_control: !input intermission_include_light_control
intermission_light_brightness: !input intermission_light_brightness
intermission_brightness_value: "{{ iif ('use_brightness' in intermission_include_light_control , intermission_light_brightness, ) }}"
intermission_light_colour_temperature: !input intermission_light_colour_temperature
intermission_temperature_value: "{{ iif ('use_colour_temperature' in intermission_include_light_control , intermission_light_colour_temperature, [] ) }}"
intermission_light_transition_on: !input intermission_light_transition_on
intermission_light_transition_off: !input intermission_light_transition_off
intermission_transition_on_value: "{{ iif ('use_transition' in intermission_include_light_control, intermission_light_transition_on, ) }}"
intermission_transition_off_value: "{{ iif ('use_transition' in intermission_include_light_control, intermission_light_transition_off, ) }}"
include_end_turn_on: !input include_end_turn_on
end_snapshot_name: !input end_snapshot_name
end_snapshot_helper: !input end_snapshot_helper
end_light_switch: !input end_light_switch
end_include_light_control: !input end_include_light_control
end_light_brightness: !input end_light_brightness
end_brightness_value: "{{ iif ('use_brightness' in end_include_light_control , end_light_brightness, ) }}"
end_light_colour_temperature: !input end_light_colour_temperature
end_temperature_value: "{{ iif ('use_colour_temperature' in end_include_light_control , end_light_colour_temperature, [] ) }}"
end_light_transition_on: !input end_light_transition_on
end_transition_on_value: "{{ iif ('use_transition' in end_include_light_control, end_light_transition_on, ) }}"
include_automation_link: !input include_automation_link
automation_link: !input automation_link
include_sun: !input include_sun
sun_elevation: !input sun_elevation
sun_elevation_rising: !input sun_elevation_rising
include_ambient: !input include_ambient
ambient_light_sensor: !input ambient_light_sensor
ambient_light_options: !input ambient_light_options
ambient_light_value: !input ambient_light_value
ambient_light_high_value: !input ambient_light_high_value
scene_toggle_helper: !input scene_toggle_helper
include_bypass: !input include_bypass
trigger_bypass: !input trigger_bypass
# Split domains for light switch targets
light_entities: "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}"
switch_entities: "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}"
scene_entities: "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'scene') | map(attribute='entity_id') | list }}"
# Split domains for OFF light switch targets and check entities are ON - exclude scenes as they have no off state
off_light_entities_on: >-
{% set a = off_light_switch and off_light_switch.entity_id %}
{% if a %}
{{ expand(a) | selectattr('domain', 'eq', 'light') | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
off_switch_entities_on: >-
{% set a = off_light_switch and off_light_switch.entity_id %}
{% if a %}
{{ expand(a) | selectattr('domain', 'eq', 'switch') | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
# Split domains for end light switch targets
end_scene_create: >-
{% set a = end_light_switch and end_light_switch.entity_id %}
{% if a %}
{{ expand(a) | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
end_light_entities: >-
{% set a = end_light_switch and end_light_switch.entity_id %}
{% if a %}
{{ expand(a) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
end_switch_entities_off: >-
{% set a = end_light_switch and end_light_switch.entity_id %}
{% if a %}
{{ expand(a) | selectattr('domain', 'eq', 'switch') | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
end_scene_entities: >-
{% set a = end_light_switch and end_light_switch.entity_id %}
{% if a %}
{{ expand(a) | selectattr('domain', 'eq', 'scene') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
end_script_entities: >-
{% set a = end_light_switch and end_light_switch.entity_id %}
{% if a %}
{{ expand(a) | selectattr('domain', 'eq', 'script') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
# Split domains for intermission light switch target and check entities are OFF - exclude scenes as they have no off state
intermission_light_entities_off: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(b) | selectattr('domain', 'eq', 'light') | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
intermission_switch_entities_off: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(b) | selectattr('domain', 'eq', 'switch') | selectattr('state', 'eq', 'off') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
# Split domains for intermission light switch target
intermission_light_entities: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(b) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
intermission_switch_entities: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(b) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
intermission_scene_entities: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(b) | selectattr('domain', 'eq', 'scene') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
# Set up crossover lights for T5 trigger. This is to stop the light flicker & turn off entities not required in each domain, light & switches - only works for entities
crossover_light: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(a) | reject('in', expand(b)) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
crossover_switch: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(a) | reject('in', expand(b)) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
# Set up crossover lights for T8 trigger. This is to stop the light flicker & turn off entities not required in each domain, light & switches - only works for entities
crossover_intermission_light: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(b) | reject('in', expand(a)) | selectattr('domain', 'eq', 'light') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
crossover_intermission_switch: >-
{% set a = light_switch.entity_id %}
{% set b = intermission_light_switch and intermission_light_switch.entity_id %}
{% if a and b %}
{{ expand(b) | reject('in', expand(a)) | selectattr('domain', 'eq', 'switch') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
trigger:
- platform: state
id: "t0"
entity_id: !input trigger_entities
to: !input trigger_on_state
- platform: state
id: "t1"
entity_id: !input trigger_entities
to: !input intermission_state
- platform: state
id: "t2"
entity_id: !input trigger_bypass
from: "off"
to: "on"
- platform: state
id: "t3"
entity_id: !input trigger_bypass
from: "on"
to: "off"
- platform: numeric_state
id: "t4"
entity_id: sun.sun
attribute: elevation
below: !input sun_elevation
- platform: numeric_state
id: "t5"
entity_id: sun.sun
attribute: elevation
above: !input sun_elevation_rising
- platform: numeric_state
id: "t6"
entity_id: !input ambient_light_sensor
below: !input ambient_light_value
- platform: numeric_state
id: "t7"
entity_id: !input ambient_light_sensor
above: !input ambient_light_high_value
# All Conditions
condition:
#Trigger conditions
- condition: or
conditions:
- condition: and # trigger from off to on
conditions:
- condition: state
entity_id: !input trigger_entities
match: any
state: !input trigger_on_state
- condition: trigger
id: 't0'
- condition: and # trigger by by-pass turning on
conditions:
- condition: trigger
id: 't1'
- "{{ include_intermission == 'intermission_enable' }}"
- condition: and # trigger by by-pass turning on
conditions:
- condition: trigger
id: 't2'
- "{{ (include_bypass == 'bypass_enabled_linked_automations') or (include_bypass == 'bypass_enabled_turn_on_automations') or (include_bypass == 'bypass_enabled_turn_off_automations') or (include_bypass == 'bypass_enabled_pause_automation') }}"
- condition: and # trigger by by-pass turning off
conditions:
- condition: trigger
id: 't3'
- "{{ (include_bypass == 'bypass_enabled_linked_automations') or (include_bypass == 'bypass_enabled_turn_on_automations') or (include_bypass == 'bypass_enabled_turn_off_automations') or (include_bypass == 'bypass_enabled_pause_automation') }}"
- condition: or # trigger by Falling sun & check trigger state
conditions:
- condition: and
conditions:
- condition: trigger
id: 't4'
- "{{ include_sun == 'sun_enabled' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input trigger_on_state
- condition: and
conditions:
- condition: trigger
id: 't4'
- "{{ include_sun == 'sun_enabled' }}"
- "{{ include_intermission == 'intermission_enable' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input intermission_state
- condition: or # trigger by rising sun & check trigger state
conditions:
- condition: and
conditions:
- condition: trigger
id: 't5'
- "{{ include_sun == 'sun_enabled' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input trigger_on_state
- condition: and
conditions:
- condition: trigger
id: 't5'
- "{{ include_sun == 'sun_enabled' }}"
- "{{ include_intermission == 'intermission_enable' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input intermission_state
- condition: or # trigger by falling in ambient & check trigger state
conditions:
- condition: and
conditions:
- condition: trigger
id: 't6'
- "{{ include_ambient == 'ambient_enabled' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input trigger_on_state
- condition: and
conditions:
- condition: trigger
id: 't6'
- "{{ include_ambient == 'ambient_enabled' }}"
- "{{ include_intermission == 'intermission_enable' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input intermission_state
- condition: or # trigger by rising ambient, site condition set to NO & check trigger state
conditions:
- condition: and
conditions:
- condition: trigger
id: 't7'
- "{{ include_ambient == 'ambient_enabled' }}"
- "{{ ambient_light_options == 'ambient_light_option_disabled' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input trigger_on_state
- condition: and
conditions:
- condition: trigger
id: 't7'
- "{{ include_ambient == 'ambient_enabled' }}"
- "{{ ambient_light_options == 'ambient_light_option_disabled' }}"
- "{{ include_intermission == 'intermission_enable' }}"
- condition: state
entity_id: !input trigger_entities
match: any
state: !input intermission_state
# Media App
- condition: or
conditions:
- "{{ app_attribute == [] }}"
- condition: state # For Apple TV, PlayStation, Amazon Fire TV
entity_id: !input trigger_entities
attribute: app_id
state: !input app_attribute
- condition: state # For Chromecast TV apps, Apple TV if used
entity_id: !input trigger_entities
attribute: app_name
state: !input app_attribute
- condition: state # For PlayStation
entity_id: !input trigger_entities
attribute: media_content_type
state: !input app_attribute
- condition: trigger
id:
- 't2'
- 't3'
# Check Trigger By-pass
- condition: or
conditions:
- "{{ include_bypass == 'bypass_disabled' }}"
- "{{ trigger_bypass == [] }}"
- "{{ (include_bypass == 'bypass_enabled_linked_automations') and (states[trigger_bypass].state == 'off') }}"
- "{{ (include_bypass == 'bypass_enabled_turn_on_automations') and (states[trigger_bypass].state == 'off') }}"
- "{{ (include_bypass == 'bypass_enabled_turn_off_automations') and (states[trigger_bypass].state == 'off') }}"
- "{{ (include_bypass == 'bypass_enabled_pause_automation') and (states[trigger_bypass].state == 'off') }}"
- condition: trigger
id: 't2'
# Check Sun Elevation
- condition: or
conditions:
- "{{ include_sun == 'sun_disabled' }}"
- "{{ (include_sun == 'sun_enabled') and (is_state_attr('sun.sun', 'rising', false)) and (state_attr('sun.sun','elevation') <= sun_elevation | float(90)) }}"
- "{{ (include_sun == 'sun_enabled') and (is_state_attr('sun.sun', 'rising', true)) and (state_attr('sun.sun','elevation') <= sun_elevation_rising | float(90)) }}"
- condition: trigger
id: 't5'
# Check Ambient Light Sensor
- condition: or
conditions:
- "{{ include_ambient == 'ambient_disabled' }}"
- "{{ ambient_light_sensor == [] }}"
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_value | int) }}"
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_high_value | int) and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}"
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_high_value | int) and ((include_intermission == 'intermission_enable') and (expand(intermission_light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- "{{ (ambient_light_options == 'ambient_light_option_enabled') and (expand(light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0) }}"
- "{{ (ambient_light_options == 'ambient_light_option_enabled') and ((include_intermission == 'intermission_enabled') and (expand(intermission_light_switch.entity_id) | selectattr('state', '==', 'on') | list | count > 0)) }}"
- condition: and
conditions:
- "{{ (include_ambient == 'ambient_enabled') and (states[ambient_light_sensor].state | int < ambient_light_high_value | int) }}"
- condition: template
value_template: >-
{% if scene_toggle_helper != [] %}
{{ is_state(scene_toggle_helper, 'on') }}
{% endif %}
- condition: and
conditions:
- "{{ (include_ambient == 'ambient_enabled') and ( ambient_light_options == 'ambient_light_option_enabled' ) }}"
- condition: template
value_template: >-
{% if scene_toggle_helper != [] %}
{{ is_state(scene_toggle_helper, 'on') }}
{% endif %}
- condition: trigger
id:
- 't2'
- 't3'
- 't7'
action:
- choose:
- alias: "Check trigger intermission is enabled and preform the correct actions"
conditions:
- condition: trigger
id: 't1'
sequence:
- alias: "Wait the number of seconds set in the time delay"
delay: !input time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ crossover_light }}"
data:
transition: "{{ transition_off_value }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ crossover_light }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ crossover_switch }}"
- choose:
- alias: "Set the transition for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in intermission_include_light_control) and ('use_brightness' not in intermission_include_light_control) and ('use_colour_temperature' not in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data:
transition: "{{ intermission_transition_on_value }}"
- alias: "Set the transition and brightness for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in intermission_include_light_control) and ('use_brightness' in intermission_include_light_control) and ('use_colour_temperature' not in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data:
transition: "{{ intermission_transition_on_value }}"
brightness_pct: "{{ intermission_brightness_value }}"
- alias: "Set the transition and colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in intermission_include_light_control) and ('use_brightness' not in intermission_include_light_control) and ('use_colour_temperature' in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data:
transition: "{{ intermission_transition_on_value }}"
kelvin: "{{intermission_temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in intermission_include_light_control) and ('use_brightness' in intermission_include_light_control) and ('use_colour_temperature' in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data:
transition: "{{ intermission_transition_on_value }}"
brightness_pct: "{{ intermission_brightness_value }}"
kelvin: "{{intermission_temperature_value}}"
- alias: "Set the brightness for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in intermission_include_light_control) and ('use_brightness' in intermission_include_light_control) and ('use_colour_temperature' not in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data:
brightness_pct: "{{ intermission_brightness_value }}"
- alias: "Set the colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in intermission_include_light_control) and ('use_brightness' not in intermission_include_light_control) and ('use_colour_temperature' in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data:
kelvin: "{{intermission_temperature_value}}"
- alias: "Set the brightness and colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in intermission_include_light_control) and ('use_brightness' in intermission_include_light_control) and ('use_colour_temperature' in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data:
brightness_pct: "{{ intermission_brightness_value }}"
kelvin: "{{intermission_temperature_value}}"
- alias: "Set the default for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in intermission_include_light_control) and ('use_brightness' not in intermission_include_light_control) and ('use_colour_temperature' not in intermission_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities_off }}"
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in intermission_include_light_control }}"
sequence:
- alias: "Turn on the scenes"
service: scene.turn_on
target:
entity_id: "{{ intermission_scene_entities }}"
data:
transition: "{{ intermission_transition_on_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in intermission_include_light_control }}"
sequence:
- alias: "Turn on the scenes"
service: scene.turn_on
target:
entity_id: "{{ intermission_scene_entities }}"
- alias: "Turn on the switches"
service: switch.turn_on
target:
entity_id: "{{ intermission_switch_entities_off }}"
- alias: "Wait until trigger is off"
wait_for_trigger:
platform: state
entity_id: !input trigger_entities
to: !input trigger_off_state
- alias: "Wait the number of seconds set in the time delay"
delay: !input time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in intermission_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ intermission_light_entities }}"
data:
transition: "{{ intermission_transition_off_value }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input intermission_end_scenes
data:
transition: "{{ intermission_transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in intermission_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ intermission_light_entities }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input intermission_end_scenes
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ intermission_switch_entities }}"
- choose:
- alias: "Check if end turn ON is enable & option Enable to create a snapshot - Lights - Switches"
conditions:
- condition: template
value_template: "{{ include_end_turn_on == 'enable_end_turn_on_snapshot' }}"
- condition: state
entity_id: !input end_snapshot_helper
state: "on"
sequence:
- alias: "turn on the scene created"
service: scene.turn_on
target:
entity_id: "scene.{{end_snapshot_name }}"
- alias: "Turn on end snapshot helper"
service: homeassistant.turn_off
entity_id: !input end_snapshot_helper
- alias: "Check if end turn ON is enable & option Enable to turn ON - Lights - Switches - Scenes"
conditions:
- condition: template
value_template: "{{ include_end_turn_on == 'enable_end_turn_on' }}"
sequence:
- choose:
- alias: "Set the transition for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
- alias: "Set the transition and brightness for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
brightness_pct: "{{ end_brightness_value }}"
- alias: "Set the transition and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
brightness_pct: "{{ end_brightness_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the brightness for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
brightness_pct: "{{ end_brightness_value }}"
- alias: "Set the colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
kelvin: "{{end_temperature_value}}"
- alias: "Set the brightness and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
brightness_pct: "{{ end_brightness_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the default for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in end_include_light_control }}"
sequence:
- alias: "Turn on the end scenes"
service: scene.turn_on
target:
entity_id: "{{ end_scene_entities }}"
data:
transition: "{{ end_transition_on_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in end_include_light_control }}"
sequence:
- alias: "Turn on the end scenes"
service: scene.turn_on
target:
entity_id: "{{ end_scene_entities }}"
- alias: "Turn on the end switches"
service: switch.turn_on
target:
entity_id: "{{ end_switch_entities_off }}"
- alias: "Turn off the end script"
service: script.turn_on
data:
entity_id: "{{ end_script_entities }}"
- choose:
- alias: "Check if automation link is enable"
conditions:
- condition: template
value_template: "{{ include_automation_link == 'enable_automation_link' }}"
- condition: state
entity_id: !input automation_link
match: any
state: "on"
sequence:
- service: homeassistant.turn_off
entity_id: !input automation_link
- choose:
- alias: "Check if ambient is enable"
conditions:
- condition: template
value_template: "{{ include_ambient == 'ambient_enabled' }}"
- condition: state
entity_id: !input scene_toggle_helper
state: "on"
sequence:
- alias: "Turn off the boolean for scenes"
service: input_boolean.turn_off
data:
entity_id: !input scene_toggle_helper
- stop: "Stop the automation"
- alias: "By-pass is turned on & check by-pass option - bypass enabled linked automations"
conditions:
- condition: trigger
id: 't2'
- "{{ (include_bypass == 'bypass_enabled_linked_automations') }}"
sequence:
- service: homeassistant.turn_on
entity_id: !input automation_link
- stop: "Stop the automation"
- alias: "By-pass is turned on & check by-pass option - enabled pause automation"
conditions:
- condition: trigger
id: 't2'
- "{{ (include_bypass == 'bypass_enabled_pause_automation') }}"
sequence:
- stop: "Stop the automation"
- alias: "By-pass is turned on & turn off automation - or - trigger by rise in sun or ambient"
conditions:
- condition: or
conditions:
- alias: "Triggered by intermission"
condition: and
conditions:
- condition: trigger
id: 't2'
- "{{ (include_bypass == 'bypass_enabled_turn_off_automations') }}"
- alias: "Triggered by sun or ambient and check intermission"
condition: and
conditions:
- condition: or
conditions:
- condition: trigger
id:
- 't5'
- 't7'
sequence:
- alias: "Wait the number of seconds set in the time delay"
delay: !input time_delay
- choose:
- alias: "Check trigger intermission is enabled and turn intermission lights off"
conditions:
- condition: template
value_template: "{{ 'intermission_enable' in include_intermission }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in intermission_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ crossover_intermission_light }}"
data:
transition: "{{ intermission_transition_off_value }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input intermission_end_scenes
data:
transition: "{{ intermission_transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in intermission_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ crossover_intermission_light }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input intermission_end_scenes
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ crossover_intermission_switch }}"
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ switch_entities }}"
- choose:
- alias: "Check if automation link is enable"
conditions:
- condition: template
value_template: "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- service: homeassistant.turn_off
entity_id: !input automation_link
- choose:
- alias: "Check if ambient is enable"
conditions:
- condition: template
value_template: "{{ include_ambient == 'ambient_enabled' }}"
- condition: state
entity_id: !input scene_toggle_helper
state: "on"
sequence:
- alias: "Turn off the boolean for scenes"
service: input_boolean.turn_off
data:
entity_id: !input scene_toggle_helper
- choose:
- alias: "Check if end turn ON is enable & option Enable to create a snapshot - Lights - Switches"
conditions:
- condition: template
value_template: "{{ include_end_turn_on == 'enable_end_turn_on_snapshot' }}"
- condition: state
entity_id: !input end_snapshot_helper
state: "on"
sequence:
- alias: "turn on the scene created"
service: scene.turn_on
target:
entity_id: "scene.{{end_snapshot_name }}"
- alias: "Turn on end snapshot helper"
service: homeassistant.turn_off
entity_id: !input end_snapshot_helper
- alias: "Check if end turn ON is enable & option Enable to turn ON - Lights - Switches - Scenes"
conditions:
- condition: template
value_template: "{{ include_end_turn_on == 'enable_end_turn_on' }}"
sequence:
- choose:
- alias: "Set the transition for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
- alias: "Set the transition and brightness for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
brightness_pct: "{{ end_brightness_value }}"
- alias: "Set the transition and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
brightness_pct: "{{ end_brightness_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the brightness for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
brightness_pct: "{{ end_brightness_value }}"
- alias: "Set the colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
kelvin: "{{end_temperature_value}}"
- alias: "Set the brightness and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
brightness_pct: "{{ end_brightness_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the default for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in end_include_light_control }}"
sequence:
- alias: "Turn on the end scenes"
service: scene.turn_on
target:
entity_id: "{{ end_scene_entities }}"
data:
transition: "{{ end_transition_on_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in end_include_light_control }}"
sequence:
- alias: "Turn on the end scenes"
service: scene.turn_on
target:
entity_id: "{{ end_scene_entities }}"
- alias: "Turn on the end switches"
service: switch.turn_on
target:
entity_id: "{{ end_switch_entities_off }}"
- alias: "Turn off the end script"
service: script.turn_on
data:
entity_id: "{{ end_script_entities }}"
- stop: "Stop the automation"
- alias: "By-pass is turned off & check if the trigger is off"
conditions:
- condition: trigger
id: 't3'
- condition: state
entity_id: !input trigger_entities
match: any
state: !input trigger_off_state
sequence:
- alias: "Wait the number of seconds set in the time delay"
delay: !input time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ switch_entities }}"
- choose:
- alias: "Check if automation link is enable"
conditions:
- condition: template
value_template: "{{ include_automation_link == 'enable_automation_link' }}"
sequence:
- service: homeassistant.turn_off
entity_id: !input automation_link
- choose:
- alias: "Check if ambient is enable"
conditions:
- condition: template
value_template: "{{ include_ambient == 'ambient_enabled' }}"
- condition: state
entity_id: !input scene_toggle_helper
state: "on"
sequence:
- alias: "Turn off the boolean for scenes"
service: input_boolean.turn_off
data:
entity_id: !input scene_toggle_helper
- stop: "Stop the automation"
- choose:
- alias: "Check end light switch, create a snapshot is enabled and create a snapshot of the entities in end light switch"
conditions:
- condition: template
value_template: "{{ include_end_turn_on == 'enable_end_turn_on_snapshot' }}"
- condition: state
entity_id: !input end_snapshot_helper
state: "off"
sequence:
- alias: "Create a snapshot of end lights & switches"
service: scene.create
data:
scene_id: !input end_snapshot_name
snapshot_entities: "{{ end_scene_create }}"
- alias: "Turne on end snapshot helper"
service: homeassistant.turn_on
entity_id: !input end_snapshot_helper
- choose:
- alias: "Check turn off lights & switches is enabled and turn off lights that are on"
conditions:
- condition: template
value_template: "{{ include_start_turn_off == 'enable_start_turn_off' }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in off_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ off_light_entities_on }}"
data:
transition: "{{ off_transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in off_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ off_light_entities_on }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ off_switch_entities_on }}"
- choose:
- alias: "Check trigger intermission is enabled and turn intermission lights off"
conditions:
- condition: template
value_template: "{{ 'intermission_enable' in include_intermission }}"
sequence:
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in intermission_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ crossover_intermission_light }}"
data:
transition: "{{ intermission_transition_off_value }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input intermission_end_scenes
data:
transition: "{{ intermission_transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in intermission_include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ crossover_intermission_light }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input intermission_end_scenes
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ crossover_intermission_switch }}"
- choose:
- alias: "Check if automation link is enable"
conditions:
- condition: template
value_template: "{{ include_automation_link == 'enable_automation_link' }}"
- condition: state
entity_id: !input automation_link
match: any
state: "off"
sequence:
- service: homeassistant.turn_on
entity_id: !input automation_link
- alias: "We need a delay for the automation link to work if different lights are used and by-pass selection is OFF"
delay: 0.1
- choose:
- alias: "Check if ambient is enable"
conditions:
- condition: template
value_template: "{{ include_ambient == 'ambient_enabled' }}"
- condition: state
entity_id: !input scene_toggle_helper
state: "off"
sequence:
- alias: "Turn off the boolean for scenes"
service: input_boolean.turn_on
data:
entity_id: !input scene_toggle_helper
- choose:
- alias: "Set the transition for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
- alias: "Set the transition and brightness for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
- alias: "Set the transition and colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
kelvin: "{{temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_on_value }}"
brightness_pct: "{{ brightness_value }}"
kelvin: "{{temperature_value}}"
- alias: "Set the brightness for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
- alias: "Set the colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
kelvin: "{{temperature_value}}"
- alias: "Set the brightness and colour temperature for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' in include_light_control) and ('use_colour_temperature' in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data:
brightness_pct: "{{ brightness_value }}"
kelvin: "{{temperature_value}}"
- alias: "Set the default for the normal lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in include_light_control) and ('use_brightness' not in include_light_control) and ('use_colour_temperature' not in include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn on the scenes"
service: scene.turn_on
target:
entity_id: "{{ scene_entities }}"
data:
transition: "{{ transition_on_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn on the scenes"
service: scene.turn_on
target:
entity_id: "{{ scene_entities }}"
- alias: "Turn on the switches"
service: switch.turn_on
target:
entity_id: "{{ switch_entities }}"
- choose:
- alias: "By-pass is turned on & turn on automation"
conditions:
- condition: trigger
id: 't2'
- "{{ (include_bypass == 'bypass_enabled_turn_on_automations') }}"
sequence:
- stop: "Stop the automation"
- alias: "Wait until trigger is off"
wait_for_trigger:
platform: state
entity_id: !input trigger_entities
to: !input trigger_off_state
- alias: "Wait the number of seconds set in the time delay"
delay: !input time_delay
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
data:
transition: "{{ transition_off_value }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
data:
transition: "{{ transition_off_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in include_light_control }}"
sequence:
- alias: "Turn off the lights"
service: light.turn_off
target:
entity_id: "{{ light_entities }}"
- alias: "Turn off the scenes"
service: scene.turn_on
entity_id: !input end_scenes
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ switch_entities }}"
- choose:
- alias: "Check if end turn ON is enable & option Enable to create a snapshot - Lights - Switches"
conditions:
- condition: template
value_template: "{{ include_end_turn_on == 'enable_end_turn_on_snapshot' }}"
- condition: state
entity_id: !input end_snapshot_helper
state: "on"
sequence:
- alias: "turn on the scene created"
service: scene.turn_on
target:
entity_id: "scene.{{end_snapshot_name }}"
- alias: "Turn on end snapshot helper"
service: homeassistant.turn_off
entity_id: !input end_snapshot_helper
- alias: "Check if end turn ON is enable & option Enable to turn ON - Lights - Switches - Scenes"
conditions:
- condition: template
value_template: "{{ include_end_turn_on == 'enable_end_turn_on' }}"
sequence:
- choose:
- alias: "Set the transition for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
- alias: "Set the transition and brightness for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
brightness_pct: "{{ end_brightness_value }}"
- alias: "Set the transition and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the transition, brightness and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
transition: "{{ end_transition_on_value }}"
brightness_pct: "{{ end_brightness_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the brightness for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
brightness_pct: "{{ end_brightness_value }}"
- alias: "Set the colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
kelvin: "{{end_temperature_value}}"
- alias: "Set the brightness and colour temperature for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' in end_include_light_control) and ('use_colour_temperature' in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data:
brightness_pct: "{{ end_brightness_value }}"
kelvin: "{{end_temperature_value}}"
- alias: "Set the default for the end lights switch"
conditions:
- condition: template
value_template: "{{ ('use_transition' not in end_include_light_control) and ('use_brightness' not in end_include_light_control) and ('use_colour_temperature' not in end_include_light_control) }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
- choose:
- alias: "If transition is selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' in end_include_light_control }}"
sequence:
- alias: "Turn on the end scenes"
service: scene.turn_on
target:
entity_id: "{{ end_scene_entities }}"
data:
transition: "{{ end_transition_on_value }}"
- alias: "If transition is not selected"
conditions:
- condition: template
value_template: "{{ 'use_transition' not in end_include_light_control }}"
sequence:
- alias: "Turn on the end scenes"
service: scene.turn_on
target:
entity_id: "{{ end_scene_entities }}"
- alias: "Turn on the end switches"
service: switch.turn_on
target:
entity_id: "{{ end_switch_entities_off }}"
- alias: "Turn off the end script"
service: script.turn_on
data:
entity_id: "{{ end_script_entities }}"
- choose:
- alias: "Check if automation link is enable"
conditions:
- condition: template
value_template: "{{ include_automation_link == 'enable_automation_link' }}"
- condition: state
entity_id: !input automation_link
match: any
state: "on"
sequence:
- service: homeassistant.turn_off
entity_id: !input automation_link
- choose:
- alias: "Check if ambient is enable"
conditions:
- condition: template
value_template: "{{ include_ambient == 'ambient_enabled' }}"
- condition: state
entity_id: !input scene_toggle_helper
state: "on"
sequence:
- alias: "Turn off the boolean for scenes"
service: input_boolean.turn_off
data:
entity_id: !input scene_toggle_helper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment