A quick question. I am building my first Lua script for my Lux sensor, the script is running fine so far. It does what I wanted to do. But I now I want to do something which involves time .
I have created a time script. Basically when the scripts executes, I want to place the current OS time in a user variabele, preferable in the format HH:MM.. Now, when the script executes again (one minute further); I want to read the user variabele, calculate the new time and I want to calculate the difference on both the times in minutes. If the result is 10 minutes or more, for example, then I want to do something in the script.
I like to use this time setting on my Lux sensor / lua script. If the lux sensor goes down because of a cloud, I don't want that Domoticz will close my sunscreen immediately because of the low lux.. I want to evaluate the Lux sensor 10 times or so before I close my sunscreen outside. At this stage I am able to evaluate the sensor ten times before it closes, but I want to time frame it basically.
I know how the variables works, but I really don't get the time settings in Lua. I simply don't get the format and how to calculate with it. I was able to get a String value in HH:MM and place this in a variable, but then I don't know how to calculate the difference because it is a string?
Can someone give me a push in the right direction, because I don't see it