I want to have a Slider that turn a lamp on for the amount of time I set at this Slider but it does not work.
The example at the bottom of this page does not pass the config check.
This one does pass the config check but the lamp turns off right after it turns on. It ignores the value set with the slider:
- id: '1568651650894'
alias: Lamp off
trigger:
- entity_id: switch.fritz_dect_200_2
for: 00:{{ states.input_number.minutes | int }}:00
platform: state
to: 'on'
action:
entity_id: switch.fritz_dect_200_2
service: switch.turn_off
for: "00:{{ states.input_number.minutes | int }}:00"
I can’t recall if this field accepts templates either. @pnbruckner added it to a few fields, I think this was one place. So it should pass config check now, but you may want to verify if it works.
Yes, thats it. Thanks alot!
I don’t understand why the Input Number docu does not describe it that way or why the suggested way there is not working but at least its working now
In the templates docs its suggested to avoid states.sensor.temperature.state and instead use states('sensor.temperature')
Why does for: ‘00:{{ states(‘input_number.minutes’) | int }}:00’ not pass the config check?
Yep, as you discovered, this field does support templates.
@Loader23, when the template was invalid or couldn’t be rendered, you should have gotten an error saying so. Did you? BTW, the validity of the template is not checked until run-time (unless there are basic YAML formatting issues, like incorrect/unbalanced quotes or something.)
BTW, if you pass just a number to the for: parameter it will be interpreted as seconds. So you could also do this:
Yes, I got this error with the incorrect quotes, but it didn’t help me to be honest
Error loading /config/configuration.yaml: while parsing a block mapping
in "/config/automations.yaml", line 28, column 5
expected <block end>, but found '<scalar>'
in "/config/automations.yaml", line 29, column 25