Page 1 of 1
Door Sensor as a single switch
Posted: Thursday 12 January 2017 10:31
by ljoncz
Hi All,
I'm new to Domoticz and my qestion is probably basic, but I wasn't able to find an asnwer anywhere.
My goal: setup a door sensor as a single switch - type "contact"
Hardware: kerui door sensor connected through RFLink Gateway. It sends both "open" and "close" signals (
https://www.aliexpress.com/item/6pcs-lo ... 26744.html)
What I did so far: The sensor is detected as two devices: type - Light/Switch, subtype: Eurodomest, Data: Open and Closed respectively
Problem: When I click "add light/switch device", I create two separate switches - one that records door opening and one recording door closing. I'd like to have a single switch, that would show Open or Closed.
Thanks in advance for any ideas.
cheers
Lech
Re: Door Sensor as a single switch
Posted: Friday 13 January 2017 22:56
by ljoncz
I figured it out - here is my solution in case it helps anyone.
step 1: add two devices as switches ("Door Open", "Door Closed")
step 2: change the type of the switch to "Push On Button" and "Push Off Button" respectively
step 3: add a virtual sensor ("Front Door") and add it as a switch
step 4: create a device script:
Code: Select all
commandArray = {}
if
devicechanged['Door Open'] == 'On'
then
commandArray['Front Door'] = 'On'
end
if
devicechanged['Door Closed'] == 'Off'
then
commandArray['Front Door'] = 'Off'
end
return commandArray
If there is a simpler way - I'd appreciate if you post the solution here.
Cheers
Re: Door Sensor as a single switch
Posted: Saturday 14 January 2017 0:48
by sion
Could you just put a Json command in the on action of the closed switch, that would turn off the switch that was turned on by the open contact.
http://<username:password>@domoticz-ip<:port>/json.htm?type=command¶m=switchlight&idx=<switch id>&switchcmd=Off
Re: Door Sensor as a single switch
Posted: Saturday 14 January 2017 0:53
by Swifty
Hmm I just added the open device then added the close device as a sub device of open, finally edit the master device to set it as contact type.
It seems to register open/closed fine - but is this not the best way to do it then?
Re: Door Sensor as a single switch
Posted: Saturday 14 January 2017 0:59
by sion
Swifty wrote:Hmm I just added the open device then added the close device as a sub device of open, finally edit the master device to set it as contact type.
It seems to register open/closed fine - but is this not the best way to do it then?
This seems the simplest way

Didn't think about sub device.
Re: Door Sensor as a single switch
Posted: Tuesday 31 January 2017 8:21
by eddiecharette
Some generic door alarm are circuits with 2 reed switches output to single GPIO. But sometimes it is necessary to have asingle push plate, key single switch. Most installations only need actuator to activate automatic door which rely on harness for sonnection. Would like to share a very useful article for advantages of door sensors.
http://cspalarms.ca/blog/home-security/ ... r-sensors/ . They usually transmit signals to the security alarms
Re: Door Sensor as a single switch
Posted: Saturday 24 March 2018 19:06
by Mike59
Hello
J'ai acheté sur AliExpress KERUI 433 Mhz Sans Fil Intelligent PIR Motion Sensor Détecteur. Il fonctionne trés bien, est vu comme un switch "On/Off" et je déclenche un script sur "Action OFF" quand il y a un mouvement.
J'ai acheté sur AliExpress "KERUI ouvert rappel Capteur 433 mhz Tandis Que Sans Fil À Domicile D'alarme Fenêtre/Porte Capteur à Détecter Ouvert porte", pour résumer des contacts de porte/Fenêtre. Il fonctionne très bien, est vu comme 3 switch "On/Off" et je déclenche un script sur "Action ON" pour l'arrachement, un script "Action ON" quand on l'ouvre et un script "Action OFF" quand on le ferme.
Ceci pour votre information.
Par contre, si quelqu'un a une idée pour le détecteur Kerui de fuite d'eau : 433 MHz Sans Fil Détecteur D'intrusion D'eau Fuite Capteur. Il n'est pas vu dans Domoticz, la led s'allume mais rien ne passe dans la log