thildemar
(Adam E)
December 30, 2015, 3:12pm
10
Thanks for the discussion here, I have been looking for the same answer. I made some progress and figured a write up needed a new thread as this one seems pretty stale. Please take a look at what I have found here as it may help you:
Hi Everyone,
I apologize for any errors here as I am new to the platform, but hopefully my research thus far or this discussion will help others.
I have been working on an app that I want to restore light settings (on/off/level) to the last known external (not set by my app) values. Looking for .isPhysical on events gets part way there, but does not cover if the last light value was set by another app. It seemed like looking for the last event with a installedSmartAppId that did not match app.id would work, but not all events are properly tagged with the triggering appid it seems. So this code does not work:
swEvents.find {(it.name == "level" || it.name == "switch") && (it.installedSmartAppId != app.id}
When I looked into the list of events after issuing switches.setLevel(100) in my …