11-03-2024, 12:02 AM
(10-11-2024, 10:48 PM)lpb19 Wrote: Could someone with more experience check the code? Input and output are working. DAC1 and DAC2 do not respond.
# placa ks868-a6
mqtt:
switch:
- name: 'KC868_A6-output-1'
unique_id: KC868_A6-output-1
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
command_topic: 'KC868_A6/CC7B5C303EE0/SET'
payload_on: '{"output1":{"value":true}}'
payload_off: '{"output1":{"value":false}}'
value_template: '{{ value_json.output1.value }}'
state_on: true
state_off: false
- name: 'KC868_A6-output-2'
unique_id: KC868_A6-output-2
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
command_topic: 'KC868_A6/CC7B5C303EE0/SET'
payload_on: '{"output2":{"value":true}}'
payload_off: '{"output2":{"value":false}}'
value_template: '{{ value_json.output2.value }}'
state_on: true
state_off: false
- name: 'KC868_A6-output-3'
unique_id: KC868_A6-output-3
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
command_topic: 'KC868_A6/CC7B5C303EE0/SET'
payload_on: '{"output3":{"value":true}}'
payload_off: '{"output3":{"value":false}}'
value_template: '{{ value_json.output3.value }}'
state_on: true
state_off: false
- name: 'KC868_A6-output-4'
unique_id: KC868_A6-output-4
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
command_topic: 'KC868_A6/CC7B5C303EE0/SET'
payload_on: '{"output4":{"value":true}}'
payload_off: '{"output4":{"value":false}}'
value_template: '{{ value_json.output4.value }}'
state_on: true
state_off: false
- name: 'KC868_A6-output-5'
unique_id: KC868_A6-output-5
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
command_topic: 'KC868_A6/CC7B5C303EE0/SET'
payload_on: '{"output5":{"value":true}}'
payload_off: '{"output5":{"value":false}}'
value_template: '{{ value_json.output5.value }}'
state_on: true
state_off: false
- name: 'KC868_A6-output-6'
unique_id: KC868_A6-output-6
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
command_topic: 'KC868_A6/CC7B5C303EE0/SET'
payload_on: '{"output6":{"value":true}}'
payload_off: '{"output6":{"value":false}}'
value_template: '{{ value_json.output6.value }}'
state_on: true
state_off: false
binary_sensor:
- name: 'KC868_A6-input-1'
unique_id: KC868_A6-input-1
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: '{{ value_json.input1.value }}'
payload_on: true
payload_off: false
- name: 'KC868_A6-input-2'
unique_id: KC868_A6-input-2
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: '{{ value_json.input2.value }}'
payload_on: true
payload_off: false
- name: 'KC868_A6-input-3'
unique_id: KC868_A6-input-3
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: '{{ value_json.input3.value }}'
payload_on: true
payload_off: false
- name: 'KC868_A6-input-4'
unique_id: KC868_A6-input-4
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: '{{ value_json.input4.value }}'
payload_on: true
payload_off: false
- name: 'KC868_A6-input-5'
unique_id: KC868_A6-input-5
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: '{{ value_json.input5.value }}'
payload_on: true
payload_off: false
- name: 'KC868_A6-input-6'
unique_id: KC868_A6-input-6
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: '{{ value_json.input6.value }}'
payload_on: true
payload_off: false
sensor:
- name: "Sensor 1 Temperature"
unique_id: KC868_A6-sensor-temperature-1
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: "{{ value_json.sensor1.temperature }}"
unit_of_measurement: "°C"
- name: "Sensor 2 Temperature"
unique_id: KC868_A6-sensor temperature-2
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: "{{ value_json.sensor2.temperature }}"
unit_of_measurement: "°C"
- name: "ADC-1"
unique_id: KC868_A6-adc-1
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: "{{ value_json.adc1.value }}"
unit_of_measurement: "Unità"
- name: "ADC-2"
unique_id: KC868_A6-adc-2
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: "{{ value_json.adc2.value }}"
unit_of_measurement: "Unità"
- name: "ADC-3"
unique_id: KC868_A6-adc-3
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: "{{ value_json.adc3.value }}"
unit_of_measurement: "Unità"
- name: "ADC-4"
unique_id: KC868_A6-adc-4
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
value_template: "{{ value_json.adc4.value }}"
unit_of_measurement: "Unità"
light:
- name: "dac1"
unique_id: KC868_A6-dac1
schema: template
command_topic: 'KC868_A6/CC7B5C303EE0/STATE'
state_topic: 'KC868_A6/CC7B5C303EE0/STATE'
command_on_template: >
{%- if brightness is defined -%}
,{"dac1":{"value":{{(brightness / 255 * 100) | int - 1}}}
{%- else -%}
,'{"dac1":{"value":99}}'
{%- endif -%}
command_off_template: '{"dac1":{"value":0}}'
state_template: >
{%- if value_json.dac1.value == 0 -%}
off
{%- else -%}
on
{%- endif -%}
brightness_template: '{{(value_json.dac1.value / 99 * 255)| int}}'
I Think your code looks correct, My KC868-A4 gives a similar problem;
When publishing a MQTT message with KC868_A4/XXXXXXXX/SET
The relay(s) respond to the output commands output1:{"value":true}
the dac(s) do not respond to the dac1:{"value":158} or any other value
Firmware in use : KCS_KC868_A4_V2.2.6.bin
think we found an issue with the mqtt integration
reg
Erik