I can’t get @q13975’s version to work, or the original posted.
I played around with the IDE simulator and couldn’t get it to fire another on event once the switch was already on. It seems like that is the purpose of the
[filterEvents: false] parameter in the method call:
subscribe(master, "switch", switchHandler, [filterEvents: false])
Looking at the API Reference for SmartApp, there is no mention of the
[filterEvents: false] parameter.
Is someone able to get this to work?