eventsSince()/events() return not consistent with documentation


According to the docs eventsSince is supposed to return a List<event>, however as you can see form below it’s returning a double list array List<List<event>>


Is this the expected behavior (in which case the docs need to be updated) or is this a platform issue that needs to be corrected?

Also wanted clarification on two points related to eventsSince()

  1. The input is supposed to be a Date, does it calculated events from a date or a datetime? e.g. if I use eventsSince(new Date(now() - 60000)), I would expect it to return events in the last 60 seconds and it does seem to return it, if this is expected behavior then it would be nice to update the docs to reflect it
  2. If I ask for the last 10 events (out of say 100 in the timePeriod) - am I guaranteed to have the latest 10 events or is there some order for the events to be returned?

EDIT: Even events() is returning a double List array of event objects

I also found that eventsSince() and events() does NOT return consecutive events. E.g. if I press the on switch 5 times, it returns only the 1st on event and ignores the remaining 4 subsequent ones. It only seems to register/return non consecutive events. E.g. on - off - on - off - on = 5 events but on - on - on - on - on = 1 event and on - on - off - off - off = 2 events etc

How does one tell it to return all events even consecutive ones? The SmartApp is subscribed to all button events and it’s getting all the events correctly from the switch including consecutive ones but eventsSince() seems to be ignoring consecutive events.

1 Like

While I never used eventsSince() or events() I believe that the on-off behavior works as expected. SmartThings by default treats identical events as one (ignores identical events). You can force it I think by adding “isStateChange: true” to the event.

1 Like

Hmm I thought ST used to capture all events but only report those (to the ST UI App) that were marked as isStateChange or the value had changed. I didn’t realize that it filters the events while storing them.

Do keep in mind that when you subscribe to a switch you receive ALL events including consecutive repeat events. So I know that ST is receiving and processing them. I guess the clarification I’m looking for from ST is related to events() and eventsSince(), does it save this consecutive information or does it filter it out. @Jim?