Author Topic: Device Last Change Time Value?  (Read 511 times)

Offline tbrock47

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +1/-1
Device Last Change Time Value?
« on: November 20, 2017, 10:28:08 pm »
Is there a baked in way to access the time of the last status change (reference variable) on a device?
Say, the last time a light was turned on or off. Or the last time a door sensor changed from opened to closed?
« Last Edit: November 21, 2017, 01:19:47 am by tbrock47 »

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 10091
  • Karma: +764/-142
Re: Device Last Change Time Value?
« Reply #1 on: November 21, 2017, 06:43:50 pm »
If you use PLEG .. for all inputs and derived conditions ... it maintains the last time the inputs were true or false, if they are binary, or the last two times they changed if they are numeric or string values.

There is no generic value in Vera ... some devices like a dimmer or thermostat have multiple things that can change ... so what time would be recorded.
Dimmer   - Level, and On Off State
Thermostat - Temperature, Heat Setpoint, Cool Setpoint, Operating Mode, Operating State, Fan Mode ...


Offline tbrock47

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +1/-1
Re: Device Last Change Time Value?
« Reply #2 on: November 21, 2017, 06:47:38 pm »
I'll have to look into PLEG then. The only other thing I could think of was running a scene triggered by any change and just maintain global time variables for every device.
Thanks.

Offline parkerc

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2473
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: Device Last Change Time Value?
« Reply #3 on: November 26, 2017, 02:49:39 pm »
Hi

Depending on your coding capabilities, this old thread might be of interest.

http://forum.micasaverde.com/index.php/topic,19263.msg189566/topicseen.html#msg189566

It?s for UI5 but it makes references to capturing information and recording it against the device when a specific variable changes. I?m sure it could be tailored.

Offline tbrock47

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +1/-1
Re: Device Last Change Time Value?
« Reply #4 on: November 26, 2017, 03:28:07 pm »
Awesome. Thanks.
That looks interesting. I'll go over the thread tonight.

Offline tbrock47

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +1/-1
Re: Device Last Change Time Value?
« Reply #5 on: February 19, 2018, 03:35:45 pm »
Wanted to mention I finally got around to looking into PLEG.
I've implemented it and migrated all my scripted scenes, and holy cow is it so much easier to maintain than my 80+ line scripts.
Thanks for that!