IOT Relay User Manual
IOT Relay User Manual
V1.9.8.1
1 Product Overview.............................................................................................................................4
1.1 Overview...............................................................................................................................4
1.2 Technical Parameters.............................................................................................................5
2 Image and Size.................................................................................................................................6
2.1 Hardware version <3.x.x......................................................................................................6
2.2 Hardware version >=V3.x.x.................................................................................................7
2.3 Case......................................................................................................................................8
3 Interface Description........................................................................................................................9
3.1 Power Supply........................................................................................................................9
3.2 Funcation.............................................................................................................................10
3.3 Relay Contact......................................................................................................................11
3.4 Reset To Factory..................................................................................................................12
3.4.1 Hardware Version <V3.x.x.....................................................................................12
3.4.2 Hardware Version >=V3.x.x...................................................................................13
3.5 Input Output and Power wiring diagram............................................................................14
3.6 Add Spark killer and contractor..........................................................................................15
4 Ethernet Web Page.........................................................................................................................16
4.1 Login...................................................................................................................................17
4.2 Setting Network..................................................................................................................17
4.3 Relay Connect.....................................................................................................................18
4.4 Relay CGI Test....................................................................................................................21
4.5 Relay Task...........................................................................................................................21
4.6 Input.....................................................................................................................................22
4.7 Input Link Relay.................................................................................................................23
4.8 IP WatchDog........................................................................................................................23
4.9 Reset User...........................................................................................................................24
4.10 To Factory..........................................................................................................................24
4.11 Reboot................................................................................................................................25
5 WIFI web Page...............................................................................................................................26
5.1 Login...................................................................................................................................26
5.2 Setting WIFI........................................................................................................................26
5.3 Setting Relay Connect.........................................................................................................27
5.4 Relay CGI Test....................................................................................................................30
5.5 Relay Task...........................................................................................................................31
5.6 Input.....................................................................................................................................31
5.7 Input Link Relay.................................................................................................................32
5.8 IP WatchDog........................................................................................................................32
5.9 Reset User...........................................................................................................................33
5.10 To Factory..........................................................................................................................33
6 IP Finder.........................................................................................................................................34
6.1 Search Device......................................................................................................................35
6.2 Change Static IP..................................................................................................................36
Appendix I How to Test Command..................................................................................................37
step 1: download SDK..............................................................................................................37
step 2: Change NetAssist language...........................................................................................38
step 3: Control relay via NetAssist network tool by wifi module............................................39
step 4: open UDP listen.............................................................................................................41
step 5: control relay via wifi module........................................................................................42
Appendix II How to use Domoticz...................................................................................................43
step 1: install Dingtian plugin to Domoticz..............................................................................43
1 Stop Domoticz................................................................................................................43
2 Copy Domoticz_plugins\dingtian to Domoticz plugin dir............................................43
step 2: config Dingtian Relay board.........................................................................................44
Domoticz Ethernet............................................................................................................44
Domoticz WIFI.................................................................................................................45
step 3: Add Dingtian Relay to Domoticz..................................................................................46
1 Install Python 3.8.2........................................................................................................46
2 Run to Domoticz............................................................................................................46
3 Add Dingtian Relay to Domoticz...................................................................................47
4 Control Dingtian Relay with Domoticz.........................................................................52
step 4: Domoticz mobile application........................................................................................54
1 Set the Location, User name and password on PC Domoticz.......................................54
2 Install Domoticz.............................................................................................................54
3 Set Domoticz Server parameter.....................................................................................55
Appendix III How to MQTT.............................................................................................................56
step 1: Install and config Broker...............................................................................................61
step 2: Install MQTT PC client.................................................................................................61
step 3: MQTTBox Add Client...................................................................................................61
step 4: MQTTBox Publish topic to relay board and subcribe topic.........................................63
Appendix IV How to CoAP..............................................................................................................64
step 1: compile libcoap..............................................................................................................64
step 2: CoAP Get relay status....................................................................................................64
step 3: CoAP Control relay(simple)..........................................................................................64
step 4: CoAP Control relay.......................................................................................................65
Appendix V How to “input mutual control”.....................................................................................67
Appendix VI How to Home Assistant...............................................................................................69
Step 1 config Relay board........................................................................................................69
Step 2 Install MQTT Broker....................................................................................................70
Step 3 Install Home Assistant..................................................................................................70
1 install python.................................................................................................................70
2 install Home Assistant...................................................................................................70
3 Add relay board Switch and input to Home Assistant..................................................70
4 Home Assistant config MQTT Broker..........................................................................72
Appendix VII How to openHAB......................................................................................................76
Step 1 config Relay board........................................................................................................76
Step 2 Install MQTT Broker....................................................................................................77
Step 3 install JDK and openHAB............................................................................................77
1 Download......................................................................................................................77
2 install.............................................................................................................................78
3 Add jdk directory to “start.bat”.....................................................................................79
4 First time init openHAB................................................................................................80
Step 4 Add Dingtian Relay board to openHAB.......................................................................83
1 Change json MQTT broker host, username,password..................................................83
2 Change json SN(example SN 7920) to you relay board SN........................................83
3 Cover openHAB json....................................................................................................87
4 Control relay board with openHAB..............................................................................87
1 Product Overview
1.1 Overview
Support Ethernet, WiFi, RS485, CAN
10/100Mbps ethernet, Auto-MDIX,DHCP ip,Static IP
WiFi 802.11 b/g/n, MAX 150Mbps
Digital input, can be Local Button control(SelfLock/Jogging/Delay)
Support RELAY On/OFF/Jogging/Delay.
Support HTTP GET CGI, UDP, TCP Server, TCP Client
Support Modbus-RTU/ASCII/TCP/UDP/WIFI
Support Modbus-RTU Over TCP/UDP/WIFI
Support Modbus-ASCII Over TCP/UDP/WIFI
Support WEB control
Support MQTT, CoAP
Support NTP, IP Watchdog, Task timer
Support Domoticz, Home Assistant, openHAB
Our max current is 10A, if the current of your device is too big, suggest add a contractor
4 Ethernet Web Page
IE is not support, please use firefox and chrome
4.1 Login
Default IP: 192.168.1.100
user: admin
password: admin
Parameter:
Software Version: Relay board firmware version
Model:
2CH is Dingtian IOT RELAY-2
4CH is Dingtian IOT RELAY-4
8CH is Dingtian IOT RELAY-8
Serial Number: Relay board Serial Number
Date Time: current date and time(Need internet because of NTP)
NTP Server: NTP server get time from, suggest use pool.ntp.org
DHCP: Ethernet IP DHCP or Static
IP: Ethernet current IP Address
Netmask: Ethernet current Netmask
Gateway: Ethernet current Gateway
DNS: Ethernet current DNS Server
MAC: Ethernet current MAC address
Channel Parameter:
RS485: RS485 protocol, addr, baudrate, databits, stopbits, parity config
Protocol:
Dingtian String
Dingtian Binary
Modbus-RTU
Modbus-ASCII
Baudrate:
1200bps,2400bps,4800bps,9600bps,19200bps,38400bps,57600bps,115200bps
CAN: CAN protocol, ID, Speed config
Protocol:
Dingtian String
Dingtian Binary
Modbus-RTU(0x03,0x06),only support Read/Write single register once time
Speed:
5Kbps,10Kbps,20Kbps,25Kbps,50Kbps,100Kbps,125Kbps,200Kbps,250Kbps,500Kbps,800Kbps,888
Kbps,1Mbps
ETH-UDP1: Ethernet UDP1 protocol, Remote Server Address,Remote Server Port,Local Port config
Protocol:
Dingtian String
Dingtian Binary
Modbus-RTU Over UDP
Modbus-ASCII Over UDP
Modbus-UDP
CoAP(need change port to 5683)
Input Mutual Control
ETH-UDP2: Ethernet UDP2 protocol, Remote Server Address,Remote Server Port,Local Port config
Protocol:
Dingtian String
Dingtian Binary
Modbus-RTU Over UDP(use RS485 addr)
Modbus-ASCII Over UDP(use RS485 addr)
Modbus-UDP
CoAP(we suggest enable CoAP at ETH/WiFi-UDP2)
Input Mutual Control
ETH-TCP Server: Ethernet TCP Server protocol, Local Port config
Protocol:
Dingtian String
Dingtian Binary
Modbus-RTU Over TCP(use RS485 addr)
Modbus-ASCII Over TCP(use RS485 addr)
Modbus-TCP
ETH-TCP Client: Ethernet TCP Client protocol, Remote Server Address,Remote Server Port config
Protocol:
Dingtian String
Dingtian Binary
Modbus-RTU Over TCP(use RS485 addr)
Modbus-ASCII Over TCP(use RS485 addr)
Modbus-TCP
ETH-MQTT: Ethernet MQTT protocol, Broker Address, Broker Port, Broker Username, Broker
Password config
Protocol:
MQTT(without tls)
Other Parameter:
Relay Password: use for checking control is valid, only correct password control relay board
Keep Alive Second: send relay status to server with every “Keep Alive Second”, only protocol
Dingtian String and Dingtian binary have Keep Alive Second
Jogging Time: Jogging time, default is 500ms,1=100ms
what is Jogging: ON then delay 500ms OFF,or OFF then delay 500ms ON,
Power Failure Recovery Relay: relay status will restore after re-power
Input Control Relay: Input link relay output
4.8 IP WatchDog
When Enable IP WatchDog function, all relay ON, when the “Watch IP” offline, relay OFF, after
seconds, the relay ON automatically, “Ping Interval” must be bigger than “Ping Timeout”
4.9 Reset User
4.10 To Factory
4.11 Reboot
5 WIFI web Page
IE is not support, please use firefox and chrome
5.1 Login
Default IP: 192.168.7.1
user:admin
password:admin
5.6 Input
5.7 Input Link Relay
Select R1~R8, means you add the relay to link with Input, Click the green button R1~R8 means
delete relay
5.8 IP WatchDog
When Enable IP WatchDog function, all relay ON, when the “Watch IP” offline, relay OFF, after
seconds, the relay ON automatically, “Ping Interval” must be bigger than “Ping Timeout”
5.9 Reset User
5.10 To Factory
6 IP Finder
Notice:
please close all firewall,security software(windows defender/firewall alse must close)
otherwise nothing will be find
6.1 Search Device
Note: When you use IP Finder to check your relay board ip, please keep your computer just
connect with one relay board and the communication of relay board just has one(only Ethernet
or WIFI)
Change Static IP and Click”Write IP”, then your relay board ip is 192.168.12.100
Appendix I How to Test Command
step 1: download SDK
we can find network tool in SDK
http://www.dingtian-tech.com/sdk/relay_sdk.zip
unzip relay_sdk.zip
network tool name is net_test
rs485 tool name is rs485_test
1 Stop Domoticz
Domoticz Ethernet
Domoticz WIFI
after download,install it
2 Run to Domoticz
3 Add Dingtian Relay to Domoticz
1 Find Hardware Menu
result
4 Control Dingtian Relay with Domoticz
Switch “Switches” page
2 Install Domoticz
Android google play “Domoticz Home Automation Lite”, which is free of charge and cannot
refresh automatically. So please refresh by manual after do it
3 Set Domoticz Server parameter
Domoticz mobile connect successfully, then you can control the switch by mobile phone
Appendix III How to MQTT
MQTT Ethernet
MQTT WIFI
Relay board Ethernet MQTT Client Id
dingtian-relay+SN
Relay board WiFi MQTT Client Id
dingtian-wrelay+SN
example:
below relay board “Serial Number” is 1868
so ETH MQTT client id is:dingtian-relay1868
so WiFI MQTT client id is:dingtian-wrelay1868
Relay board MQTT Topic and Publish format:
below V2.15.869
/dingtian/relay/in/control
/dingtian/relay/out/relayX
above V2.15.869
/dingtian/relaySN/in/control
/dingtian/relaySN/out/relayX
above V2.17.xx
ETH
/dingtian/relaySN/in/control
/dingtian/relaySN/in/rX
/dingtian/relaySN/out/rX
/dingtian/relaySN/out/iX
/dingtian/relaySN/out/relayX
/dingtian/relaySN/out/inputX
/dingtian/relaySN/out/ip
/dingtian/relaySN/out/sn
/dingtian/relaySN/out/mac
/dingtian/relaySN/out/input_cnt
/dingtian/relaySN/out/relay_cnt
WiFi
/dingtian/wrelaySN/in/control
/dingtian/wrelaySN/in/rX
/dingtian/wrelaySN/out/rX
/dingtian/wrelaySN/out/iX
/dingtian/wrelaySN/out/relayX
/dingtian/wrelaySN/out/inputX
/dingtian/wrelaySN/out/ip
/dingtian/wrelaySN/out/sn
/dingtian/wrelaySN/out/mac
/dingtian/wrelaySN/out/input_cnt
/dingtian/wrelaySN/out/relay_cnt
example:
below V2.15.869
/dingtian/relay/in/control
/dingtian/relay/out/relay1
/dingtian/relay/out/relay2
/dingtian/relay/out/relay3
/dingtian/relay/out/relay4
/dingtian/relay/out/relay5
/dingtian/relay/out/relay6
/dingtian/relay/out/relay7
/dingtian/relay/out/relay8
above V2.15.869
/dingtian/relay1868/in/control
/dingtian/relay1868/out/relay1
/dingtian/relay1868/out/relay2
/dingtian/relay1868/out/relay3
/dingtian/relay1868/out/relay4
/dingtian/relay1868/out/relay5
/dingtian/relay1868/out/relay6
/dingtian/relay1868/out/relay7
/dingtian/relay1868/out/relay8
above V2.17.xx
ETH
/dingtian/relay1868/in/control
/dingtian/relay1868/in/r1~8
/dingtian/relay1868/out/r1~8
/dingtian/relay1868/out/i1~8
/dingtian/relay1868/out/relay1~8
/dingtian/relay1868/out/input1~8
/dingtian/relay1868/out/ip
/dingtian/relay1868/out/sn
/dingtian/relay1868/out/mac
/dingtian/relay1868/out/input_cnt
/dingtian/relay1868/out/relay_cnt
WIFI
/dingtian/wrelay1868/in/control
/dingtian/wrelay1868/in/r1~8
/dingtian/wrelay1868/out/r1~8
/dingtian/wrelay1868/out/i1~8
/dingtian/wrelay1868/out/relay1~8
/dingtian/wrelay1868/out/input1~8
/dingtian/wrelay1868/out/ip
/dingtian/wrelay1868/out/sn
/dingtian/wrelay1868/out/mac
/dingtian/wrelay1868/out/input_cnt
/dingtian/wrelay1868/out/relay_cnt
type:ON/OFF,DELAY,JOGGING
idx:1~8
status:ON,OFF
time: (ON/OFF)0,(DELAY)1~65535second,(JOGGING)1~255*100ms
pass:0~9999
example:
{"type":"ON/OFF",'idx':'1',"status":"ON","time":"0","pass":"0"}
{"type":"DELAY",'idx':'2',"status":"ON","time":"5","pass":"0"}
{"type":"JOGGING",'idx':'3',"status":"ON","time":"5","pass":"0"}
{"type":"ON/OFF",'idx':'4',"status":"OFF","time":"0","pass":"0"}
idx:1~8
status:ON,OFF
example:
{“idx”:”1”,”status”:”OFF”}
1 config “mosquitto.conf”
bind_address 0.0.0.0
port 1883
Protocol:mqtt/tcp
Host:192.168.1.88:1883(Broker server ip and port)
Username:mqtt
Password:123
Broker MQTT V3.1.1 compliant
Config Relay board Web page MQTT parameter
step 4: MQTTBox Publish topic to relay board and subcribe
topic
Appendix IV How to CoAP
you need linux system
example:
1:ON/OFF:0:4660
status:1
type:ON/OFF
time:0
password:4660
ON/OFF example:
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r1
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r2
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r3
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r4
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r5
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r6
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r7
./coap-client -e "1:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r8
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r1
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r2
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r3
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r4
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r5
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r6
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r7
./coap-client -e "0:ON/OFF:0:4660" -m put coap://192.168.1.100/dingtian/r8
DELAY example:
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r1
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r2
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r3
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r4
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r5
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r6
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r7
./coap-client -e "1:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r8
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r1
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r2
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r3
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r4
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r5
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r6
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r7
./coap-client -e "0:DELAY:5:4660" -m put coap://192.168.1.100/dingtian/r8
JOGGING example:
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r1
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r2
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r3
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r4
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r5
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r6
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r7
./coap-client -e "1:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r8
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r1
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r2
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r3
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r4
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r5
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r6
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r7
./coap-client -e "0:JOGGING:5:4660" -m put coap://192.168.1.100/dingtian/r8
Appendix V How to “input mutual control”
Example param:
DevA IP: 192.168.1.100
DevB IP: 192.168.1.101
SDK path:
MQTT\home_assistant_example.yaml
- platform: mqtt
unique_id: dingtian100-r2
name: "Dingtian Ethernet Switch2"
state_topic: "/dingtian/relay100/out/r2"
command_topic: "/dingtian/relay100/in/r2"
availability:
- topic: "/dingtian/relay100/out/lwt_availability"
payload_available: "online"
payload_not_available: "offline"
payload_on: "ON"
payload_off: "OFF"
state_on: "ON"
state_off: "OFF"
optimistic: false
qos: 0
retain: false
binary_sensor:
- platform: mqtt
unique_id: dingtian100-i1
name: "Dingtian Ethernet Input1"
state_topic: "/dingtian/relay100/out/i1"
availability:
- topic: "/dingtian/relay100/out/lwt_availability"
payload_available: "online"
payload_not_available: "offline"
payload_on: "ON"
payload_off: "OFF"
qos: 0
- platform: mqtt
unique_id: dingtian100-i2
name: "Dingtian Ethernet Input2"
state_topic: "/dingtian/relay100/out/i2"
availability:
- topic: "/dingtian/relay100/out/lwt_availability"
payload_available: "online"
payload_not_available: "offline"
payload_on: "ON"
payload_off: "OFF"
qos: 0
######################### end #########################
step 2
step 3
step 4
step 5
step 6
restart Home Assistant
Ctrl+C hot key to Stop Home Assistant
hass –open-ui to start Home Assistant
step 6
new Home Assistant can control relay and get input status
Appendix VII How to openHAB
Notice:
1 Close your firewall
2 All command and script run as root/administrator
3 please step by step
4 Stop openHAB
Step 4 Add Dingtian Relay board to openHAB
2ch_config for 2 channel relay board
4ch_config for 4 channel relay board
8ch_config for 8 channel relay board
Notice:
example openHAB install path “D:\tool\openHAB\openhab-3.2.0”
control relay