32 channel ethernet relay module – KinCony KC868-H32

My device is flashed with the latest firmware (3-boot + relay32-all.hex).
Only in “TCP-server” mode does it respond to a command:
echo -n RELAY-SET-255,5,1 | nc 192.168.1.20 4196
In UDP mode, I do not receive a response from the device at all
And Shamruk, says that the device should be in UDP mode …

Is there actualy a clear manual for integrating this in a proper way to home assistant. just recieved my relais from kincony . but now i am starting to worry this wil not work properly .

do i need to flash the board.
is there a proper way to integrate this. no mqtt . just direct control from HA yes even inputs
tcp or udp mode
integratable trough HACS .

just new to Home Assistant .

integration of shamruk . HA log is flooding with errors. change state from ui ,the controller responds immediatly . when status changes on relais kincony . HA updates very slow and lots of errors in log.

2020-05-27 19:27:43 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.ls_1 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/switch.py", line 110, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 143, in getStatus return x.group(1) == "1" AttributeError: 'NoneType' object has no attribute 'group' 2020-05-27 19:27:43 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.ls_3 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/switch.py", line 110, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 143, in getStatus return x.group(1) == "1" AttributeError: 'NoneType' object has no attribute 'group' 2020-05-27 19:27:44 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.ls_9 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/switch.py", line 110, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 143, in getStatus return x.group(1) == "1" AttributeError: 'NoneType' object has no attribute 'group' 2020-05-27 19:27:44 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.ls_25 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/light.py", line 105, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 143, in getStatus return x.group(1) == "1" AttributeError: 'NoneType' object has no attribute 'group' 2020-05-27 19:27:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.ls_31 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/light.py", line 105, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 143, in getStatus return x.group(1) == "1" AttributeError: 'NoneType' object has no attribute 'group' 2020-05-27 19:28:14 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.ls_1 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/switch.py", line 110, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 143, in getStatus return x.group(1) == "1" AttributeError: 'NoneType' object has no attribute 'group' 2020-05-27 19:29:46 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.ls_1 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/switch.py", line 110, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 143, in getStatus return x.group(1) == "1" AttributeError: 'NoneType' object has no attribute 'group' 2020-05-27 20:26:10 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.sems_portal is taking over 10 seconds 2020-05-27 20:45:25 ERROR (SyncWorker_9) [custom_components.kincony-sha] socket read error 2020-05-27 20:45:25 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.ls_1 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/switch.py", line 110, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 141, in getStatus result = self.send2KWithLock('get') File "/config/custom_components/kincony-sha/__init__.py", line 124, in send2KWithLock result = self.send2K(action_type) File "/config/custom_components/kincony-sha/__init__.py", line 113, in send2K result = self.s.call(command) File "/config/custom_components/kincony-sha/__init__.py", line 69, in call return result UnboundLocalError: local variable 'result' referenced before assignment 2020-05-27 20:45:30 WARNING (MainThread) [homeassistant.helpers.entity] Update of light.ls_17 is taking over 10 seconds 2020-05-27 20:45:30 ERROR (SyncWorker_5) [custom_components.kincony-sha] cannot connect socket 2020-05-27 20:45:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.ls_2 is taking over 10 seconds 2020-05-27 20:45:35 ERROR (SyncWorker_2) [custom_components.kincony-sha] cannot connect socket 2020-05-27 20:45:35 ERROR (MainThread) [homeassistant.helpers.entity] Update for light.ls_17 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/light.py", line 105, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 141, in getStatus result = self.send2KWithLock('get') File "/config/custom_components/kincony-sha/__init__.py", line 124, in send2KWithLock result = self.send2K(action_type) File "/config/custom_components/kincony-sha/__init__.py", line 113, in send2K result = self.s.call(command) File "/config/custom_components/kincony-sha/__init__.py", line 53, in call self._send(command) File "/config/custom_components/kincony-sha/__init__.py", line 33, in _send self.s.sendto(command.encode(), self.address) socket.timeout: timed out 2020-05-27 20:45:35 ERROR (SyncWorker_0) [custom_components.kincony-sha] cannot connect socket 2020-05-27 20:45:35 ERROR (MainThread) [homeassistant.helpers.entity] Update for switch.ls_2 fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/kincony-sha/switch.py", line 110, in update self._state = self._clinet.getStatus() File "/config/custom_components/kincony-sha/__init__.py", line 141, in getStatus result = self.send2KWithLock('get') File "/config/custom_components/kincony-sha/__init__.py", line 124, in send2KWithLock result = self.send2K(action_type) File "/config/custom_components/kincony-sha/__init__.py", line 113, in send2K result = self.s.call(command) File "/config/custom_components/kincony-sha/__init__.py", line 53, in call self._send(command) File "/config/custom_components/kincony-sha/__init__.py", line 33, in _send self.s.sendto(command.encode(), self.address) OSError: [Errno 113] Host is unreachable 2020-05-27 20:45:38 ERROR (SyncWorker_0) [custom_components.kincony-sha] cannot connect socket 2020-05-27 20:45:44 ERROR (SyncWorker_0) [custom_components.kincony-sha] cannot connect socket 2020-05-27 20:45:45 WARNING (MainThread) [homeassistant.helpers.entity] Update of light.ls_18 is taking over 10 seconds 2020-05-27 20:45:45 WARNING (MainThread) [homeassistant.helpers.entity] Update of switch.ls_3 is taking over 10 seconds 2020-05-27 20:45:47 ERROR (SyncWorker_0) [custom_components.kincony-sha] cannot connect socket

