Need some help trying to figure this out.
I have a bedside wireless switch which turns on/off the bedside lamps and a door sensor which automatically turns the lamps on when opened after sunset.
The issue: When I press the wireless on/off switch the lights go off but then when I open the door they turn back on.
Is there a way I can disarm the door sensor for 30 seconds and then re-arm the door allowing me to exit the room without them tuning back one?
Thanks
Disarm or Ignore Door Switch
Moderator: leecollings
-
- Posts: 4
- Joined: Friday 10 November 2017 14:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Disarm or Ignore Door Switch
sure...
you can use dzVents to work on lastUpdate value....
by this... the door sensor will NOT switch on the light for the next n secs (based on the value set on delay)
you can use dzVents to work on lastUpdate value....
Code: Select all
return {
on = {
devices = {
'myDoorDevice'
}
},
execute = function(domoticz, device)
local lampSwitch = domoticz.devices('myLampSwitch')
local delay = 30 --delay in secs
if device.lastUpdate.secondAgo > delay then
lampSwitch.switchOn().checkFirst()
end
end
}
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
- Siewert308SW
- Posts: 290
- Joined: Monday 29 December 2014 15:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Stable
- Location: The Netherlands
- Contact:
Re: Disarm or Ignore Door Switch
Or in plain Lua.
Code: Select all
function timedifference(s)
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)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
if devicechanged["door_switch"] == 'Open'
and otherdevices["bedside_light"] == 'Off'
and timedifference(otherdevices_lastupdate["light_switch"]) >= 30
then
commandArray["bedside_light"]='On'
end
Setup:
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
- RPi4 - Domo Stable / Aeotec Z-stick7 / PiHole Unbound Gemini
- RPi4 - PiHole / PiVPN Unbound Gemini
- Synology DS923+ / DS218j
- P1 Gas/Power, SmartGateway watermeter
- Fibaro switches, contacts, plugs, smoke/Co2 ect
- rootfs @ USB HDD
-
- Posts: 4
- Joined: Friday 10 November 2017 14:17
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disarm or Ignore Door Switch
Thanks both.
I don't have any experience with programming so the above doesn't make any sense to me. Is there a way you can break it down so I know where to insert my devices etc and how I go about this?
I don't have any experience with programming so the above doesn't make any sense to me. Is there a way you can break it down so I know where to insert my devices etc and how I go about this?
Who is online
Users browsing this forum: No registered users and 1 guest