When media_player.spotify is =! ‘play’ for X time do Y
Since I want a ‘is not’ I think I should use a template but then I can’t use the ‘for…’
If I’m not clear I want to do something like
- alias: tab_salon_auto
trigger:
platform: state
entity_id: media_player.nvidiashield
to: NOT 'play' #THIS IS HERE I NEED HELP
for:
hours: 1
minutes: 10
seconds: 5
action:
service: shell_command.stop
Not true anymore. I added the for: option to the template trigger in 0.95. And in 0.96 I added template support so you can use a template in the for: option if you want. See: Automation Trigger - Home Assistant
I don’t use media_player’s, so not sure. Is the state ‘play’, or is it in an attribute that you see that? Assuming it is the state:
The above will work in 0.95, which is when I added the for: option itself to the template trigger. In 0.96 I added the ability to use a template in the for: option. (I.e., in 0.96 you can use templates in the template trigger in both value_template:andfor:.) Since you’re not using a template in the for: option you don’t need to wait for 0.96.