ohh yes… a if else statement whaha… im using this lots of times… hahah
Thanks. Since the C-19 must stay home, so lots of time to dig into this!
I already learned things
I used this:
{% if (states.media_player.kodi.state) == 'playing' %} script.kodi_control_playing
{% elif (states.media_player.kodi.state) == 'paused' %} script.kodi_control_paused
{% else %} script.kodi_control_idle
{% endif %}
but correct way is this:
{% if states('media_player.kodi') == 'playing' %} script.kodi_control_playing
{% elif states('media_player.kodi') == 'paused' %} script.kodi_control_paused
{% else %} script.kodi_control_idle
{% endif %}
So gonna change my scripts…
Thanks for the link again.
Both ways are correct, it’s just that the second way won’t generate errors if the states are unknown. So it is better from a user perspective.
Its always nice to see a empty log file … sometimes you see a error that you not want to see
And its a nicer way of coding when you do it the right way…