Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lesson9 - integrate KC868-Server to home assistant by MQTT
#1

1.MQTT communication structure diagram

   

KC868-Server--------

publish message: status of switch (status topic)
Subscription message: turn on / off command (command topic)


home assistant------

publish message:  turn on / off command (command topic)
Subscription message: status of switch (status topic)

2.KC868-Server digital output , digital input , analog input config sample code in configuration.yaml

# Example configuration.yaml entry
switch:
  - platform: mqtt
    name: 'output-1'
    unique_id: output-1
    state_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /state'
    command_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /set'
    payload_on:  '{"relay1":{"on":1}}'
    payload_off:  '{"relay1":{"on":0}}'
    value_template: '{{ value_json.relay1.on }}'
    state_on: 1
state_off: 0


binary_sensor:
  - platform: mqtt
    name: 'input-1'
    unique_id: input-1
    state_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /state'
    value_template: '{{ value_json.input1.on }}'
    payload_on: 1
    payload_off: 0


sensor:
  - platform: mqtt
    name: 'analog-1'
    unique_id: analog-1
    state_topic: 'server/ xxxxxxxxxxxxxxxxxxxxxxxx /state'
    unit_of_measurement: 'v'
    value_template: '{{ value_json.analog1.value }} ' 

Note: xxxxxxxxxxxxxxxxxxxxxxxx is UID of controller, just replace with your device UID. You can find the UID in ethernet setting.

3.KC868-Server 16 channel output, 16 channel digital input, 4 channel analog input all use in configuration.yaml


.txt   KC868-Server-home-assistant-config.txt (Size: 8.15 KB / Downloads: 896)
Reply
#2
I try to integrate KC868-Server to the home assistant by MQTT
but I can't find the IP for the server 

the IP for  the home assistant is http://192.168.100.172:8123/

see the photo 

https://ibb.co/G2V4wQc
https://ibb.co/47cJmTn

https://ibb.co/rMMmr19


can you help me find the IP
Reply
#3
because your KC868-Server ip is 192.168.1.200
your network is 192.168.100.x

you should set KC868-Server ethernet for "DHCP" mode. let it's ip became 192.168.100.x so that you can find it.
how to set :
d.) Hold on Ethernet mode button, when the [yellow and white LED] all is ON, release it, then work mode in “UDP” and IP by DHCP mode;
here is online guide details: https://www.kincony.com/how-to-use-kc868-server.html
Reply
#4
Than you  Working now Smile


I get error message 


Your manually configured MQTT switch(s) needs attention


This stops working in version 2022.12.0. Please address before upgrading.
Manually configured MQTT switch(s) found under platform key 

Code:
switch
.
Please move the configuration to the 

Code:
mqtt
 integration key and restart Home Assistant to fix this issue. See the documentation, for more
Reply
#5
yes, new home assistant version have changed mqtt format, you can see here:
https://www.kincony.com/forum/showthread.php?tid=1998
Reply
#6
thank you 


can you check attach


.txt   switch.txt (Size: 7.8 KB / Downloads: 285)
.txt   switch.txt (Size: 7.8 KB / Downloads: 285)
Reply
#7
yes, whether work well with your config file?
Reply
#8
Not working
Reply
#9
which board you are using?
Reply
#10
Kincony KC868-Server
Reply


Forum Jump:


Users browsing this thread: