I’ve created a 3 scripts to turn on my AMP via IR when a specific Alexa is being used. One to turn it on when that Alaexa is “Playing”, one to turn it off after 1 minute is it’s in “Pause” state, and one to turn it off if it’s in “stanby” state/
But now what happens is it triggers after it turns off since the trigger is still valid. So is there a way to run the OFF triggers once and then reset them once the ON is triggered?
Notice in the trigger definition that the trigger is only true when the state changes “to: ‘playing’”. It doesn’t stay true at any time other than that very instant when the state of the media_player changes to that state. IOW, the trigger doesn’t ever “stay true” it is only true at one instant in time when the state changes.
If the automation is firing again there is something else going on causing the trigger to become true again. That can only happen when the state changes from any other state to “playing”, “paused” or “standby”.
I would say that it might be in the interaction between all of the automations since they all run the same script to turn the amp on.
without knowing the exact contents of the script or the states of your media players when turning it on/off it’s hard to know what is causing the things you’re experiencing.
You could try adding some input_booeans for more control. For instance…when the turn on automation triggers, also turn on a yes_i_am_on boolean, and have a condition that makes sure it was off first. The turn off automation can have a condition that the input_boolean must be on. and also turn it off if the 1 minute has passed and this script gets triggered…verifying the on automation already ran. this may help avoid a temp status change trigger between songs.
But my value_template: ‘{{(states.media_player.spotify.attributes.source == ‘‘Gym’’) and (states.media_player.spotify == ‘‘paused’’)}}’ doesn’t seem to trigger…