Anybody was trying to use this hardware with OpenHAB?
If yes, I could use some hints.
Anybody was trying to use this hardware with OpenHAB?
If yes, I could use some hints.
I have the same module with 16 channels. I’m still a beginner in openHAB. Does anyone know how I can integrate this relay module into openHAB?
So far I have managed to access it with Python 3 on Windows and Linux.
(unfortunately not on Android yet)
If that helps?
Test Python3 Code: (16 Channel USB Relay Module - Firmware v8)
#!/usr/bin/python3
import serial
import time
ser = serial.Serial(‘COM4’, 19200, timeout=1) # open serial port / WIndows
print(ser.name) # check which port was really used
ser.write(b’\rver\r’) # ver
print (ser.read(25))
time.sleep(3)
ser.write(b’\rrelay on 2\r’) # relay on 2
print (ser.read(25))
time.sleep(3)
ser.write(b’\rrelay off 2\r’) # relay off 2
print (ser.read(25))
time.sleep(3)
ser.write(b’\radc read 0\r’) # adc read 0
print (ser.read(25))
time.sleep(3)
ser.write(b’\rgpio read 4\r’) # gpio read 4
print (ser.read(25))
ser.close() # close port
If you can use Python2 then you might get this to work with Jython in openHAB.
There is a Serial openHAB binding, but it’s a V1 binding so not future proof. It should still work on openHAB 2.5 though.