Hi @alanua, how is everything going with KinCony module? Is it a device you recomend?

I think I could recommend this device. High level customer support, updates, channel cost. The device is worth the money.

Having looked and failed to find something like this I made my own.

If anyone wants drawings or details just ask.

1 Like

And did you get the integration of your device into HA?

Yes, running ESPHome.

I’ve made it so that HA just monitors and makes adjustments, notifying me of changes. I need the system to be able to run independently of HA, WiFi and internet, which it does.

I use Influx and Grafana for the historic reporting.

HA could, of course, be used for the control but that didn’t suit my needs.

Can this device be used to control the light? Connect the switches to the inputs, and the lamp outputs. That the device would be autonomous, as in your case and in parallel could be controlled through HA.

The switches are all low volts. Each switch pulls the input to GND.

The outputs can be used at any voltage to switch lights etc. I use it mostly for pumps.

I have it fully independent from HA. HA is used just for monitoring and to make time adjustments etc,

Do you think you can scale your devices? Connect 2 devices to each other. To work together. Autonomously and with connection to HA.

To increase the number of joint control channels.

I’m not exactly sure what you mean.

Do you mean to run, say, two lights in parallel? That would depend on the total current and the capability of the relays you decide to use.

Here’s my finished control system.

1 Like


Combining the number of control channels.
16 * x


What are these devices?

They are Shelly PM. I use them to monitor the power being drawn by the pumps so that I can detect blockages or faults.

Yes. You could use 2 boards or 10. Each would be independent but you could link them through HA if necessary.

Currently, ESPHome nodes cant directly talk to each other though you could use Arduino maybe to do that.

This may do what you want.

I just go my KC868-H32L from China and I´m playing with it right now.
Indeed it´s a great device. I was able to load @shamruk code without much effort, even with my limited (almost zero) coding skills.
Right after I integrated HA with Google Home and I´m arealy “talking” to my home throught KinCony´s device.
So, Im very happy with it.

I just couldn´t assing the lights / switches to a room (area). Any suggestion how to do that?

I was wondering if someone wrote a code for the “buttons”.?
I mean, If I press a button in kinconys device, could I setup a scene inside HA, maybe even a Hold function for the buttons?