Author Topic: Who generates LastTrip?  (Read 263 times)

Offline Ibrahim

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-2
Who generates LastTrip?
« on: March 20, 2017, 01:41:51 pm »
I want to create some scenes based on which device was triggered first, but, as we all know, a mesh network does not guarantee that the requests are received in the same order as they were sent.

This leads me to the question: Who generates the "LastTrip" timestamp for each device?
 - Is it generated by the device itself and sent to the controller? - because in this case I can rely on it.
 - Or is it generated by the controller when it receives some data from the device? - in this case I cannot rely on it since it may be delayed.

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9367
  • Karma: +704/-129
    • RTS Services Plugins
Re: Who generates LastTrip?
« Reply #1 on: March 20, 2017, 01:50:27 pm »
It's a Vera controller concept.
Devices have no knowledge of time.

Offline Ibrahim

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-2
Re: Who generates LastTrip?
« Reply #2 on: March 20, 2017, 02:12:34 pm »
I see. How unfortunate.
And I guess there is no way to accurately achieve what I want since devices don't send any timestamp, right?

Offline jlind

  • Full Member
  • ***
  • Posts: 164
  • Karma: +6/-5
Re: Who generates LastTrip?
« Reply #3 on: March 21, 2017, 09:46:29 am »
You really didn't give us what you wanted to achieve, so the generic answer would be that it would depend on how accurate you need the timestamps.  I've never tested it, but I would guess that using the device timestamp is probably accurate to within 2-3 seconds.  If you need less, then no it probably wouldn't be a reliable source.
VeraLite/VeraPlus with UI7, Multiple GE switches, GE Outlets, Aeon Smart Switches, Minimote, GE Portable outlets  Apps: (Countdown Timer, Weather Underground, Honeywell WiFi Thermo (newest manual install), Virtual on/off switches, eMail Notifications, System Monitor, AlternateUI)

Offline Ibrahim

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-2
Re: Who generates LastTrip?
« Reply #4 on: March 21, 2017, 06:18:54 pm »
What I wanted to achieve was to know which device was triggered first and which second by comparing the time stamps.

Something like:
Code: [Select]
if (device1.timestamp > device2.timestamp) // do this
else // do that

So the above code will work only if the controller receives the responses in the same order as they were sent by devices, which is not guaranteed.