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: 997)
Reply


Messages In This Thread
Lesson9 - integrate KC868-Server to home assistant by MQTT - by admin - 03-27-2022, 04:56 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)