You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I think you had a bug in the presenceEventHandler for the Advanced Instance. In your code the "newPresence" was evaluated outside of the "if (!oldPresence) ....." block. Right above that if statement you initialize newPresence as false. Then, by evaluating newPresence outside of the "if (!oldPresence) ....." block, if there is a change to an included Presence device, it will always mark the combined presence device as "departed". I changed the code and tested it in my scenarion to this:
I've analyzed it and I believe your code is functionally identical to mine, with the exception that mine can call outputSensor.arrived() and outputSensor.departed() repeatedly. This should not be a problem though - calling arrived() on a present sensor (or departed() on a not present sensor) does not cause a state change in that sensor.
Or did I misunderstand your comment? Thanks for the feedback!
Hi, I think you had a bug in the presenceEventHandler for the Advanced Instance. In your code the "newPresence" was evaluated outside of the "if (!oldPresence) ....." block. Right above that if statement you initialize newPresence as false. Then, by evaluating newPresence outside of the "if (!oldPresence) ....." block, if there is a change to an included Presence device, it will always mark the combined presence device as "departed". I changed the code and tested it in my scenarion to this:
def presenceChangedHandler(evt) {
log "PRESENCE CHANGED for: ${evt.device.name}"
//log.debug groovy.json.JsonOutput.toJson(evt)
}
The text was updated successfully, but these errors were encountered: