summaryrefslogtreecommitdiffstats
path: root/blueprints/automation/lights/light_button.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'blueprints/automation/lights/light_button.yaml')
-rw-r--r--blueprints/automation/lights/light_button.yaml50
1 files changed, 41 insertions, 9 deletions
diff --git a/blueprints/automation/lights/light_button.yaml b/blueprints/automation/lights/light_button.yaml
index 7aeb0ab..34116bc 100644
--- a/blueprints/automation/lights/light_button.yaml
+++ b/blueprints/automation/lights/light_button.yaml
@@ -15,6 +15,28 @@ blueprint:
selector:
entity:
domain: light
+ on_light:
+ name: On Light
+ description: Turn light on automatically or allow complex scenarios using 'on_click'
+ default: 'yes'
+ selector:
+ select:
+ options:
+ - label: Turn on lights automatically
+ value: 'yes'
+ - label: Manage lights using 'on_click' handler
+ value: 'no'
+ off_light:
+ name: Off Light
+ description: Turn light off automatically or allow complex scenarios using 'off_click'
+ default: 'yes'
+ selector:
+ select:
+ options:
+ - label: Turn off lights automatically
+ value: 'yes'
+ - label: Manage lights using 'off_click' handler
+ value: 'no'
temperature:
name: Temperature
description: Color Temperature
@@ -83,6 +105,8 @@ trigger:
variables:
state: !input state
hold: !input hold
+ light_on: !input on_light
+ light_off: !input off_light
# Can't do 'restart' since it will break wait_for_trigger
mode: single
@@ -104,19 +128,27 @@ action:
state: 'on'
then:
- parallel:
- - service: light.turn_off
- target:
- entity_id: !input light
+ - if:
+ - condition: template
+ value_template: '{{ light_off == "yes" }}'
+ then:
+ - service: light.turn_off
+ target:
+ entity_id: !input light
- choose: []
default: !input "off_click"
else:
- parallel:
- - service: light.turn_on
- data:
- brightness_pct: 100
- kelvin: !input temperature
- target:
- entity_id: !input light
+ - if:
+ - condition: template
+ value_template: '{{ light_on == "yes" }}'
+ then:
+ - service: light.turn_on
+ data:
+ brightness_pct: 100
+ kelvin: !input temperature
+ target:
+ entity_id: !input light
- choose: []
default: !input "on_click"