Last active
May 15, 2021 20:14
-
-
Save MrTechGadget/f9e39b34cb9ac4cc7397cfa5b9c6d142 to your computer and use it in GitHub Desktop.
Light Zone Action Blueprint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Light Zone action | |
description: Changes Light Color when a person leaves or enters a specific zone | |
domain: automation | |
input: | |
person_entity: | |
name: Person | |
description: The person you want to track | |
selector: | |
entity: | |
domain: person | |
zone_entity: | |
name: Zone | |
description: The zone you want to monitor | |
selector: | |
entity: | |
domain: zone | |
light_entity: | |
name: Light | |
description: The light you want to change color of | |
selector: | |
entity: | |
domain: light | |
brightness: | |
name: LED brightness | |
description: Brightness value to force when turning on the light | |
default: 64 | |
selector: | |
number: | |
min: 0 | |
max: 255 | |
step: 1 | |
unit_of_measurement: brightness | |
mode: slider | |
light_color_enter: | |
name: EnterColor | |
description: The color you want the light to change color to | |
selector: | |
text: | |
light_color_leave: | |
name: LeaveColor | |
description: The color you want the light to change color to | |
selector: | |
text: | |
source_url: https://gist.githubusercontent.com/MrTechGadget/f9e39b34cb9ac4cc7397cfa5b9c6d142/raw/09d1447b7d8cad60094b7da80cbcf4dcded851fe/light-zone-interaction.yaml | |
trigger: | |
platform: state | |
entity_id: !input person_entity | |
variables: | |
zone_entity: !input zone_entity | |
# This is the state of the person when it's in this zone. | |
zone_state: "{{ states[zone_entity].name }}" | |
person_entity: !input person_entity | |
person_name: "{{ states[person_entity].name }}" | |
#light_entity: !input light_entity | |
#brightness: !input brightness | |
#light_color_enter: !input light_color_enter | |
#light_color_leave: !input light_color_leave | |
action: | |
- choose: | |
- condition: | |
condition: template | |
value_template: "{{ trigger.from_state.state != zone_state and trigger.to_state.state == zone_state }}" | |
sequence: | |
- service: light.turn_on | |
target: !input light_entity | |
data: | |
color_name: !input light_color_enter | |
brightness: !input brightness | |
- condition: | |
condition: template | |
value_template: "{{ trigger.from_state.state == zone_state and trigger.to_state.state != zone_state }}" | |
sequence: | |
- service: light.turn_on | |
target: !input light_entity | |
data: | |
color_name: !input light_color_leave | |
brightness: !input brightness | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment