I would like todo an IF formula based on my select options (jc_control:)
Cant figure it out. thanks for the help
blueprint:
name: ScriptLightON live
description: Turn on lights Living
domain: script
author: JC Dreyfus
#icon: mdi:lightbulb
input:
light_target:
name: Light #!input light_target
selector:
entity:
domain:
- light
jc_control:
name: Use The Light Control Options
description: Light Control Options
default: []
selector:
select:
multiple: false
options:
- label: Use Only Brightness
value: use_brightness
- label: Use Color Temperature Kelvin
value: use_color_tempetature
- label: Use Color Name
value: use_color_name
- label: Use Color RGB
value: use_color_rgb
- label: Use Color HS
value: use_color_hs
light_brightness:
name: Brightness
description: The brightness setting for the lights when they are turned ON.
default: 35
selector:
number:
min: 1
max: 100
mode: box
step: 1
unit_of_measurement: '%'
light_color_kelvin:
name: Color Temperature
description: in Kelvin
default: 4600
selector:
number:
min: 2000
max: 8000
mode: box
step: 100
unit_of_measurement: 'kelvin'
light_color:
name: Color Name
description: The Color Name
default:
selector:
text:
light_color_rgb:
name: Color RGB
description: The colour temperature setting for the lights when they are turned ON.
default:
selector:
color_rgb:
light_color_hs:
name: Color HS
description: The colour temperature setting for the lights when they are turned ON.
default:
selector:
object:
#variables:
# light_target: !input light_target
# use_brightness: !input use_brightness
alias: "Lights On"
sequence:
- if:
- condition: state
entity_id: !input jc_control
state: use_brightness
then:
- data:
brightness_pct: !input light_brightness
color_temp: !input light_color_kelvin
continue_on_error: true
target:
entity_id: !input light_target
action: light.turn_on
mode: restart
max_exceeded: silent
icon: mdi:lightbulb
TBH I have mostly abandoned the If statements stuff and use the choose statements instead, I would suggest that method… Script Syntax - Home Assistant.
I think the issue is you are treating jc_control like an entity, but it’s just a string (it’s not an input_select if that’s what your thinking).
I think you can use a template condition to check the value like below. I think in order To use jc_control in a template, you have to store it in a variable.
im having issiu using choice also. what am I doing wrong?
also I get this erro:
Message malformed: extra keys not allowed @ data[‘actions’]
blueprint:
name: ScriptLightON live2b
description: Turn on lights Living
domain: script
author: JC Dreyfus
#icon: mdi:lightbulb
input:
light_target:
name: Light #!input light_target
selector:
entity:
domain:
- light
jc_control:
name: Use The Light Control Options
description: Light Control Options
default: []
selector:
select:
multiple: false
options:
- label: 'Use Only Brightness'
value: 'use_brightness'
- label: Use Color Temperature Kelvin
value: use_color_tempetature
- label: Use Color Name
value: use_color_name
- label: Use Color RGB
value: use_color_rgb
- label: Use Color HS
value: use_color_hs
light_brightness:
name: Brightness
description: The brightness setting for the lights when they are turned ON.
default: 35
selector:
number:
min: 1
max: 100
mode: box
step: 1
unit_of_measurement: '%'
light_color_kelvin:
name: Color Temperature
description: in Kelvin
default: 4600
selector:
number:
min: 2000
max: 8000
mode: box
step: 100
unit_of_measurement: 'kelvin'
light_color:
name: Color Name
description: The Color Name
default:
selector:
text:
light_color_rgb:
name: Color RGB
description: The colour temperature setting for the lights when they are turned ON.
default:
selector:
color_rgb:
light_color_hs:
name: Color HS
description: The colour temperature setting for the lights when they are turned ON.
default:
selector:
object:
actions:
- choose:
- conditions:
- condition: "{{ states(jc_control)== 'use_brightness' }}"
sequence:
- action: light.turn_on
data:
brightness: 100
target:
entity_id: !input light_target
mode: restart
max_exceeded: silent
icon: mdi:lightbulb
Message malformed: extra keys not allowed @ data[‘actions’]
blueprint:
name: ScriptLightON live2b
description: Turn on lights Living
domain: script
author: JC Dreyfus
#icon: mdi:lightbulb
input:
light_target:
name: Light #!input light_target
selector:
entity:
domain:
- light
jc_control:
name: Use The Light Control Options
description: Light Control Options
default: []
selector:
select:
multiple: false
options:
- label: 'Use Only Brightness'
value: 'use_brightness'
- label: Use Color Temperature Kelvin
value: use_color_tempetature
- label: Use Color Name
value: use_color_name
- label: Use Color RGB
value: use_color_rgb
- label: Use Color HS
value: use_color_hs
light_brightness:
name: Brightness
description: The brightness setting for the lights when they are turned ON.
default: 35
selector:
number:
min: 1
max: 100
mode: box
step: 1
unit_of_measurement: '%'
light_color_kelvin:
name: Color Temperature
description: in Kelvin
default: 4600
selector:
number:
min: 2000
max: 8000
mode: box
step: 100
unit_of_measurement: 'kelvin'
light_color:
name: Color Name
description: The Color Name
default:
selector:
text:
light_color_rgb:
name: Color RGB
description: The colour temperature setting for the lights when they are turned ON.
default:
selector:
color_rgb:
light_color_hs:
name: Color HS
description: The colour temperature setting for the lights when they are turned ON.
default:
selector:
object:
actions:
- choose:
- conditions:
- condition: state
entity_id: light.bednightstand
state: "on"
# - condition: "{{ states(jc_control)== 'use_brightness' }}"
sequence:
- action: light.turn_on
data:
brightness: 100
target:
entity_id: !input light_target
mode: restart
max_exceeded: silent
icon: mdi:lightbulb
If you read the entire thread here, a couple of people told you how to fix that I believe.
jc_control is a string, it doesn’t have a state.
If you want it in a template, you need to use a variable statement. Blueprints: Get your !input value into a template.