As I am listening to state “Playing”, why does it not trigger when it changes automatically? Should I listen to a different state? If so, then to what state?
Thanks
Update: It looks to trigger that automatically too, but:
manually it logs title when song starts playing
automatically it logs title when song stops playing and new one starts playing (aka it logs previous title).
Thanks TNT_Larsn and Hellis81. Seems to work as expected without the condition mentioned by Hellis81.
Only one minor issue:
If same title is played next - it is not logged (as the trigger runs when the state of media_player.living_room_speaker attribute media_title changes).
What could be the condition to log if the next title is same? I sometimes play same title in a loop and I would like in long term to have some counts on most popular tracks I play.
That’s because a trigger is, unlike a condition, only listening to the state change and not the actual state. If you’re playing a song, the “playing” state doesn’t end by switching to the next song. The media player is still playing.
If you switch manually, you’re breaking the “playing” state, so the next song will switch to “playing” and that’s where your trigger reacts.
A trigger checks, if a treshhold is passed. In that moment it reacts (triggers). A condition checks, if a value is (already) over a treshhold at exact that moment of checking.
The reason I added the condition is because I thought it would log something when you stopped playing.
To make sure it logs the same song when repeating you could perhaps try numeric trigger on attribute media_position below 5 or something.
This should trigger every time a new song starts.
Wouldn’t it be easier to log it in Google sheets?
It has some features that probably would make it easier to analyze the songs.
You could also add a date time to your logs so you could see songs per day etc.
Valid thought. I checked it out of curiosity, but it does not log at all with that condition. I guess title changes not on “playing” but on a different state.
And thanks for numeric trigger hint - I’ll check what I can do with it.