delay before tripping

Moderator: leecollings

Post Reply
alexbi
Posts: 2
Joined: Tuesday 08 December 2015 0:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

delay before tripping

Post by alexbi »

hello

sorry i am french so its goole translation

Hello

here I was trying to do in the events so what blocky call (if I understood everything ... sorry I started ) that I scored in the title.

IF my bathroom light is on for at least 15 seconds while I turn on the heating.

I ask because I have a HCL is their home fibaro understand this function block

http://img15.hostingpics.net/pics/967647Capture4.png

Thanks for your help
alexbi
Posts: 2
Joined: Tuesday 08 December 2015 0:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: delay before tripping

Post by alexbi »

here is the answer :


t1 = os.time()
s = otherdevices_lastupdate['eclairage_SDB']
-- returns a date time like 2013-07-11 17:23:12

year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)

t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
print (difference)
if (otherdevices['eclairage_SDB'] == 'On' and difference > 15 and difference < 81) then
commandArray['chauffage_SDB']='On'
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest