Skip to content

Instantly share code, notes, and snippets.

@Blackshome
Last active August 3, 2024 16:10
Show Gist options
  • 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.2**
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)** 🙂
<details>
<summary><b>The Automation Process:</b> 👈</summary>
- **Use Case:**
- 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.
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, scenes and scripts 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, RGB colour settings, or selecting specific scenes or scripts. 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, scenes or scripts 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?
- FAQ: [Click Here](https://community.home-assistant.io/t/591824/2?u=blacky)
- Community Support Including Updates: [Click Here](https://community.home-assistant.io/t/591824?u=blacky)
Required = *
domain: automation
input:
trigger:
name: "Trigger *"
icon: mdi:cog-outline
collapsed: true
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.
default: []
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.
default: []
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 when these apps are in use.
A list of apps is provided in the dropdown menu.
If your app is not listed or 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.
default: []
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, thus keeping you in the current mode.
default: 1.5
selector:
number:
min: 0
max: 10
step: 0.5
unit_of_measurement: seconds
lights_start_turn_off:
name: "Lights OFF at Start"
icon: mdi:lightbulb-off-outline
collapsed: true
input:
include_start_turn_off:
name: Use the Start Turn OFF Options (Optional)
description: Turn OFF any lights that are ON that are not needed for the movie lights.
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 to turn OFF when the automation begins.
**NOTE** - You can only use entities. Areas, devices and labels 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
lights_settings:
name: "Movie Lights *"
icon: mdi:movie-play-outline
collapsed: true
input:
light_switch:
name: Lights - Switches - Scenes - Scripts *
description: Enter the lights, switches, scenes, and scripts to activate based on the **Trigger - ON State** settings.
When an entity is triggered to the **Trigger - ON State**, these specified entities will turn ON.
For details on turning scenes or scripts OFF, see the **Scenes & Scripts To Turn OFF** section below.
**NOTE** - You can only use entities. Areas, devices and labels are not supported.
default: []
selector:
target:
entity:
domain:
- light
- switch
- scene
- script
end_scenes:
name: Scenes & Scripts To Turn OFF
description: If you've opted to activate a scene or script in either the **Lights - Switches - Scenes - Scripts** or
in **Intermission - Lights - Switches - Scenes - Scripts** sections and wish for the entities to turn OFF afterwards,
you'll need to create an additional scene or script. This scene or scrip should include all the entities (e.g., lights, switches, etc.)
utilized in those scenes or scripts, ensuring they're turned OFF. Then input the scene or script here.
default: []
selector:
entity:
multiple: true
filter:
domain:
- scene
- script
include_light_control:
name: Use The Light Control Options (Optional)
description: Select if you would like to use brightness or transition.
These settings will only affect a 'light' entity that supports each selected option.
The settings for brightness and transition are provided below.
default: []
selector:
select:
multiple: true
options:
- label: Use Brightness
value: "use_brightness"
- 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_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_light_colour_control:
name: Use The Light Colour Control Options (Optional)
description: Select if you would like to use colour temperature, RGB, RGBW or RGBWW colour.
These settings will only affect a 'light' entity that supports each selected option.
The settings for colour temperature, RGB, RGBW and RGBWW colour are provided below.
default: disable_colour_control
selector:
select:
options:
- label: Use Colour Temperature
value: "use_colour_temperature"
- label: Use RGB Colour
value: "use_rgb_colour"
- label: Use RGBW Colour
value: "use_rgbw_colour"
- label: Use RGBWW Colour
value: "use_rgbww_colour"
- label: Disable Colour Control
value: "disable_colour_control"
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_rgb_colour:
name: RGB Colour
description: The RGB colour setting for the lights when they are turned ON.
default: [255, 255, 255]
selector:
color_rgb:
light_rgbw_colour:
name: RGBW Colour
description: The RGBW colour setting for the lights when they are turned ON.
Enter four integers between 0 and 255 to define the values for Red, Green, Blue, and White.
default: [255, 255, 255, 255]
selector:
object:
light_rgbww_colour:
name: RGBWW Colour
description: The RGBWW colour setting for the lights when they are turned ON.
Enter five integers between 0 and 255 to define the values for Red, Green, Blue, Cold White and Warm White.
default: [255, 255, 255, 255, 255]
selector:
object:
lights_intermission:
name: "Intermission Lights"
icon: mdi:lightbulb-on-50
collapsed: true
input:
include_intermission:
name: Use The Intermission Option (Optional)
description: Intermission allows for flexible lighting adjustments, including turning on different lights, adjusting brightness levels, changing colour temperature, RGB colour settings, or selecting specific scenes or scripts.
It's particularly useful for setting slightly brighter lights during a movie intermission. Additionally, it can activate or deactivate lights, switches, scenes, or scripts 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, type it in and press enter.
**Note** - The selected state cannot match any 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 - Scripts
description: The lights, switches, scenes and scripts to activate during intermission mode.
If adding a scene or script, please refer to the **Intermission - Scenes & Scripts To Turn OFF** section below.
**NOTE** - You can only use entities. Areas, devices and labels are not supported.
default: {}
selector:
target:
entity:
domain:
- light
- switch
- scene
- script
intermission_end_scenes:
name: Intermission - Scenes & Scripts To Turn OFF
description: If you've activated a scene or script in **Intermission - Lights - Switches - Scenes - Scripts**
that involves different entities (e.g., lights, switches) from those in **Lights - Switches - Scenes - Scripts**
above, create an additional scene or script to include these different entities and ensure they are turned OFF.
Enter that scene or script here.
**NOTE** - If the entities are the same as those used in **Intermission - Lights - Switches - Scenes - Scripts**, you can leave this input blank.
default: []
selector:
entity:
multiple: true
filter:
domain:
- scene
- script
intermission_include_light_control:
name: Use The Light Control Options (Optional)
description: Select if you would like to use brightness or transition.
These settings will only affect a 'light' entity that supports each selected option.
The settings for brightness and transition are provided below.
default: []
selector:
select:
multiple: true
options:
- label: Use Brightness
value: "use_brightness"
- label: Use Transition
value: "use_transition"
intermission_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: '%'
intermission_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
intermission_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
intermission_include_light_colour_control:
name: Use The Light Colour Control Options (Optional)
description: Select if you would like to use colour temperature, RGB, RGBW or RGBWW colour.
These settings will only affect a 'light' entity that supports each selected option.
The settings for colour temperature, RGB, RGBW and RGBWW colour are provided below.
default: disable_colour_control
selector:
select:
options:
- label: Use Colour Temperature
value: "use_colour_temperature"
- label: Use RGB Colour
value: "use_rgb_colour"
- label: Use RGBW Colour
value: "use_rgbw_colour"
- label: Use RGBWW Colour
value: "use_rgbww_colour"
- label: Disable Colour Control
value: "disable_colour_control"
intermission_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'
intermission_light_rgb_colour:
name: RGB Colour
description: The RGB colour setting for the lights when they are turned ON.
default: [255, 255, 255]
selector:
color_rgb:
intermission_light_rgbw_colour:
name: RGBW Colour
description: The RGBW colour setting for the lights when they are turned ON.
Enter four integers between 0 and 255 to define the values for Red, Green, Blue, and White.
default: [255, 255, 255, 255]
selector:
object:
intermission_light_rgbww_colour:
name: RGBWW Colour
description: The RGBWW colour setting for the lights when they are turned ON.
Enter five integers between 0 and 255 to define the values for Red, Green, Blue, Cold White and Warm White.
default: [255, 255, 255, 255, 255]
selector:
object:
lights_end_turn_on:
name: "Lights ON at End"
icon: mdi:lightbulb-on-outline
collapsed: true
input:
include_end_turn_on:
name: Use the End Turn ON Options (Optional)
description: You have the option to specify the lights, switches, scenes or scripts that will be activated when the automation ends.
You can either create a snapshot of your lights and switches to return them to their previous state before the automation started or select specific lights, switches, scenes or scripts to turn on.
**Note** - If you choose to create a snapshot, ensure you provide a unique snapshot name, create a toggle helper, and specify the lights and switches to include in the snapshot.
This ensures the snapshot feature functions correctly.
The settings for this are detailed 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 opted to create a snapshot of your lights and switches, make sure to provide a unique name for the snapshot.
Each automation using this blueprint with snapshots must have a distinct name created here.
**Note** - The name must be in lowercase and use "_" for spaces.
For 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 chosen to create a snapshot of your lights and switches, you must create a toggle helper and enter it here.
The toggle helper should be in the OFF state when the automation begins.
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 have chosen to create a snapshot, input the lights and switches you wish to include in the snapshot.
Note that scenes and scripts cannot be included in a snapshot.
**NOTE** - You can only use entities. Areas, devices and labels are not supported.
default: {}
selector:
target:
entity:
domain:
- light
- switch
- scene
- script
end_include_light_control:
name: Use The Light Control Options (Optional)
description: Select if you would like to use brightness or transition.
These settings will only affect a 'light' entity that supports each selected option.
The settings for brightness and transition are provided below.
default: []
selector:
select:
multiple: true
options:
- label: Use Brightness
value: "use_brightness"
- label: Use Transition
value: "use_transition"
end_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: '%'
end_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
end_include_light_colour_control:
name: Use The Light Colour Control Options (Optional)
description: Select if you would like to use colour temperature, RGB, RGBW or RGBWW colour.
These settings will only affect a 'light' entity that supports each selected option.
The settings for colour temperature, RGB, RGBW and RGBWW colour are provided below.
default: disable_colour_control
selector:
select:
options:
- label: Use Colour Temperature
value: "use_colour_temperature"
- label: Use RGB Colour
value: "use_rgb_colour"
- label: Use RGBW Colour
value: "use_rgbw_colour"
- label: Use RGBWW Colour
value: "use_rgbww_colour"
- label: Disable Colour Control
value: "disable_colour_control"
end_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'
end_light_rgb_colour:
name: RGB Colour
description: The RGB colour setting for the lights when they are turned ON.
default: [255, 255, 255]
selector:
color_rgb:
end_light_rgbw_colour:
name: RGBW Colour
description: The RGBW colour setting for the lights when they are turned ON.
Enter four integers between 0 and 255 to define the values for Red, Green, Blue, and White.
default: [255, 255, 255, 255]
selector:
object:
end_light_rgbww_colour:
name: RGBWW Colour
description: The RGBWW colour setting for the lights when they are turned ON.
Enter five integers between 0 and 255 to define the values for Red, Green, Blue, Cold White and Warm White.
default: [255, 255, 255, 255, 255]
selector:
object:
automation_link:
name: "Automation Link"
icon: mdi:link-variant
collapsed: true
input:
include_automation_link:
name: Use The Automation Link Option (Optional)
description: This feature allows you to automatically disable other automations,
which is especially useful if you are using my blueprints (e.g., [Sensor Light](https://community.home-assistant.io/t/481048))
to manage lights, switches, scenes or scripts and want to deactivate it while this automation is active.
For more information on using 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: To disable other automations when this automation is ON, enter an independent input boolean
created for this purpose here and also into the bypass input of the automations you want to disable.
For more information on using the automation link option, refer to the link above.
default: []
selector:
entity:
multiple: true
filter:
domain:
- input_boolean
sun_settings:
name: "Sun Elevation"
icon: mdi:weather-sunny
collapsed: true
input:
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.
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
ambient_settings:
name: "Ambient"
icon: mdi:theme-light-dark
collapsed: true
input:
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 or script without any entities into **Lights - Switches - Scenes - Scripts** or **Intermission - Lights - Switches - Scenes - Scripts** above.
default: []
selector:
entity:
filter:
domain:
- input_boolean
bypass_settings:
name: "Bypass"
icon: mdi:cog-pause-outline
collapsed: true
input:
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
time_delay: !input time_delay
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
light_switch: !input light_switch
end_scenes: !input end_scenes
include_light_control: !input include_light_control
light_brightness: !input light_brightness
light_transition_on: !input light_transition_on
light_transition_off: !input light_transition_off
include_light_colour_control: !input include_light_colour_control
light_colour_temperature: !input light_colour_temperature
light_rgb_colour: !input light_rgb_colour
light_rgbw_colour: !input light_rgbw_colour
light_rgbww_colour: !input light_rgbww_colour
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_light_transition_on: !input intermission_light_transition_on
intermission_light_transition_off: !input intermission_light_transition_off
intermission_include_light_colour_control: !input intermission_include_light_colour_control
intermission_light_colour_temperature: !input intermission_light_colour_temperature
intermission_light_rgb_colour: !input intermission_light_rgb_colour
intermission_light_rgbw_colour: !input intermission_light_rgbw_colour
intermission_light_rgbww_colour: !input intermission_light_rgbww_colour
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_light_transition_on: !input end_light_transition_on
end_include_light_colour_control: !input end_include_light_colour_control
end_light_colour_temperature: !input end_light_colour_temperature
end_light_rgb_colour: !input end_light_rgb_colour
end_light_rgbw_colour: !input end_light_rgbw_colour
end_light_rgbww_colour: !input end_light_rgbww_colour
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 }}"
script_entities: "{{ expand(light_switch.entity_id) | selectattr('domain', 'eq', 'script') | map(attribute='entity_id') | list }}"
# For movie lights - Light data
light_data: >-
{% set light = namespace(data={}) %}
{% if 'use_transition' in include_light_control %}
{% set light.data = dict(light.data, **{ 'transition': light_transition_on }) %}
{% endif %}
{% if 'use_brightness' in include_light_control %}
{% set light.data = dict(light.data, **{ 'brightness_pct': light_brightness }) %}
{% endif %}
{% if include_light_colour_control == 'use_colour_temperature' %}
{% set light.data = dict(light.data, **{ 'color_temp_kelvin': light_colour_temperature }) %}
{% endif %}
{% if include_light_colour_control == 'use_rgb_colour' %}
{% set light.data = dict(light.data, **{ 'rgb_color': light_rgb_colour }) %}
{% endif %}
{% if include_light_colour_control == 'use_rgbw_colour' %}
{% set light.data = dict(light.data, **{ 'rgbw_color': light_rgbw_colour }) %}
{% endif %}
{% if include_light_colour_control == 'use_rgbww_colour' %}
{% set light.data = dict(light.data, **{ 'rgbww_color': light_rgbww_colour }) %}
{% endif %}
{{ light.data }}
# 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 scenes and scripts
end_scene_entities_turn_off: "{{ end_scenes | select('match', '^scene\\..*') | list }}"
end_script_entities_turn_off: "{{ end_scenes | select('match', '^script\\..*') | list }}"
# 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 %}
# For end lights - Light data
end_light_data: >-
{% set light = namespace(data={}) %}
{% if 'use_transition' in end_include_light_control %}
{% set light.data = dict(light.data, **{ 'transition': end_light_transition_on }) %}
{% endif %}
{% if 'use_brightness' in end_include_light_control %}
{% set light.data = dict(light.data, **{ 'brightness_pct': end_light_brightness }) %}
{% endif %}
{% if end_include_light_colour_control == 'use_colour_temperature' %}
{% set light.data = dict(light.data, **{ 'color_temp_kelvin': end_light_colour_temperature }) %}
{% endif %}
{% if end_include_light_colour_control == 'use_rgb_colour' %}
{% set light.data = dict(light.data, **{ 'rgb_color': end_light_rgb_colour }) %}
{% endif %}
{% if end_include_light_colour_control == 'use_rgbw_colour' %}
{% set light.data = dict(light.data, **{ 'rgbw_color': end_light_rgbw_colour }) %}
{% endif %}
{% if end_include_light_colour_control == 'use_rgbww_colour' %}
{% set light.data = dict(light.data, **{ 'rgbww_color': end_light_rgbww_colour }) %}
{% endif %}
{{ light.data }}
# 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 end scenes and scripts
intermission_end_scenes_scene: "{{ intermission_end_scenes | select('match', '^scene\\..*') | list }}"
intermission_end_scenes_script: "{{ intermission_end_scenes | select('match', '^script\\..*') | list }}"
# 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 %}
intermission_script_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', 'script') | map(attribute='entity_id') | list }}
{% else %}
[]
{% endif %}
# For intermission lights - Light data
intermission_light_data: >-
{% set light = namespace(data={}) %}
{% if 'use_transition' in intermission_include_light_control %}
{% set light.data = dict(light.data, **{ 'transition': intermission_light_transition_on }) %}
{% endif %}
{% if 'use_brightness' in intermission_include_light_control %}
{% set light.data = dict(light.data, **{ 'brightness_pct': intermission_light_brightness }) %}
{% endif %}
{% if intermission_include_light_colour_control == 'use_colour_temperature' %}
{% set light.data = dict(light.data, **{ 'color_temp_kelvin': intermission_light_colour_temperature }) %}
{% endif %}
{% if intermission_include_light_colour_control == 'use_rgb_colour' %}
{% set light.data = dict(light.data, **{ 'rgb_color': intermission_light_rgb_colour }) %}
{% endif %}
{% if intermission_include_light_colour_control == 'use_rgbw_colour' %}
{% set light.data = dict(light.data, **{ 'rgbw_color': intermission_light_rgbw_colour }) %}
{% endif %}
{% if intermission_include_light_colour_control == 'use_rgbww_colour' %}
{% set light.data = dict(light.data, **{ 'rgbww_color': intermission_light_rgbww_colour }) %}
{% endif %}
{{ light.data }}
# Set up crossover lights for T1 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 T5 & T7 + Intermission. 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
match: any
attribute: app_id
state: !input app_attribute
- condition: state # For Chromecast TV apps, Apple TV if used
entity_id: !input trigger_entities
match: any
attribute: app_name
state: !input app_attribute
- condition: state # For PlayStation
entity_id: !input trigger_entities
match: any
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: !input light_transition_off
- alias: "Turn off the scenes"
service: scene.turn_on
data:
entity_id: "{{ end_scene_entities_turn_off }}"
transition: !input light_transition_off
- 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
data:
entity_id: "{{ end_scene_entities_turn_off }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ crossover_switch }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ end_script_entities_turn_off }}"
- service: light.turn_on
target:
entity_id: "{{ intermission_light_entities }}"
data: "{{ intermission_light_data }}"
- 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: !input intermission_light_transition_on
- 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: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ intermission_script_entities }}"
- 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: !input intermission_light_transition_off
- alias: "Turn off the scenes"
service: scene.turn_on
data:
entity_id: "{{ end_scene_entities_turn_off }}"
transition: !input intermission_light_transition_off
- 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
data:
entity_id: "{{ end_scene_entities_turn_off }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ intermission_switch_entities }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ end_script_entities_turn_off }}"
- 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:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data: "{{ end_light_data }}"
- 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: !input end_light_transition_on
- 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: !input intermission_light_transition_off
- alias: "Turn off the scenes"
service: scene.turn_on
data:
entity_id: "{{ intermission_end_scenes_scene }}"
transition: !input intermission_light_transition_off
- 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
data:
entity_id: "{{ intermission_end_scenes_scene }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ crossover_intermission_switch }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ intermission_end_scenes_script }}"
- 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: !input light_transition_off
- alias: "Turn off the scenes"
service: scene.turn_on
data:
entity_id: "{{ end_scene_entities_turn_off }}"
transition: !input light_transition_off
- 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
data:
entity_id: "{{ end_scene_entities_turn_off }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ switch_entities }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ end_script_entities_turn_off }}"
- 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:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data: "{{ end_light_data }}"
- 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: !input end_light_transition_on
- 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: !input light_transition_off
- alias: "Turn off the scenes"
service: scene.turn_on
data:
entity_id: "{{ end_scene_entities_turn_off }}"
transition: !input light_transition_off
- 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
data:
entity_id: "{{ end_scene_entities_turn_off }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ switch_entities }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ end_script_entities_turn_off }}"
- 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:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data: "{{ end_light_data }}"
- 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: !input end_light_transition_on
- 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' }}"
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: !input off_light_transition_off
- 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: !input intermission_light_transition_off
- alias: "Turn off the scenes"
service: scene.turn_on
data:
entity_id: "{{ intermission_end_scenes_scene }}"
transition: !input intermission_light_transition_off
- 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
data:
entity_id: "{{ intermission_end_scenes_scene }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ crossover_intermission_switch }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ intermission_end_scenes_script }}"
- 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
- service: light.turn_on
target:
entity_id: "{{ light_entities }}"
data: "{{ light_data }}"
- 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: !input light_transition_on
- 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 }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ script_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: !input light_transition_off
- alias: "Turn off the scenes"
service: scene.turn_on
data:
entity_id: "{{ end_scene_entities_turn_off }}"
transition: !input light_transition_off
- 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
data:
entity_id: "{{ end_scene_entities_turn_off }}"
- alias: "Turn off the switches"
service: switch.turn_off
target:
entity_id: "{{ switch_entities }}"
- alias: "Turn on the scripts"
service: script.turn_on
target:
entity_id: "{{ end_script_entities_turn_off }}"
- 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:
- service: light.turn_on
target:
entity_id: "{{ end_light_entities }}"
data: "{{ end_light_data }}"
- 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: !input end_light_transition_on
- 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