Correct IF Syntax

So my grandfather clock automation is awesome. Only problem I have is if I’m jamming out with the Sonos and then the quarter comes up it shuts off my music and plays the chimes. Not a big deal I just open the app and resume my song. But I decided while I don’t mind a little hassle the Mrs does not. So rather I figured I’ll just check the state of the player and if its not equal to playing then we can proceed
So I added this line

        if self.get_state(self.args["mediaID"]) != "playing":

But it still goes through and plays the chimes. So either my syntax is not right or the status from the dev states page within HA is wrong.

Thanks for your help. If you want to see the whole file let me know and I’ll toss it in here.

Could you please show the whole code incl. the configuration YAML?

Did you already try adding a log before the IF condition to check what the return is of the get_state function. Like:

Self.log(self.get_state(self.args["mediaID"]))

I’ll post the code tomorrow when I’m back after errands :grinning: