Introduction
DomBus are modules designed for industrial and home automation systems that are available with 2 different protocols:
- DomBus protocol, that is supported by Domoticz home automation controller, is a reliable protocol that permits to manage dozens of modules and get status from modules as soon as they changes. Also it includes the so-called DCMD commands that, similarly to KNX, are transmitted between DomBus modules in the same bus to activate outputs in case of events (switch or pushbutton pressed, temperature value, power value, ....) without needing for the intervention or the home automation controller, useful solution to get a home automation system that works even in case of domotic controller fault. The Creasol DomBus plugin have to be installed in Domoticz, using the Python Plugin Manager or downloading the software from GitHub (see the section below).
- Modbus RTU protocol, widely used in industrial and home automation systems, is supported by almost any domotic controller like Home Assistant, OpenHAB, IObroker, Node-RED, ...
Modbus is a master-slave protocol that permits to activate and deactivate a single relay, all relays or a group of relays by a single command. Also, it's possible to specify, for each relay, the ON time from 31.5ms to 1500 days, so the relay automatically switches OFF after the selected time.
The Modbus RTU version can be used by Node-RED system to realize flows including relay outputs, digital and analog inputs, temperature, humidity, energy sensors, electric vehicle charging station, and more.
Configuration
First, the modbus palette should be enabled: if not already enabled, type the command
npm install node-red-contrib-modbus
then restart Node-RED.
The above flow shows how to use the 8 relays module DomBus31 with Node-RED: drag Modbus-Write to the flow, and configure it as shown in the picture.
To have complete information about DomBus modules, check https://www.creasol.it/domotics
Below some information about the 8 relay module DomBus31
DomBus31 module Modbus RTU capabilities
The following specifications refers the Modbus version: DomBus31 is available with 2 firmware, DomBus protocol and Modbus protocol, so the latter firmware should be chosen in this case.
Default slave address: 49 (0x31)
Addr | Name | Values | Description |
0 | RL1 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPST relay output, NO contact, 5A 250Vac or 30Vdc output capability. Relay contact is protected by varistor |
1 | RL2 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPST relay output, NO contact, 5A 250Vac or 30Vdc output capability. Relay contact is protected by varistor |
2 | RL3 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPST relay output, NO contact, 5A 250Vac or 30Vdc output capability. Relay contact is protected by varistor |
3 | RL4 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPST relay output, NO contact, 5A 250Vac or 30Vdc output capability. Relay contact is protected by varistor |
4 | RL5 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPST relay output, NO contact, 5A 250Vac or 30Vdc output capability. Relay contact is protected by varistor |
5 | RL6 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPST relay output, NO contact, 5A 250Vac or 30Vdc output capability. Relay contact is protected by varistor |
6 | RL7 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPDT relay output, NO + NC contacts, 10A 250Vac or 250Vdc output capability. Relay contact is protected by varistor |
7 | RL8 | 0=OFF, 65280=ON, 1-65279=ON for specified time | SPDT relay output, NO + NC contacts, 10A 250Vac or 250Vdc output capability. Relay contact is protected by varistor |
255 | All relays | 0=OFF, 65280=ON, 1-65279=ON for specified time | This address is used to switch ON or OFF all relays with a single short command |
8192 | Slave Address | 1-250 | Permits to change the slave address of the module, so it's possible to add new DomBusXX modules to the same bus |
8193 | Serial bitrate | 0=115200bps, 1=57600, 2=38400, 3=19200, 4=9600, 5=4800, 6=2400, 7=1200bps | Serial speed, default 115200 bps 8,n,1 |
8194 | Serial parity | 0=none, 1=even, 2=odd | Serial parity, default none (115200 bps 8,n,1) |
8198 | Revision, major | Read only | Get revision number. For example "02" means that revision is "02XX" where XX defined by parameter 8199 |
8199 | Revision, minor | Read only | Get revision number, minor number. For example "h1" means that revision is "XXh1" where XX defined by parameteri 8198 |
It's possible to activate one or more outputs for a certain amount of time (monostable/timer output) as indicated in the table. The parameter corresponding to the needed time can be computed using the following rules:
From 0 to 60s => 31.25ms resolution 1=31.25ms, 1920=60s => value=time_in_milliseconds/32
From 1m to 1h with 1s resolution 1921=61s, 3540+1920=5460=1h => value=(time_in_seconds-60)+1920
From 1h to 1d with 1m resolution 5461=1h+1m, 1380+5460=6840=24h => value=(time_in_minutes-60)+5460
From 1d to 1500 days with 1h resolution 6841=25h, 6842=26h, and so on => value=(time_in_hours-24)+6840
The following tables show some Modbus commands examples.
Slave Addr | Func. Code | Reg.Addr | Reg.Value | Frame | Description |
49 | 06 | 8192 | 1 | [31][06][20][00][00][01][46][3A] | Change slave address from 49 (0x31) to 1 |
01 | 06 | 8193 | 4 | [01][06][20][01][00][04][D2][09] | Set serial speed to 9600bps |
01 | 06 | 8194 | 1 | [01][06][20][02][00][01][E2][0A] | Set even parity |
49 | 10 | 8192 | 1,4,1 | [31][10][20][00][00][03][06][00][01][00][04][00][01][B1][71] | With a single command, set slave address to 1, serial speed to 9600bps, even parity. Please note that no answer will be sent back to this command. |
01 | 06 | 0 | 65280 | [01][06][00][00][FF][00][C8][3A] | Activate RL1 output forever (65280=0xff00) |
01 | 06 | 1 | 960 | [01][06][00][01][03][C0][D8][AA] | Activate RL2 for 960/32=30s |
01 | 06 | 255 | 0 | [01][06][00][FF][00][00][B9][FA] | Disable all outputs (Reg.Addr=255) |
01 | 10 | 0 | 32,0,0,65280 | [31][10][00][00][00][04][08][00][20][00][00][00][00][FF][00][E6][5C] | Set RL1 On for 1s (32), RL2 Off, RL3 Off, RL4 On - Max 10 registers can be set in one command |
01 | 03 | 255 | 1 | [01][03][00][FF][00][01][B4][3A] | Read a 16bit value with ports status. For example if returned value is 0xd1 (0b11010001), output status is: RL8=On, RL7=On, RL6=Off, RL5=On, RL4=Off, RL3=Off, RL2=Off, RL1=On |
01 | 03 | 8198 | 2 | [01][03][20][06][00][02][2F][CA] | Read 4 bytes within module version. For example, if returned value is <30><32><68><31> (in hex format), the corresponding ASCII value is "02h1" (Firmware 02h1) |
01 | 0F | 0 | 8,1,0xd1 | [01][0F][00][00][00][08][01][D1][3E][C9] | Set coil status to 0xd1 (0b11010001), activating RL8, RL7, RL5, RL1 and disabling other relays |
01 | 01 | 0 | 8 | [01][01][00][00][00][08][3D][CC] | Read coil status. If returned value is 0xd1 (0b11010001), it means that RL8, RL7, RL5 and RL1 are On |