Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-HA RS485 INPUT & OUTPUT plugin for ESPHome
#11
i have checked your video, i think all your device have connect with one RS485 bus , right? because video not clearly to see wire.

1. one RS485 bus can't use multi "MASTER". your home assistant installed on a Server, the server's RS485 is "MASTER". E16S, HA , RS485 sensor all are "SLAVE". if this system structure is ok, we can design a standard modbus protocol firmware for HA pcb. then you need to use "LATCH" button, if you use push button, it need hold on more time, can't too quickly. Because modbus "pull" speed can't too fast.

2. thanks for suggestion for i2c extend board. do you think i2c 8CH relay or i2c 8CH input board is ok? or maybe 4CH or 16CH?
Reply
#12
(11-23-2023, 01:23 AM)admin Wrote: i have checked your video, i think all your device have connect with one RS485 bus , right? because video not clearly to see wire.

1. one RS485 bus can't use multi "MASTER". your home assistant installed on a Server, the server's RS485 is "MASTER". E16S, HA , RS485 sensor all are "SLAVE".  if this system structure is ok, we can design a standard modbus protocol firmware for HA pcb. then you need to use "LATCH" button, if you use push button, it need hold on more time, can't too quickly. Because modbus "pull" speed can't too fast.

2. thanks for suggestion for i2c extend board. do you think i2c 8CH relay or i2c 8CH input board is ok? or maybe 4CH or 16CH?

Super happy to read your reaction.

On the video I use only 1 RS485_bus.

1. HomeAssistant is not participating in the communication. I use it for programming and supervision. The communication works without server, just E16S, HA , RS485 sensor, ...
The Modbus_Component (E16S) sends the commands (standard modbus) and can read, kc868-HA just sends input state changes and reads output change commands for his Modbus address.
If you design a standard modbus protocol firmware for HA pcb, maybee you can use "evtOn" (sending input state ON) (01 02 01 01 60 48) (01 03 02 00 01 79 84) for push and "evtOFF' (sending input state OFF) for release, so you have time between commands.

2. To reduce the number of boards, simplest would be a board with 8 opto isolated inputs and 8 12V 3FF relays. Nice extra would be a second board with 8 opto isolated inputs and a third board with 8 Omron relays (E8i2C :-)

Greetings from Belgium
Nic
Reply
#13
E16S is RS485(MASTER), HA is RS485(SLAVE), RS485 sensor is SLAVE. right?
Reply
#14
(11-23-2023, 10:09 AM)admin Wrote: E16S is RS485(MASTER), HA is RS485(SLAVE), RS485 sensor is SLAVE. right?


Yes indeed,
Aldough y would say that HA is a kind of an hybrid. A slave waits for an order to be given. The kc868-HA sends by himself a state-message when an input has changed state.

A master can ask a device for a state response or ask a device to change the state of an output. These devices can be a  master or a slave .
A kc868-E16S can ask another kc868-E16S to close a relay and vice-versa.

ESPHome describes it like this:
Quote:The modbus_controller component creates a RS485 connection to control a ModBUS slave device, letting your ESPHome node (kc868-E16S for example) to act as a ModBUS master. You can access the coils and registers from your slave ModBUS device as sensors, switches or various other ESPHome components and present them to your favorite Home Automation system .
[Image: modbus.png]

Propably the confusion is that you make an analogy with MQTT. There you need a broker who regulates the communication.
In Modbus everyone can send and receive messages. You just have to stick to the protocol and keep the traffic low.

There is a super good instruction video about this subject. Just change A6 by HA ;-)
https://www.youtube.com/watch?v=xmBWzVGpggo

Greetings
Nic
Reply
#15
ok, we will try to make a new standard modbus firmware for HA and HAv2. later i can send you for testing.
Reply
#16
Thumbs Up 
(11-24-2023, 12:07 AM)admin Wrote: ok, we will try to make a new standard modbus firmware for HA and HAv2. later i can send you for testing.
Reply
#17
here is modbus standard protocol firmware BIN file for KC868-HA (not have HAv2), you can test it , any questions you can post at here. 
now the firmware have fixed ID=0A, later will make it modifiable.

.zip   HA485_KU_V108_RIO231124.zip (Size: 6.43 KB / Downloads: 76)
   

here is debug command:

Modubs command-05 (control digital output):

turn ON output1:
send:0A 05 00 00 FF 00 8D 41
feedback:0A 05 00 00 FF 00 8D 41

turn OFF output1:
send:0A 05 00 00 00 00 CC B1
feedback:0A 05 00 00 00 00 CC B1
------------------------------------
Modubs command-01 (read digital output state):

send:0A 01 00 00 00 06 BD 73
feedback:0A 01 01 01 92 6C  (output1=ON, output2--6=OFF)
------------------------------------
Modubs command-02 (read digital input state):

send:0A 02 00 00 00 06 F9 73
feedback:0A 02 01 01 62 6C  (input1=ON, input2--6=OFF)
------------------------------------
Modubs command-03 (read multi registers):

register: address: (200)dec = (C8)hex digital input+digital output state

send:0A 03 00 C8 00 02 44 8E
feedback:0A 03 04 00 01 00 00 11 33

note:00 01 00 00 = 00 01 (input1=ON, input2--6=OFF)  00 00  (output1--6=OFF)
Reply
#18
(11-26-2023, 02:47 AM)admin Wrote: here is modbus standard protocol firmware BIN file for KC868-HA (not have HAv2), you can test it , any questions you can post at here. 
now the firmware have fixed ID=0A, later will make it modifiable.

Dear,
Thank you for the great work.
The application worked out of the box.

For simplicity:
- kc868-ha-KCS = firmware for kc868-HA board, to work with KCS on KinCony relat boards (kcs868_component & kcs868_ha)
- kc868-ha-SP = firmware for kc868-HA board compliant with the standard ESPHome 'modbus-controller' protocol

Great difference between earlier kc868-ha-KCS and the kc868-ha-SP you wrote last week,
is that a HA board with kc868-ha-KCS firmware sends a status message on the bus when an input has changed state. It does it by himself.
A board with kc868-ha-SP, same as with other modbus-slaves, has to be read on a regular base to get information about his inputs, and the status of its outputs.
With a lot of HA-boards on the bus, this gives serious problems of collisions and data loss.
The beauty of earlier kc868-ha-KCS firmware is that it keeps traffic on the line at his lowest, since the HA board sends only a message when something changes.
It is more like a hybrid betwin a master and a slave. Y guess that the integration of an ARTERY controller on the HA board was for this purpose.
Now, with the kc868-ha-SP firmware, the HA board has lost his advantage over other IO-boards.

Hopefully you can reintegrate this functionality into the  kc868-ha-SP firmware.

Sincerely yours
Nic
Reply
#19
do you means want KC868-HA baord will auto feedback INPUT state when state changed?
Reply
#20
(11-27-2023, 10:51 AM)admin Wrote: do you means want KC868-HA baord will auto feedback INPUT state when state changed?


Yes indeed !

Output is oké. (needed for HomeAssistant).


Greetings
Nic
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)