how to integrate KC868-A8 to home assistant by MQTT - admin - 12-04-2024
step-1: download KCS firmware to KC868-A8 by USB-C cable
step2: set mqtt broker ip , port, user name, password for home assistant mosquitto broker. the ip and port according to home assistant's server.
step3: modify configuration.yaml file, add our code:
Code: # Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt:
switch:
- name: 'a8-kcs-output-1'
unique_id: a8-kcs-output-1
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output1":{"value":true}}'
payload_off: '{"output1":{"value":false}}'
value_template: '{{ value_json.output1.value }}'
state_on: true
state_off: false
- name: 'a8-kcs-output-2'
unique_id: a8-kcs-output-2
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output2":{"value":true}}'
payload_off: '{"output2":{"value":false}}'
value_template: '{{ value_json.output2.value }}'
state_on: true
state_off: false
- name: 'a8-kcs-output-3'
unique_id: a8-kcs-output-3
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output3":{"value":true}}'
payload_off: '{"output3":{"value":false}}'
value_template: '{{ value_json.output3.value }}'
state_on: true
state_off: false
- name: 'a8-kcs-output-4'
unique_id: a8-kcs-output-4
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output4":{"value":true}}'
payload_off: '{"output4":{"value":false}}'
value_template: '{{ value_json.output4.value }}'
state_on: true
state_off: false
- name: 'a8-kcs-output-5'
unique_id: a8-kcs-output-5
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output5":{"value":true}}'
payload_off: '{"output5":{"value":false}}'
value_template: '{{ value_json.output5.value }}'
state_on: true
state_off: false
- name: 'a8-kcs-output-6'
unique_id: a8-kcs-output-6
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output6":{"value":true}}'
payload_off: '{"output6":{"value":false}}'
value_template: '{{ value_json.output6.value }}'
state_on: true
state_off: false
- name: 'a8-kcs-output-7'
unique_id: a8-kcs-output-7
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output7":{"value":true}}'
payload_off: '{"output7":{"value":false}}'
value_template: '{{ value_json.output7.value }}'
state_on: true
state_off: false
- name: 'a8-kcs-output-8'
unique_id: a8-kcs-output-8
state_topic: 'KC868_A8/B0A732859848/STATE'
command_topic: 'KC868_A8/B0A732859848/SET'
payload_on: '{"output8":{"value":true}}'
payload_off: '{"output8":{"value":false}}'
value_template: '{{ value_json.output8.value }}'
state_on: true
state_off: false
binary_sensor:
- name: 'a8-kcs-input-1'
unique_id: a8-kcs-input-1
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input1.value }}'
payload_on: true
payload_off: false
- name: 'a8-kcs-input-2'
unique_id: a8-kcs-input-2
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input2.value }}'
payload_on: true
payload_off: false
- name: 'a8-kcs-input-3'
unique_id: a8-kcs-input-3
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input3.value }}'
payload_on: true
payload_off: false
- name: 'a8-kcs-input-4'
unique_id: a8-kcs-input-4
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input4.value }}'
payload_on: true
payload_off: false
- name: 'a8-kcs-input-5'
unique_id: a8-kcs-input-5
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input5.value }}'
payload_on: true
payload_off: false
- name: 'a8-kcs-input-6'
unique_id: a8-kcs-input-6
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input6.value }}'
payload_on: true
payload_off: false
- name: 'a8-kcs-input-7'
unique_id: a8-kcs-input-7
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input7.value }}'
payload_on: true
payload_off: false
- name: 'a8-kcs-input-8'
unique_id: a8-kcs-input-8
state_topic: 'KC868_A8/B0A732859848/STATE'
value_template: '{{ value_json.input8.value }}'
payload_on: true
payload_off: false
yaml file download:
HA-A8-MQTT-OUTPUT-INPUT.txt (Size: 4.8 KB / Downloads: 26)
step4: replace all ID by your own board, you can check ID from KCS "index" webpage.
step5: save the yaml file by click "save" button. Then ready to restart of home assistant.
step6: go to "setting" -- "system" webpage, restart your home assistant.
step7: Now you can found new entities in "Setting" -- “Device & services" -- "Entities" webpage. all have listed, you just add to home assistant dashboard is OK.
|