Hi Admin,
I found out my answer to my own question no. 2.
Here is what I paste and it works:
- name: 'sensor1-A16'
unique_id: sensor1-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'C'
value_template: '{{ value_json.sensor1.temperature }}'
For reference of others that bought KC868-A16, i will post my whole KC868-16 MQQT integration to home assistant below.
Now, I have another encountered problem, the temperature data on my Home Assistant is not updating, see image below:
I put a tested to input different numbers from 0.1 to 10, but still not updating, see image below for reference.
---------------------------------------------
Sharing my complete code for KC868-A16 for this community/forum to help each other:
KC868-A16 integrate to home assistant by MQTT
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt:
switch:
- name: 'output-1-A16'
unique_id: output-1-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output1":{"value":true}}'
payload_off: '{"output1":{"value":false}}'
value_template: '{{ value_json.output1.value }}'
state_on: true
state_off: false
- name: 'output-2-A16'
unique_id: output-2-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output2":{"value":true}}'
payload_off: '{"output2":{"value":false}}'
value_template: '{{ value_json.output2.value }}'
state_on: true
state_off: false
- name: 'output-3-A16'
unique_id: output-3-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output3":{"value":true}}'
payload_off: '{"output3":{"value":false}}'
value_template: '{{ value_json.output3.value }}'
state_on: true
state_off: false
- name: 'output-4-A16'
unique_id: output-4-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output4":{"value":true}}'
payload_off: '{"output4":{"value":false}}'
value_template: '{{ value_json.output4.value }}'
state_on: true
state_off: false
- name: 'output-5-A16'
unique_id: output-5-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output5":{"value":true}}'
payload_off: '{"output5":{"value":false}}'
value_template: '{{ value_json.output5.value }}'
state_on: true
state_off: false
- name: 'output-6-A16'
unique_id: output-6-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output6":{"value":true}}'
payload_off: '{"output6":{"value":false}}'
value_template: '{{ value_json.output6.value }}'
state_on: true
state_off: false
- name: 'output-7-A16'
unique_id: output-7-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output7":{"value":true}}'
payload_off: '{"output7":{"value":false}}'
value_template: '{{ value_json.output7.value }}'
state_on: true
state_off: false
- name: 'output-8-A16'
unique_id: output-8-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
command_topic: 'KC868_A16/AC1518FCC8P9/SET'
payload_on: '{"output8":{"value":true}}'
payload_off: '{"output8":{"value":false}}'
value_template: '{{ value_json.output8.value }}'
state_on: true
state_off: false
*****************i deleted the output 9-16 because I maxed the allowed text of 10000 characters*********
*************just copy and paste the output 8 and rename accordingly*****************
binary_sensor:
- name: 'input-1-A16'
unique_id: input-1-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input1.value }}'
payload_on: true
payload_off: false
- name: 'input-2-A16'
unique_id: input-2-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input2.value }}'
payload_on: true
payload_off: false
- name: 'input-3-A16'
unique_id: input-3-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input3.value }}'
payload_on: true
payload_off: false
- name: 'input-4-A16'
unique_id: input-4-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input4.value }}'
payload_on: true
payload_off: false
- name: 'input-5-A16'
unique_id: input-5-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input5.value }}'
payload_on: true
payload_off: false
- name: 'input-6-A16'
unique_id: input-6-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input6.value }}'
payload_on: true
payload_off: false
- name: 'input-7-A16'
unique_id: input-7-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input7.value }}'
payload_on: true
payload_off: false
- name: 'input-8-A16'
unique_id: input-8-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input8.value }}'
payload_on: true
payload_off: false
- name: 'input-9-A16'
unique_id: input-9-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input9.value }}'
payload_on: true
payload_off: false
- name: 'input-10-A16'
unique_id: input-10-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input10.value }}'
payload_on: true
payload_off: false
- name: 'input-11-A16'
unique_id: input-11-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input11.value }}'
payload_on: true
payload_off: false
- name: 'input-12-A16'
unique_id: input-12-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input12.value }}'
payload_on: true
payload_off: false
- name: 'input-13-A16'
unique_id: input-13-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input13.value }}'
payload_on: true
payload_off: false
- name: 'input-14-A16'
unique_id: input-14-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input14.value }}'
payload_on: true
payload_off: false
- name: 'input-15-A16'
unique_id: input-15-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input15.value }}'
payload_on: true
payload_off: false
- name: 'input-16-A16'
unique_id: input-16-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
value_template: '{{ value_json.input16.value }}'
payload_on: true
payload_off: false
sensor:
- name: 'analog-1-A16'
unique_id: analog-1-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'v'
value_template: '{{ value_json.adc1.value }}'
- name: 'analog-2-A16'
unique_id: analog-2-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'v'
value_template: '{{ value_json.adc2.value }}'
- name: 'analog-3-A16'
unique_id: analog-3-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'v'
value_template: '{{ value_json.adc3.value }}'
- name: 'analog-4-A16'
unique_id: analog-4-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'meter'
#value_template: '{{ value_json.adc4.value }}'
value_template: '{{ (value_json.adc4.value * 0.00122) |round(2) }}'
- name: 'sensor1-A16'
unique_id: sensor1-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'C'
value_template: '{{ value_json.sensor1.temperature }}'
- name: 'sensor2-A16'
unique_id: sensor2-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'C'
value_template: '{{ value_json.sensor2.temperature }}'
- name: 'sensor3-A16'
unique_id: sensor3-A16
state_topic: 'KC868_A16/AC1518FCC8P9/STATE'
unit_of_measurement: 'C'
value_template: '{{ value_json.sensor3.temperature }}'