OTGW on remote pi with ser2net

Now I am building my own domotica system with Domoticz, I bought and built a open therm gateway (OTGW) to intercept and modify the communications between my boiler and the Honeywell Round thermostat I have in the livingroom.

The situation is as follows, I have a rPi in the basement, connected to an RFLink and the smart meter. (The water meter is on the to-add list.) In the attic I have a rPi running some other software and a Synology NAS. The latter fails in running Domoticz and device sharing seems tedious with two different devices so I went with the pi.

Connected everything, setup device sharing per the manual and everything went fine. Or so I thought. Every time I changed the setpoint on the master Domoticz, a new device called ‘setpoint’ would appear on the slave and the setpoint would not be changed on the thermostat/boiler.
Googling this problem got me on two tracks: Write a script on the slave that fixes this or use the OTGW remotely via SER2NET. I chose the latter because I dind’t like the extra software on the pi in the attic anyway and this seemed less of a hassle.

Installing ser2net

SSH into your device and enter the following:

sudo apt update
sudo apt upgrade
sudo apt install ser2net -y

Find out where your OTGW lives and enter:

dmesg | grep tty

To be honest, I couldn’t make out which was the OTGW but since the other USB device is a hdd, I made an educated guess and it worked. I went with /dev/ttyUSB0
Next we will edit the ser2net config by opening the file.

sudo nano /etc/ser2net.config

In this file at the bottom, enter:
4000:raw:0:/dev/ttyUSB0:9600,NONE,1STOPBIT,8DATABITS
which breaks down into: ‘PORT:STATE:TIMEOUT:DEVICE:OPTIONS’ where 0 disables timeout and our options are the baudrate, parity, number of stop bits and number of data bits

Next, add a hardware device to your domoticz choosing ‘OpenTherm Gateway with LAN interface’ for type and connecting to the IP of your device and the port (4000 in our case*) you specified.
Allow new devices for 5 minutes and you’ll see the devices come to your Domoticz server!

* Don’t forget to open this port in your firewall if you have any. In case of UFW

sudo ufw allow from 192.168.1.0/24 to any port 4000 comment 'Allow OTGW ser2net on local lan'

Have fun!

Speak Your Mind

*