Control Denkovi relay board with Siri, through openHAB2

Hi everyone,

I’m new in openhab community and I’d like an advice from you. I’m building a new house and I’m looking for a solution to create a good and safe automation method.

I want to make Siri control openHAB2 installed on a raspberry pi 3, since Apple has opened homekit protocol (http://www.cnx-software.com/2017/06/09/apple-opens-homekit-accessory-protocol-specification-to-non-commercial-projects/), and I also want to make my openHAB2 control via snmp commands, my realy board (https://denkovi.com/smartden-lan-ethernet-16-relay-module-din-rail-box).

As I’m not a programmer, I’d like to know if anyone has already this solution so I could test and implement on my new home.

PS.: All the switches from the house are going to be control switches, which will send a signal to the GPIO pins of my rpi and also control the relays. So the relays will be controlled either by Siri -> openHAB on Raspberry Pi -> SNMP command -> Ethernet Relay, or Manual Switch -> GPIO pin -> openHAB on Raspberry Pi -> SNMP command -> Ethernet Relay.

Could anyone help me with this?

I’m not sure I can help with much with the Siri integration but gotta ask, why SNMP?

SNMP is a network management protocol. It is not really intended to be a command protocol like you propose using it. I’m sure it can be made to do what you want, but a more appropriate protocol would be MQTT, or use the Wireless GPIO API built into the Raspbian or any number of other messaging protocols.

As for how to do this using MQTT, this is how I control my garage door openers using sensorReporter.

To command
openHAB -> Mosquitto MQTT Broker -> sensorReporter -> GPIO pin

Status
GPIO pin -> sensorReporter -> Mosquitto MQTT Broker -> openHAB

@Max_G is also in the process of building a new house along these lines and might have some advice and lessons learned to provide. I know one lesson learned will be to develop a full proof and easy way to replace your Pi’s SD card when things go wrong. :slight_smile:

However, I will say that the combination of “I’m not a programmer” and “which will send a signal to the GPIO pins of my rpi and also control the relays” gives me pause. I’ll be frank, this stuff is hard to get working and even harder to get working reliably. Just be aware you are signing yourself up for a lot of work. You are unlikely to find a lot of off the shelf solutions that will not require your getting deep into the software and hardware details. I’m not trying to persuade you that this is a bad idea, just trying to help set expectations.

As an anecdote, I AM a programmer and I have a Pi set up to trigger my garage doors through a relay wired to the GPIO pins. It was running just fine forever but recently the SD card corrupted. I’m rebuilding it now and suddenly, my garage doors now open whenever I reboot the Pi. Gah! With the DIY approach, these sorts of problems will plague you for the rest of your life.

2 Likes

Do you have a spare relay? Then this could be an easy solution:

1 Like

Unfortunately, I do not they are expensive.

I think something is going on that I caused myself. I may have had some code on my old SD card that initialized the pins to high when my script started that didn’t get checked into my git server. I just need to sit for half an hour or so and review what I’ve got and run some experiments to see if that is the problem or if there is some new behavior with the pins I’m not taking into account.

It’s no big deal really. I just wanted to illustrate that even for experienced developers the DIY approach is fraught with lots of these sorts of problems that crop up, far more often than with commercial approaches. And there is no helpdesk support.

Interesting statement; what will you do to ensure you are fulfilling this goal?

Make it bootable from SSD/HDD…

What I have learned from this forum is: there are multiple ways to skin a cat…
a) some will go for a commercial solution, and do a little in OH
b) some build it all themselves
c) a mix of a) and b) and anything in between.

Points to consider though (mostly depending on the culture and country your a living / building in):
a) is it legal what you do; is it safe; is it reliable (fit-for-purpose)
b) will it deter others from buying your house; (often home-made solutions will deter potential buyers)
c) do you replace or augment existing installations
d) can it easily be repaired (in order for a DIY solution to be repairable it needs to be sufficiently documented; I have 95 pages in my wiki, and am not even half way through)

At present, I will no have any traditional light switches… it seems radical; however, I see it as normal development. E.g. people ditched landlines in favour for GSM. We ditched the horse-drawn cart for cars; the latter will soon be driver-less.

To come back to the OPs first statement: “to create a good and safe automation method” … it depends your ability, capability and judgement, in order to get there.
Good luck. :slight_smile:

1 Like

I’d like to have both usual and automated switches, let me draw an example:

Sorry but the system didn’t allow me to post two images in one post, so, take a look at the link: http://imageshack.com/a/img923/1771/UW9OW4.png

At first, I wanted to have a three-way circuit like in the picture (sorry for the terrible drawing). The problem is: my automation on RPi 3 had to be only “change status of the relay” and not “turn the light on/off” because the system would know the status of the relay but not if the load is “on” or “off”. I’m still thinking about the possibility of using this arrangement.

Second thought is this one:

The switches would control the relays, sending 5v to GPIO pins, making RPi 3 turn on or off the relay state, depending on the current state of it.

Anyway… I’m still thinking about a good solution, but I’d prefer to have redundance, like in the first drawing.

As you can see here: http://denkovi.com/smartden-lan-ethernet-16-relay-module-din-rail-box
Denkovi uses SNMP to set and read the status of the relays.

It really sounded like a beginner. Sorry for that. I meant that I’m not a professional or very experienced programmer, but I’m Electrical Engineer and I have a good backup experience to help me with it. Besides that, I have a great team working with me who will review all my work before running it.[quote=“Max_G, post:5, topic:30289”]
At present, I will no have any traditional light switches… it seems radical; however, I see it as normal development. E.g. people ditched landlines in favour for GSM. We ditched the horse-drawn cart for cars; the latter will soon be driver-less.

To come back to the OPs first statement: “to create a good and safe automation method” … it depends your ability, capability and judgement, in order to get there.
Good luck. :slight_smile:
[/quote]

That’s my concern… If I choose drawing 2 (only control switches and not load switches), it would be too radical for people but I also see as an improvement.

If you have any advices on my arrangementes, I’d be glad to hear from you.

I also see there is an HTML/XML/JSON interface which would be a more typical way to integrate it with OH. But it does look like the SNMP binding would support these commands so it should work just fine.

Anyone to help?

Hi, already view the stuff in the denkovi page ( http://denkovi.com/openhab-with-denkovi-modules and build the sitemap, with the correct atributes, but in my case am using the denkovi a electric plant and transfer.

because i only use SNMP already refactor the code of all things following the next convention:
Example.

use a proper , snmpcommunity in this case are using public as example but for building is useful, because you dont use write commands!

String DigitalOutput1 “” {
snmp="<[192.168.1.2:public:.1.3.6.1.4.1.42505.1.2.3.1.11.1:1000:MAP(daenetip4.map)] >[OFF:192.168.1.2:public:.1.3.6.1.4.1.42505.1.2.3.1.11.1:0] >[ON:192.168.1.2:public:.1.3.6.1.4.1.42505.1.2.3.1.11.1:1]"
}

beware of the snmp timeout, already set my to 8000 milsec because the denkovi doesnt handle less request times.