I'm trying to control an Aqara mini switch button so that if I press it, the music starts playing. Then if I press it again, it stops playing. It works fine to start Sonos music. I'm trying to use logic to determine if the switch is on (Sonos - Office Fave 1), then play the music, if not stop playing the music. For some reason the "IF (Sonos - Office Fave 1 is off) never executes. Only the "is on" part of the IF statement. Note I included some items like the office lamp off or office fan off to determine if that part of the block executed.
Any idea why the "is off" if statement is never executed?
What steps from the documentation on how to troubleshoot apps have you followed? If you are having trouble following a specific step, please share details here, and someone can help.
As noted in this doc and nearly every similar previous post (1, 2, 3, and others), logs are the #1 troubleshooting tool for things like this. The document above suggests this and shows you an example of how to enable them and what they look like. You can share a screenshot of them here if they are not helpful for you, as they will be helpful to others helping you troubleshoot.
It won't shut off even with this statement. It just keeps turning the button on and I have to cancel the music with my voice. Now if I go to Devices I can turn off and on the "Sonos - Office Fave 1" device.
Thanks I just tried toggle and it didn't work. It's like it's determined to only turn on the switch. But as I said before I can turn it off and on in Devices" I just thought it would be nice for my wife to be able to shut the music off with the button as well.
If you haven't done this already, I would delete this button rule and create a new one and see if that works. I would also try to create a RM rule and see if that works.
Ah, sorry, my mistake, I forgot that you had a different device as the button device and the switch inside the actions. I thought you wouldn't be able to switch a button device on or off, but they are different devices.
I had included a "fan off" when I was using IF statements and the fan would shut off, but not the music, regardless of what I did. I'm going to try what someone else suggested and right a non-Button Controller rule and see if that makes a difference.
I used the DoubeTapped button to shut off the switch and that worked. But I'd prefer to have the single "Pushed" button used to turn on and off the music. Still working on it!
There was an issue with the device itself. Under "In use by" it indicated it was in use by rules that no longer existed. I deleted the device and button controller rules, and now this works.
Something is wrong with that app; I would have suggested removing and re-creating.
However, what I was really asking for was action logs from running the rule (but it's normally helpful to enable all logging in Rules and Button Rules to make these clearer; your logs are a problem but would not have come from this). The document I linked to above shows an example of how to do this, and it a also been suggested nearly every time you have a similar question, yet it still appears to have never been done here.
Glad you got something figured out! Next time there is an issue, please enable and share all app logs as a starting point.