Smart Home Automation Forum
KCS firmware - MQTT LWT? - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=1)
+--- Forum: KC868-A series and Uair Smart Controller (https://www.kincony.com/forum/forumdisplay.php?fid=6)
+--- Thread: KCS firmware - MQTT LWT? (/showthread.php?tid=3434)

Pages: 1 2 3 4


RE: KCS firmware - MQTT LWT? - erikwout - 11-03-2024

(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


RE: KCS firmware - MQTT LWT? - admin - 11-03-2024

Do you means , you can control relay ON/OFF by mqtt, but can't output DAC1 for dimmer?


RE: KCS firmware - MQTT LWT? - erikwout - 11-03-2024

(11-03-2024, 01:07 AM)admin Wrote: Do you means , you can control relay ON/OFF by mqtt, but can't output DAC1 for dimmer?

Yes that is indeed what I mean, also dac2 does the same thing 
Thanks
Erik


RE: KCS firmware - MQTT LWT? - admin - 11-03-2024

ok, tomorrow i check.


RE: KCS firmware - MQTT LWT? - erikwout - 11-03-2024

(11-03-2024, 08:21 AM)admin Wrote: ok, tomorrow i check.

If you need more info/test please let me know.

Kind regards, Erik


RE: KCS firmware - MQTT LWT? - Witwicki - 11-03-2024

(11-03-2024, 09:34 AM)erikwout Wrote:
(11-03-2024, 08:21 AM)admin Wrote: ok, tomorrow i check.

If you need more info/test please let me know.

Kind regards, Erik

I am having the same issue with DAC outputs on the A4


RE: KCS firmware - MQTT LWT? - Witwicki - 11-03-2024

(11-03-2024, 10:34 AM)Witwicki Wrote:
(11-03-2024, 09:34 AM)erikwout Wrote:
(11-03-2024, 08:21 AM)admin Wrote: ok, tomorrow i check.

If you need more info/test please let me know.

Kind regards, Erik

I am having the same issue with DAC outputs on the A4

No, it seems if try and send a json payload with many parmaters (say copying the whole device state from the state topic) it will lock up and need a reset
If only change the state of a few outputs (relays and DACs) it works

Hope this helps


RE: KCS firmware - MQTT LWT? - admin - 11-04-2024

i have tested send command control DAC , it's OK. 
   
   
   
   
   
   
   
   
please send command as our protocol. where you have seen the protocol document let you send ALL data (copy by STATE result) to controller???
https://www.kincony.com/forum/attachment.php?aid=2872


RE: KCS firmware - MQTT LWT? - Witwicki - 11-04-2024

(11-04-2024, 10:29 AM)admin Wrote: i have tested send command control DAC , it's OK. 

It seems to be a bug

send this on the /set topic from board start up in order

("dac1":{"value":50})     < This works

{"get_datas":{"value":true}}   < this works

("dac1":{"value":0})    < this also works

{"input1":{"value":false},"input2":{"value":false},"input3":{"value":false},"input4":{"value":false},"output1":{"value":true},"output2":{"value":false},"output3":{"value":false},"output4":{"value":false},"adc1":{"value":0},"adc2":{"value":0},"adc3":{"value":0},"adc4":{"value":0},"dac1":{"value":0},"dac2":{"value":0},"sensor1":{"temperature":-100.0,"humidity":-100.0}}    < this works, switching on a relay


("dac1":{"value":50})   < This now fails and requires the board to be reset
{"get_datas":{"value":true}} < will also now fail

Sending the large payload seems to break the board untill reboot


RE: KCS firmware - MQTT LWT? - admin - 11-05-2024

don't send this command:
{"input1":{"value":false},"input2":{"value":false},"input3":{"value":false},"input4":{"value":false},"output1":{"value":true},"output2":{"value":false},"output3":{"value":false},"output4":{"value":false},"adc1":{"value":0},"adc2":{"value":0},"adc3":{"value":0},"adc4":{"value":0},"dac1":{"value":0},"dac2":{"value":0},"sensor1":{"temperature":-100.0,"humidity":-100.0}}

i have said, please send command according to our protocol. we don't have this protocol. input for READ, NOT for WRITE command.