Door Sensor as a single switch

ljoncz
Posts: 3
Joined: Thursday 12 January 2017 11:15
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Door Sensor as a single switch

Postby ljoncz » Thursday 12 January 2017 11:31

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-lot-New-433mhz-While-Wireless-Home-Alarm-Window-Door-Sensor-to-Detect-Open-Door/32463726744.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

ljoncz
Posts: 3
Joined: Thursday 12 January 2017 11:15
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Door Sensor as a single switch

Postby ljoncz » Friday 13 January 2017 23:56

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

sion
Posts: 67
Joined: Friday 08 January 2016 13:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Door Sensor as a single switch

Postby sion » Saturday 14 January 2017 1:48

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&param=switchlight&idx=<switch id>&switchcmd=Off
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.

Next: harmony hub.

Swifty
Posts: 12
Joined: Saturday 31 December 2016 22:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Door Sensor as a single switch

Postby Swifty » Saturday 14 January 2017 1:53

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?

sion
Posts: 67
Joined: Friday 08 January 2016 13:32
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Door Sensor as a single switch

Postby sion » Saturday 14 January 2017 1:59

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.
running domoticz 3.4834 on rpi2, with
Hue bridge / bulbs.
lightwave rf sockets, mood controlers, sensors & contacts.
Home bridge / Siri.
Ha bridge / echo Alexa.
Hard wired alarm system - setting home / away status.

Next: harmony hub.

eddiecharette
Posts: 1
Joined: Tuesday 31 January 2017 8:27
Target OS: -
Domoticz version:
Contact:

Re: Door Sensor as a single switch

Postby eddiecharette » Tuesday 31 January 2017 9:21

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/4-advantages-of-window-and-door-sensors/ . They usually transmit signals to the security alarms


Return to “Lights and Switches”

Who is online

Users browsing this forum: No registered users and 3 guests