Music button press 1 time, turn music off, press 2nd time, turn music on
Hey there,
Like the title says, I want my music button to, when you press it the first time, turn the music off.
And when you press it the second time, it turns the music back on.
Thanks a lot!
Like the title says, I want my music button to, when you press it the first time, turn the music off.
And when you press it the second time, it turns the music back on.
Thanks a lot!
Comments
In your button have a rule when touch is pressed:
-change attribute musicOff to (musicOff+1)%2
that will toggle it between 0 and 1
then have your rule when attribute musicOff=0
-change attribute device.audio.music to 1
otherwise change to 0