Problem with 433 Mhz magnetic door contact Topic is solved

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
petercal
Posts: 10
Joined: Wednesday 12 September 2018 17:00
Target OS: Raspberry Pi
Domoticz version:
Contact:

Problem with 433 Mhz magnetic door contact

Post by petercal » Wednesday 12 September 2018 17:29

Version: 4.9700
Platform: Raspberry Pi
Plugin/Hardware:
Description:

Hi, I'm quite new to Domoticz.

I have a 433 Mhz magnetic door contact. It has 2 states CLOSE when magnet is close to reed relay and OPEN when magnet is away from reed relay.

I want to add the 433 Mhz magnetic door contact as a device, and be able to detect the OPEN/CLOSE states.

When i check the device with debug in RFLinkLoader.exe program i see

20;0A;EV1527;ID=0019f0;SWITCH=0a;CMD=ON; OPEN state (SWITCH=0a)
20;0B;EV1527;ID=0019f0;SWITCH=0e;CMD=ON; CLOSE state (SWITCH=0e)

When i register the device in Domoticz i get 2 devices with both ON state active

2018-09-12 16:54:45.569 (RFLink) Light/Switch (Unknown) OPEN state
2018-09-12 16:55:10.246 (RFLink) Light/Switch (Unknown) CLOSE state

What can i do to get it working as a single open/close contact ?

Thanks,
Peter
Last edited by petercal on Wednesday 12 September 2018 22:24, edited 2 times in total.

ben53252642
Posts: 497
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Problem with 433 Mhz magnetic door contact

Post by ben53252642 » Wednesday 12 September 2018 17:33

Is this how the two devices are functioning?

Device 1, door closed = send on signal to domoticz device

Device 2, door open = send on signal to domoticz device?

If so, the solution is easy:

1) Create a virtual on / off switch in Domoticz
2) Use a Lua script to set that device to the correct on / off state depending on which of your magnetic door contact devices updates.

Sounds like it's created a seperate device for each state (open and closed)?

If you need help with a sample script I can supply one.

petercal
Posts: 10
Joined: Wednesday 12 September 2018 17:00
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Problem with 433 Mhz magnetic door contact

Post by petercal » Wednesday 12 September 2018 18:27

Hi,

You're right, thats how it work.

I'll try your solution, and an example script would be much apreciated :)

thank,
Peter

ben53252642
Posts: 497
Joined: Saturday 02 July 2016 5:17
Target OS: Linux
Domoticz version: Beta
Contact:

Re: Problem with 433 Mhz magnetic door contact

Post by ben53252642 » Wednesday 12 September 2018 18:45

Paste into Domoticz events as a Lua device script (very important to change type from "All" to "Device")

Change as needed, it should work.

Code: Select all

commandArray = {}

if (devicechanged['DEVICENAME1'] == 'On') then
commandArray['VIRTUALSWITCH'] = 'On'
elseif (devicechanged['DEVICENAME2'] == 'On') then
commandArray['VIRTUALSWITCH'] = 'Off'
end

return commandArray

petercal
Posts: 10
Joined: Wednesday 12 September 2018 17:00
Target OS: Raspberry Pi
Domoticz version:
Contact:

Problem with 433 Mhz magnetic door contact

Post by petercal » Wednesday 12 September 2018 18:48

I'll try this

WORKS PERFECT :D

Thank you very much.

Peter

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests