We have moved at community.getvera.com

Author Topic: A way to remember the previous state of a device?  (Read 895 times)

Offline S-F

  • Hero Member
  • *****
  • Posts: 1248
  • Karma: +62/-12
  • Clueless N00b
A way to remember the previous state of a device?
« on: April 11, 2014, 04:35:52 pm »
When I have Vera turn something on it always defaults to the default. So it will turn a light on to 100% or when it turns a Russound zone on it goes to the zone default. Is there a way to have Vera remember the last value before it was turned off? I've looked at the Vcontainer but I can't seem to find a way have the value stay after it's turned off.
My forum account was apparently hacked by a leprechaun. And he's drunk all of the time. If a post of mine seems a little off kilter, it's probably because he made it.

Offline parkerc

  • Beta Testers
  • Sr. Hero Member
  • *****
  • Posts: 2479
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: A way to remember the previous state of a device?
« Reply #1 on: April 11, 2014, 06:26:28 pm »
Just an idea,

Maybe you could use 'luup.variable_watch' to keep an eye on those certain variable values e.g loadlevel and then when ever it changes, you write the new value to an unused or new variable field on the device, however in your code, you would set it so that it does not write the values you don't want, like off (0)

Then when you turn something on or start something up - it could look for it being swithed on and it then pull back and applies that Previous Value from that  field.

There's likely to be easier ways to code it, but I assumed if memory was used to store it, you would lose it on a restart - anyway I thought I'd share my idea :)
« Last Edit: April 11, 2014, 06:33:02 pm by parkerc »