phairplay
(Phairplay)
February 17, 2018, 11:32am
1
hi im trying to put together my first if else state sensor and having no luck.
could someone please kindly tell me what im doing wrong?
download:
alias: 'Nzbget Download'
sequence:
- service: tts.google_say
data_template:
entity_id: media_player.main_gh
message: >
{% if states.sensor.nzbget_speed.state | float < 0}
Yes the server is downloading.
{% elif states.sensor.nzbget_speed.state |float = 0}
No nothing is currently downloading.
{% else %}
Not quite sure what happened here.
{% endif %}
VDRainer
(🍻)
February 17, 2018, 12:17pm
2
You’re missing the percent characters at the end of the jinja.
{% if states.sensor.nzbget_speed.state | float < 0 %}
Just copy and paste the whole template in Dev Tools/templates and you will see what you get.
1 Like
And you need to indent the stuff under data_template :
download:
alias: 'Nzbget Download'
sequence:
- service: tts.google_say
data_template:
entity_id: media_player.main_gh
message: >
{% if states.sensor.nzbget_speed.state | float < 0 %}
Yes the server is downloading.
{% elif states.sensor.nzbget_speed.state |float = 0 %}
No nothing is currently downloading.
{% else %}
Not quite sure what happened here.
{% endif %}
1 Like