{"id":86,"date":"2020-10-02T20:56:29","date_gmt":"2020-10-02T19:56:29","guid":{"rendered":"https:\/\/daniel.schoenmaker.xyz\/?p=80"},"modified":"2020-10-02T20:56:29","modified_gmt":"2020-10-02T19:56:29","slug":"otgw-on-remote-pi-with-ser2net","status":"publish","type":"post","link":"https:\/\/daniel.schoenmaker.xyz\/?p=86","title":{"rendered":"OTGW on remote pi with ser2net"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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 &#8216;setpoint&#8217; would appear on the slave and the setpoint would not be changed on the thermostat\/boiler.<br>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&#8217;t like the extra software on the pi in the attic anyway and this seemed less of a hassle.<\/p>\n\n\n\n<p><strong>Installing ser2net<\/strong><\/p>\n\n\n\n<p>SSH into your device and enter the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt upgrade\nsudo apt install ser2net -y<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Find out where your OTGW lives and enter:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dmesg | grep tty\ufeff<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>To be honest, I couldn&#8217;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<br>Next we will edit the ser2net config by opening the file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/ser2net.config<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>In this file at the bottom, enter:<br><code>4000:raw:0:\/dev\/ttyUSB0:9600,NONE,1STOPBIT,8DATABITS<\/code><br>which breaks down into: &#8216;PORT:STATE:TIMEOUT:DEVICE:OPTIONS&#8217; where 0 disables timeout and our options are the baudrate, parity, number of stop bits and number of data bits<\/p>\n\n\n\n<p>Next, add a hardware device to your domoticz choosing &#8216;OpenTherm Gateway with LAN interface&#8217; for type and connecting to the IP of your device and the port (4000 in our case*) you specified.<br>Allow new devices for 5 minutes and you&#8217;ll see the devices come to your Domoticz server!<\/p>\n\n\n\n<p>* Don&#8217;t forget to open this port in your firewall if you have any. In case of UFW<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow from 192.168.1.0\/24 to any port 4000 comment 'Allow OTGW ser2net on local lan'<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Have fun!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wordproof_timestamp":false},"categories":[10,13,6],"tags":[17,20,21,24,25,26],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-domotica","category-raspberry-pi","category-tech","tag-domoticz","tag-lan","tag-otgw","tag-raspberry-pi","tag-rpi","tag-ser2net"],"_links":{"self":[{"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=86"}],"version-history":[{"count":0,"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=\/wp\/v2\/posts\/86\/revisions"}],"wp:attachment":[{"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/daniel.schoenmaker.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}