How to monitor a dry contact?

Hi,

I have an old alarm system. No IP, no RS-232.
There is an add-on board that can give me the state of 4 door contact in the form of dry contact (potential free). (1 relay for 1 contact)
My question is the following:
How can I interface that 4 relays with my openHab system.
The better is the most plug & play option.
I don’t want to reinvent the wheel.

Thanks for your help

There are a number of ways you can do this, I’m happy to suggest a few but understand that everyone will have their own take on it.

If you want a two way solution (if you have some spare zone inputs) you could look at a Robot Electronics IO board that would give you UDP or TCP over IP control?

Like this unit for ~£70 that offers

4 x Relay outputs
4 x analogue inputs
8 x digital IO

There is a box available too.

They have a DScript version if you want to add some extra logic.


Alternatively, you could add a couple of Velbus modules which can be linked to openHAB2 via USB.

www.velbus.eu/products

VMB8PBU or VMB6PBN for picking up the contact closers.

VMB1RYNOS for triggering a zone input.

VMB1USB for interfacing directly to openHAB2.

You could probably grab 60ma of 12Vdc from the alarm to power these Velbus modules.

To help narrow the choices down, what existing technologies are you using with openHAB? e.g.perhaps you have zwave already.
Are you able to run wires between your alarm and some central OH box,or would you need wireless?
What about power -if you install some device at the alarm, can you “steal” 12 volt power from the alarm?

I do this myself with a Modbus digi i/o module,but that is part of a larger Modbus setup.
Could be used alone though- module in alarm box, powered by alarm, cat 5 cable to OH host, cheap USB/RS485 dongle to drive cable.

Hi,

For now, I use only MQTT and weather bindings. I just begin some month ago with OH2.
I’m open to any technology. (Zwave, velbus, RS485, modbus,…)

My Openhab run on a RaspberryPi3 in a clean box. I don’t want direct connection to the RPI.
For the link, an RJ-45 connector is the best but wifi is acceptable. (but no bluetooth)
The power supply is not an issue.

I have to double check but the ETH484 suggested by MDAR seems pretty good.
If I understand well, this card need only HTTP binding to link to Openhab?
I continue to search but anyway, thank you all to put me on the right way…

1 Like

Hi

I think you’re right.

I use the DScript version with the TCP binding to trigger ‘rules’ within the relay box.

It’s my understanding that the basic IO board will communicate over UDP or TCP.

As per this documentation.

Hi,
You can use Shelly1, a very low cost IoT WiFi device, wich can be powered 110/220Vac or 12, 24, 48Vcc, use MQTT protocol, and offers a dry contact as output.
ESP8266 embedded, accept to be re-flashed with any open source firmware without to loose manufacturer material warranty, if needded (never done myself, no necessity, the original firmware is ok).
I already use “lot of them” for my personal use, with success.
You can also use any ESP8266 dev board for that, if you want to program something by yourself.

1 Like

Hi,

Thank F6HQZ for the idea.
Shelly1 have only one switch input but at this price, it’s not a problem to buy some…

but,
in the meantime, I have orderded a Robot Electronics DS3484 (dScript).
I will test it as soon as I received it and you will be aware of the results.

@MDAR
Can you post some sample files (sitemap, items, rules) that you use with this board?

1 Like

Hi

As far as openHAB2 is concerned, you’ll probably only need 2 x TCP items.

One incoming
One outgoing

I’d suggest a rule to monitor the incoming packets and perform an action / event for a match.

Outgoing would be as simple as sending a command to the outgoing TCP Item.

It’s the DScript inside the Robot Electronic board that will need your most attention.

The standard board simply sends out input status data and opens or closes relay contacts from incoming packets.

What you’ll have to do is create this simple logic in the DScript language.

There are plenty of examples you can work from on the Robot Electronics DScript page.

When I get home, I’ll PM you a DScript project I created that will demonstrate the board performing a choice of actions, based on a single character RAW TCP packet.

You’ll just have to learn how the outgoing TCP is programmed in DScript.

FYI
DScript PDF

DScript examples ZIP

Hi,

As promised, here is me feedback:

My main concern was not about the board interface or the board capabilities but just about the dialog between this board and Openhab.

So, I did not play with DSscript at all. I only used the default firmware of the DS3484.
Be sure to set your board in binary mode.
Be sure to use fixed IP adress.

For the communication with OpenHAB, I use NodeRED.
It was very easy, even for a beginner.

  1. Install NodeRED on your OpenHABian or where you want…
  2. From your main OpenHABian page (http://10.0.1.150:8080/start/index), open NodeRED
  3. Create a new flow and add nodes like this:
    3.1. Add an Inject Node with Payload [“0x34”,“0x01”]. I put a repeat interval of 5s. Topic is empty.
    3.2. Add an HTTP request Node. Configure the IP and port of the DS3484. Set a timeout of 500ms.
    3.3. Add 8 Function Nodes (1 by Input).

Function are the following:
D1

if ((msg.payload[1] & 1) == 1)
{ msg.payload = “D1 is ON”; }
else
{ msg.payload = “D1 is OFF”; }

var D1=flow.get(‘D1’) || 0;
if (D1 != msg.payload)
{
flow.set(‘D1’,msg.payload);
return msg;
}

D2

if ((msg.payload[1] & 2) == 2)
{ msg.payload = “D2 is ON”; }
else
{ msg.payload = “D2 is OFF”; }

var D2=flow.get(‘D2’) || 0;
if (D2 != msg.payload)
{
flow.set(‘D2’,msg.payload);
return msg;
}

D3

if ((msg.payload[1] & 4) == 4)
{ msg.payload = “D3 is ON”; }
else
{ msg.payload = “D3 is OFF”; }

var D3=flow.get(‘D3’) || 0;
if (D3 != msg.payload)
{
flow.set(‘D3’,msg.payload);
return msg;
}

etc… etc…

I used variables to store the states of Inputs and for publishing state ONLY when state change.

3.4. Add one MQTT Out Node by function. In server, select your MOSQUITTO server. In topic, set for instance DS3484/state/D2

It is done for NodeRED

  1. Add a new Generic MQTT thing for the DS3484 board. (I choose MQTT_DS3484)
  2. Create 8 channels. (one by Input)
    Exemple for D1:

Type: text value
ID: D1
Name: D1
State Topic: DS3484/state/D1

  1. Create 8 string items and link them to your channes
    Exemple for D1:

String Input_D1 “State of Input D1: [%s]” { channel=“mqtt:topic:MQTT_DS3484:D1” }

It works very well but feel free to comment. this can probably be improved.

Mike

1 Like

Have a look at Konnected https://konnected.io/
There is a binding for it too!