Has anyone used Dingtian 8ch Ethernet Relay?

Hi

I think, yes. I used option in setup “Power Failure Recovery Relay” in menu: “Relay Connect”.
When this option is set “Yes”, The switch remembers last state of all relay’s after crash.

BR
Dariusz

Thx for a tip. Gonna to test it but it works. I have got a short delay but accepteable.
R

Can they be flashed with ESPhome?

Hi.
I tried with this codes, both works, but when reboot HA, all relays are exciting and garaje door is open!!!

Why HA do on/off relays after reboot?
I tried with this codes:

switch 12:
    platform: mqtt
    name: "R1"
    command_topic: "/dingtian/relay2894/in/control"
    state_topic: "/dingtian/relay2894/out/r1"
    retain: true
    payload_on: '{"type":"JOGGING","idx":"1","status":"ON","time":"5","pass":"1234"}'
    payload_off: '{"type":"ON/OFF","idx":"1","status":"OFF","time":"0","pass":"1234"}'
    state_on: "ON"
    state_off: "OFF"

switch 12:
    platform: mqtt
    name: "R1"
    command_topic: "/dingtian/relay2894/in/control"
    state_topic: "/dingtian/relay2894/out/r1"
    retain: false
    availability:
        - topic: "/dingtian/relay2894/out/lwt_availability"
          payload_available: "online"
          payload_not_available: "offline"
    payload_on: '{"type":"JOGGING","idx":"1","status":"ON","time":"5","pass":"1234"}'
    payload_off: '{"type":"ON/OFF","idx":"1","status":"OFF","time":"0","pass":"1234"}'
    state_on: "ON"
    state_off: "OFF"

Thanks u and regards

Hi.
the problem is of hardware, i upgrade to last versión firmware, but still failing…
When Digntian relay (re)connect to MQQT Broker installed in HA the relay number 1 (only number 1) do on/off.
the “solution” is stop to use the relay 1, i dont know is this problem is only for my hardware or is a global fail for this digntian relay.
Thanks u

Hello guys!

I have dingtian relay board, and I am working on custom firmware for it to support MQTT with mqtt discovery. And “clean” firmware with just what i need - not 100services running and broadcasting into my home network. If you are interested i will release it soon for testing :slight_smile:

One problem is, once you flash the firmware, there is no going back to original one (why would i do that? :slight_smile:

Right now i have working mqtt client (basic, with no retry yet if connections gets broken) with control of all 4 relays, 4 inputs (independent of relays).

I will probably create new thread once this is released

2 Likes

Hi Michal, so how’s your firmware?

Firmware is here:

There is no manual at all, you need gnuarm to build it, and openocd to program it. I dont really have time to make the manual now :slight_smile:

1 Like

any idea if you will ever release this?

what do you mean ? :slight_smile: … its there on github, you just need to build it, and load into dingtian relay board. Dont expect any fancy features any time soon. Basic MQTT input/output works. No autodiscovery.

HI i added the code as suggested in the manual to YAML as shown below. everything seems to function as expected but i get 2 repairs in settings but i am not sure how to debug the issue or tell what is going on.

sw

bin

rep

switch:
  - platform: mqtt
    unique_id: dingtian7777-r1
    name: "Gate Ethernet Switch1"
    state_topic: "/dingtian/relay7777/out/r1"
    command_topic: "/dingtian/relay7777/in/r1"
    availability:
    - topic: "/dingtian/relay7777/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
  - platform: mqtt
    unique_id: dingtian7777-r2
    name: "Gate Ethernet Switch2"
    state_topic: "/dingtian/relay7777/out/r2"
    command_topic: "/dingtian/relay7777/in/r2"
    availability:
    - topic: "/dingtian/relay7777/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: dingtian7777-i1
   name: "Gate Ethernet Input1"
   state_topic: "/dingtian/relay7777/out/i1"
   availability:
   - topic: "/dingtian/relay7777/out/lwt_availability"
     payload_available: "online"
     payload_not_available: "offline"
   payload_on: "ON"
   payload_off: "OFF"
   qos: 0

 - platform: mqtt
   unique_id: dingtian7777-i2
   name: "Gate Ethernet Input2"
   state_topic: "/dingtian/relay7777/out/i2"
   availability:
   - topic: "/dingtian/relay7777/out/lwt_availability"
     payload_available: "online"
     payload_not_available: "offline"
   payload_on: "ON"
   payload_off: "OFF"
   qos: 0

Any help would be great thanks

Hi i have found the solution to my error above. It is because the user manual has the old way of doing the code. Here is a fantastic video of how to do it as expected now Your MQTT Sensors need your attention

Thanks for the answer.

Any idea if the firmware could be modified to allow esphome?

Hello Stef,

It looks like that it would be possible! There is a pin layout of the print with also the GPIO pins.
So flashing ESPHOME and make some switches and inputs sounds possible.

Thetmar

Hey Thetmar,

I looked in to this and it’s not possible because the bootloader is locked.

So if I get it right

1 Like

Actually, I got the LWT function functioning perfectly fine on my relay:

mqtt:
  button:
    - unique_id: button-gate-open
      name: "Open Gate"
      command_topic: "/dingtian/relay1234/in/control"
      availability:
        - topic: "/dingtian/relay1234/out/lwt_availability"
          payload_available: "online"
          payload_not_available: "offline"
      payload_press: '{\"type\":\"JOGGING\",\"idx\": \"1\",\"status\":\"ON\",\"time\":\"5\",\"pass\":\"0\"}'
      qos: 0
      retain: false
      device:
        name: "Dingtian 8 port Relay 1234"
        connections:
          - ["mac", "12:34:56:78:90:AB"]
        configuration_url: "http://192.168.1.12"
        hw_version: "V3.6J"
        sw_version: "V3.1.1759A"
        manufacturer: "Dingtian"
        model: "DT R008"
        suggested_area: "Outside"

The gate control only needs a momentary input, so I thought it would be better to add it as a button…
I have no idea why I have to escape all the quotation marks in the payload but the configuration check complains if I don’t do so…
Nice addition is the device info, like this it gathers all relevant info for the button and groups all buttons and binary_sensors from this device. I quite like it!

Just curious if anyone has a comment on the reliability of these Dingtian relay boards? Also, is there a delay with their input sensors, or is HA notified immediately? Thanks!

I have mine for over a year and they are working really well.
I use MQTT with HA and the response is instant. (less than a second)

I’m on firmware V3.1.1384 because in the newer firmware there is an issue with MQTT. They are still looking for a fix (I mailed them 3 weeks ago regarding the issue)

They use their own firmware on the ESP32 boards so you can’t flash other firmware on it (no ESPhome by example)

1 Like

Try this one GitHub - kecajtop/dtr0xx_io