32 channel ethernet relay module – KinCony KC868-H32

Set your ethernet for MQTT in network setting webpage, set the broker IP,Port, MQTT user name and password.

Example configuration.yaml entry for relay1 output:

switch:
– platform: mqtt
name: ‘relay16B-1’
unique_id: relay16B-1
state_topic: ‘relay16/xxxxxxxxxxxxxxxxxxxxxxxx/state’
command_topic: ‘relay16/xxxxxxxxxxxxxxxxxxxxxxxx/set’
payload_on: ‘{“relay1”:{“on”:1}}’
payload_off: ‘{“relay1”:{“on”:0}}’
value_template: ‘{{ value_json.relay1.on }}’
state_on: 1
state_off: 0

Example configuration.yaml entry for input1 sensor:

binary_sensor:
– platform: mqtt
name: ‘H16B-input1’
unique_id: H16B-input1
state_topic: ‘relay16/xxxxxxxxxxxxxxxxxxxxxxxx/state’
value_template: ‘{{ value_json.input1.on }}’
payload_on: 1
payload_off: 0

Note: xxxxxxxxxxxxxxxxxxxxxxxx is your KC868-H16B’s ID, it’s 24bit. You can find in controller’s config webpage.

1 Like

Hello @KinCony, thank you very much. :+1:
Got it working now!

Hello @KinCony. I have a question about COLB logical controller. How can I read the data from the modbus connected 1P power meter in home assistant? Thank you.

yes, no problem, we have this demo video by node-red flow.

yes, no problem, we have this demo video by node-red flow.

Want to share a solution in the event people struggle with mqtt. For some reason i cant get my panel traffic to update and dont have time now to find out.
So i created a command line swithch.
see below:

- platform: command_line
  switches:
    poolbtn2:
      command_on: "curl -k --silent 'http://192.168.1.136/sw_ctl.cgi?Relay02=ON&postpwd=passwd'"
      command_off: "curl -k --silent 'http://192.168.1.136/sw_ctl.cgi?Relay02=OFF&postpwd=passwd'"
      command_state: curl -k --silent 'http://192.168.1.136/sw_ctl.cgi?RelayFF=RD&postpwd=passwd' | grep -oP "(?<=btn2)(.*)(?=btn3)"
      value_template: '{{"ON" in value}}'
      friendly_name: poolbtn2

for a different button just change the relay number and the regex limiters in the grep command for state.

for example for button 4 youd change to | grep -oP “(?<=btn4)(.*)(?=btn5)”

Until I removed my furnace valves from my kc868-h32b (they apparently need RC snubbers), I also experienced issues with mqtt which stopped responding after a few days.
I wrote an automation to switch on and then off a random (unused) relay every four hours to warn me about an mqtt issue with my Kincony device:

- id: 'check kincony mqtt connectivity'
  alias: 'check Kincony mqtt connectivity'
  description: ''
  trigger:
  - platform: time_pattern
    hours: /4
  variables:
    random_relay: "{{ 'switch.relay32b_' + ['11','12','13','14','15','16','18','19','20','21','22','23','24','29','30','31','32']|random }}"
  condition: []
  action:
  - service: script.send_text_telegram
    data:
      title: kincony test
      message: "checking with {{ random_relay }}"
      type: debug
  - service: switch.turn_on
    target:
      entity_id: "{{ random_relay }}"
  - delay:
      seconds: 20
  - service: "input_boolean.turn_{{ 'on' if is_state(random_relay,'off') else 'off' }}"
    target:
      entity_id: input_boolean.kincony_bug_detected
  - service: switch.turn_off
    target:
      entity_id: "{{ random_relay }}"
  - condition: state
    entity_id: input_boolean.kincony_bug_detected
    state: 'on'
  - service: script.send_text_telegram
    data:
      title: kincony error
      message: "could not set relay {{ random_relay }}"
      type: alert
  mode: single

Using command line switches only worked for a short while prior to removing the furnace valves.

In case it helps: I experienced 2 times losing the connection with the KC868-H32.
Both times it was because the MQTT password was incorrect - without any reason/explanation - in the relay module.
Entering it again solved my prolbem.

thanks share your code.

if you have not RC snubber, suggest you replace the AC contactor with DC contactor is ok.

Anybody is using the Kincony single phase power meter connected to COLB? Do you have solution to read energy meter data with Node-Red? Thank you all.

@ Nick, thank you for posting this.
I’d given up on mqtt and resorted to command line switches. However, command line sensors for door applications are useless. (reaction time is 30 seconds).

I retyped my credentials as you intimated above and MQTT started working.

@KinCony
You need to take a look at this bug. I’d already mentioned that even the 10 character restriction is insufficient.

Edit: it doesnt persist.
mqtt works 2 or 3 times and then it stops reporting. This is a problematic limitation.

which model you are using? KC868-H32B?

Hola Juan,

In my case, MQTT works fine as long as I do not connect valves to the relays (otherwise the KC868-H32B MQTT stack goes south after 2-3 days, even with the Kincony RC snubbers).
Door sensors (garage, property gate) changes are advertised immediately.

Good luck.

Im using KC868-H8B

Gracias Ramon,
@KinCony needs to take a look at this. Restricting functionality to make an advertised feature (mqtt) partially work can not be the final solution.

why not use MQTT? MQTT is work fine with monitor input state, can you tell me details?

If “inductive load” is connected, such as motor , coin, suggest add a extend relay will be very stable. Because inductive load will take interference signal back to PCB.

Including a watchdog in the Kincony to detect a broken MQTT stack/connection and reset the device would be greatly appreciated.

thanks for your suggestion, we will make it infurture after China new year holidays.