smartthings

Subscribe to Events, even when isStateChange is False


Is there a way to run through a function even though there is no state change?

subscribe(locks, "codeReport", codeReturn)

I'm trying to subscribe to an event, but it only enters the subscription function if there is a state change Eg:

isStateChange: false Does not get run

isStateChange: true Gets run.


Solution

  • The event will only be broadcasted if the state has changed, or if the event type is physical. Plus a handful of other very rare cases.

    In general it would be better to set the other attributes to get the event to broadcast then change the isStateChange to always be true.