Can someone explain to me why code 1 works, but code 2 doesn’t? It should produce the same command fed to the service … according to dev tools > templates
I either get
input_boolean.turn_on
or
input_boolean.turn_off
in both cases.
#code1
- service: >
{% if 'hold' in command %}
input_boolean.turn_on
{% else %}
input_boolean.turn_off
{% endif %}
Vs.
#code2
- service: >
input_boolean.turn_{{ 'on' if 'hold' in command else 'off' }}
None… I can safely reload my automations without errors but the automation stops working.
And that is the only change made in the automation
And makes the difference from working to non working
Alright thank you once again, I’ve narrowed down the culprit.
It wasn’t the service at all, was just unfortunate enough to try the code change
with different circumstances (light was on as opposed to off) which showed me an unrelated fault in my code
nice feature, wasnt even aware of tracing before this!