LUA script needed for checking 2 switches with time in between
Posted: Wednesday 16 March 2016 15:51
I need help as I can't script this with blocky and I have no LUA knowledge.
What do I want to achieve:
I have a KAKU doorcontact magnet with 2 variables: open/close (or on/off).
Each time when it is dark in house (no lights are switch on (anymore)) I want to switch a light on when we come home (based on the doorcontact).
This is simple to do with blocky.... so this is not the problem
But..... I also want this door switch to work as an alarm. But not everytime the door is opened a trigger must be set...
I have a dummy switch 'someone at home'. This switch is turned on when the smartphone of my wife or mine phone is pinged.
When both phones are not pinged the switch is set to 'off'.
So what would i like to achieve:
When the door is opened and within 1 (or 5) minute(s) the 'someone at home' switch is turn on there is nothing wrong.
But..... when the door is opened and within 5 minutes the swith 'someone at home' is not switched on some action needs to be taken (send an email, notification and also the doorbell needs to ring a few times and lights need to start going on or off....
How can I script something like this....?? (is it possible?
Sorry for the complex explanation......I didn't know an easier way
What do I want to achieve:
I have a KAKU doorcontact magnet with 2 variables: open/close (or on/off).
Each time when it is dark in house (no lights are switch on (anymore)) I want to switch a light on when we come home (based on the doorcontact).
This is simple to do with blocky.... so this is not the problem
But..... I also want this door switch to work as an alarm. But not everytime the door is opened a trigger must be set...
I have a dummy switch 'someone at home'. This switch is turned on when the smartphone of my wife or mine phone is pinged.
When both phones are not pinged the switch is set to 'off'.
So what would i like to achieve:
When the door is opened and within 1 (or 5) minute(s) the 'someone at home' switch is turn on there is nothing wrong.
But..... when the door is opened and within 5 minutes the swith 'someone at home' is not switched on some action needs to be taken (send an email, notification and also the doorbell needs to ring a few times and lights need to start going on or off....
How can I script something like this....?? (is it possible?
Sorry for the complex explanation......I didn't know an easier way
