DomBus modules are connected together by a serial bus, using a thin/common alarm cable with 4 wires: 2 to carry the 12-24V power supply and 2 wires for data at 115200bps 8,n,1.
Normally, the bus is connected to the domotic controller by a cheap RS485/USB adapter.
In case that the bus cannot be physically connected to the domotic controller (different area, no cable, ...), it's possible to use a TCP tunnel to keep into communication the domotic controller (with a virtual serial device) with the DomBus network.
To achieve the virtual serial tunnel over TCP/IP it's possible to use the following solutions.
Virtual serial over TCP/IP between two linux devices
If domotic controller is hosted in a linux device (for example a Raspberry PI or NUC, now called "main") and the DomBus devices are connected to another linux device (Raspberry, Rock PI S, QNAP, ..., now called "slave"), it's possible to have the main controller connecting the DomBus network by a TCP/IP connection, wired or wireless, in this way:
- On the slave device (where the DomBus network is connected using the cheap USB/RS485 adapter), install the ser2net service:
sudo apt install ser2net - Configure the ser2net service by modifying the file /etc/ser2net.yaml :
sudo nano /etc/ser2net.yaml - Remove existing connections that are not used, and insert the following lines to define the connection with one bus:
connection: &dombus
accepter: tcp,2000
enable: on
options:
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/ttyUSB0,
115200n81,local
- It's possible to modify the tcp port (2000, in the example) and serial port (ttyUSB0 in the example).
- In case that more than one DomBus bus are connected to the slave device, define a connection for each bus (specifying a different TCP port for each bus).
- Restart the ser2net service using the command service ser2net restart
- Test that it works by using the command telnet localhost 2000 on the slave device; ctrl+] to exit
- On the main device (with Domoticz, Home Assistant, Node-RED, OpenHAB controller...) install the socat application:
sudo apt install socat - Exec the following command to create the virtual serial port /dev/ttyUSBDomBusNet to manage the DomBus devices attached to the slave device: socat pty,link=/dev/ttyUSBDomUSBBusNet tcp:192.168.6.2:2000 where 192.168.6.2 should be replaced with the IP number of the slave device
- In case that connection is done through internet or one or more routers with NAT, maybe it's needed to configure port forwarding / destination NAT on the routers
- Test the whole system by executing the command cat /dev/ttyUSBDomBusNet : if it works, write a small bash script to activate the virtual serial port, and call that script from /etc/rc.local assuring that there is the "&" character at the end, to execute the script in background:
#!/bin/bash
# New file /usr/local/sbin/dombusnet.sh , permissions 0700
# Thanks to Patrick Schaerer for testing and suggestions
TTYDEV=/dev/ttyUSBDomBusNet
TCPSERVER=192.168.6.2
TCPPORT=2000
while true; do
socat pty,link=${TTYDEV},waitslave tcp:${TCPSERVER}:${TCPPORT}
sleep 5
done
# End of file
# File /etc/rc.local
# ........
/usr/local/sbin/dombusnet.sh &
exit 0
This is a the cheaper solution to control DomBus modules by a wired or wireless connection in case that DomBus modules are located in a area where a linux device is already active
Connecting DomBus modules by using a RS485 to Ethernet or WiFi converters
Using an ethernet <--> RS485 converter like MOXA NPORT or other devices it's really simple to connect RS485 devices (DomBus modules, or other Modbus RTU modules) that are placed in a different area from the controller.
In this case a driver should be installed to create a virtual COM port (virtual serial port) to access the remote RS485 bus.
Below a list of RS485 to ethernet converters:
- Waveshare RS485 to WiFi / Ethernet : not tested, but the manufacturing company says it works using socat program (Linux)
- Waveshare RS485 TO ETH (available also with PoE support) : not tested, but the manufacturing company says it works using socat program (Linux)
- PUSR W610 RS485/RS232 to WiFi/Ethernet : not tested, but the manufacturing company says it works using socat program (Linux) or Windows software provided by the manufacturer. TCP port is configurable on the module (Local/Remote port number)
- Protoss PW11 or PW21 RS485 to WiFi/Ethernet : not tested, but it should work
If you know other devices that can be used for this purpose at reasonable prices, please let us know.
Using ESP32 + ESPHome to connect Modbus modules like DomBus
Slawomir describes in the github page https://github.com/SCiunczyk/wallbox-diy how to use ESP32 + ESPHome firmware to create a gateway between Modbus devices and Home Assistant, using WiFi. This is only a part of the described project, that permits to charge an electric vehicle by using single-phase (low power, from 1kW to 7kW, generally used in Solar mode) and three-phase power (used to charge the vehicle at full speed, from 4kW to 22kW) by using the Creasol DomBusEVSE module.
Thanks to Slawomir for sharing info about his very smart wallbox!