I want to monitor a variable (it’s a temperature) and detect when it is increasing between measurements taken at an interval of a minute or two. I’m going to see if I can figure out how to do it in PLEG, but I have a feeling it’s going to be a LUA task. Anyone else tackle this in the past???
I’m sure it’s very easy in PLEG, but I wouldn’t know how.
In Lua, you could simply have a scene scheduled to run every minute or so and do some action if the measurement is increasing. This sort of thing has been done countless times in the past, so there should be examples to follow.
Of course your measurement needs to update at that frequency.
But if you just want to see of the temperature changes in 2 minutes:
(Temp @ 2 < 2:00)
So if the temperature changes in 3 minutes … this will be false … if it changes in 1:59 seconds it will be true.
Is it really that easy? Seems to me that you’d have to store the value somewhere in order to compare it to it’s previous value. I don’t know if there’s a time stamp on it… On that note, I have this value in a variable where the definition starts with “local”. If I remove “local” from the LUA, will I be able to see this variable in PLEG?
In PLEG every time an Input or Condition changes value it gets a timestamp. PLEG keeps the last 4 timestamps (for an On/Off Input or Condition 4 timestamps for On and 4 timestamps for Off)
You can flag a condition as “Export” than it will create a variable on the PLEG device that can be accessed outside of the PLEG in the same way that any LUA or other PLEG accesses a devices variable.
I guess it’s time to start studying up then…
Once you understand how it works, PLEG is the way to automate Vera.
PLEG is definitely the way to do many things, I’m just learning still how to do many of them…