Denkovi SmartDEN IP Maxi relay with OH 3.1

I recently upgraded from OH 2.2 branch to OH 3.1.0. By doing so, I lost the ability to control my Denkovi relay.
I’ve asked for support from the relay manufacturer as they have necessary items, rules, transform and sitemap files to work with previous OH versions, but they are completely ignoring me - so I’m not expecting any help from there.

I would like to stick with the OH3 and before going back to OH2.2 I decided to ask for help.

The relay has ability to use HTTP (GET) and SNMP in reading the status and altering the outputs.

So far I’ve tried creating things, items via UI and by textual input, but seems I’m way too stupid to make it work.
By using the SNMP, I was able to retrieve the state, but not change the output state, and by using HTTP I didn’t get anything out, or in for that matter…

So as I obviously was closer by using SNMP, I’ll take that as base point how to make it work.
I currently have this as .things file:

Thing snmp:target:smartden [ hostname="", port="1610", community="private", protocol="v2c" ] {
                Type string : Relay1 [ oid=".", mode="READ_WRITE", datatype="UINT32", onvalue="ON", offvalue="OFF" ]
                Type string : Temp1 [ oid=".", mode="READ" ]
                Type number : RelayState [ oid=".", mode="READ" ]



Switch Relay1 "Rantavalo" {channel="snmp:target:smartden:Relay1"}
String  Temp1 "Takakuistin lämpötila" {channel="snmp:target:smartden:Temp1"}
Number RelayState {channel="snmp:target:smartden:RelayState"}


// Imports
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.eclipse.smarthome.model.sitemap.*

rule "DIState"
	Item DI received update
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x01)==0x01) DI1.postUpdate("ON") else DI1.postUpdate("OFF")
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x02)==0x02) DI2.postUpdate("ON") else DI2.postUpdate("OFF")
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x04)==0x04) DI3.postUpdate("ON") else DI3.postUpdate("OFF")
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x08)==0x08) DI4.postUpdate("ON") else DI4.postUpdate("OFF")
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x10)==0x10) DI5.postUpdate("ON") else DI5.postUpdate("OFF")
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x20)==0x20) DI6.postUpdate("ON") else DI6.postUpdate("OFF")
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x40)==0x40) DI7.postUpdate("ON") else DI7.postUpdate("OFF")
	if((DI.state as DecimalType).intValue.bitwiseAnd(0x80)==0x80) DI8.postUpdate("ON") else DI8.postUpdate("OFF")

rule "RelayState"
	Item RelayState received update
	logInfo("Relay received update","Relay received update")
	if((Relay.state as DecimalType).intValue.bitwiseAnd(0x01)==0x01) Relay1.postUpdate(ON) else Relay1.postUpdate(OFF)

I would expect the switch item to work as I made the text files as per the SNMP binding documentation. But the item says NULL.
If I change the item type to string, it shows the actual state (1 or 0).

I then tried the EXEC profile (and whitelisted the commands) and used snmpset -v1 -c private . i 1 or snmpset -v1 -c private . i 0, both worked. I then tried snmpset -v1 -c private . i %s, changed the channel type to switch and added onvalue 1 and offvalue 0. Then nothing.

At best, the log says "Item ‘Relay1’ received command ON → PREDICTED to become ON → changed from OFF to ON

Here is the link to Denkovi example files that work with 2.2: SNMPv1 RAR package

Here is HTTP example files.

I don’t care if it would be SNMP or HTTP, I just would like it to work without installing the old version of OH…
I tried to search for different topics about this, found many, but I don’t seem to have the brain power to iterate the findings to suit the Denkovi box…

You won’t be wanting any of those imports in OH2, I think.

What are these ‘DI’ Items your rule operates on?

Those are general digital inputs in the relay. They can be used to actuate the relays or make just about anything in conjunction with OH.

The example files (in linked rar files) worked in OH2, the sitemap and items content above is made by me trying to get the Smartden to work in OH3. .rules is the original one from the example files.

For anyone with Denkovi modules like me - Denkovi has published updated config files for OH 3 here

1 Like