Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A16 - MQTT Issues
#1
Hey, 

first of all: Thanks for this great product! I am now trying to connect it via MQTT to Home Assistant. (I had several issues by using ESPHome, so I wanna stick with MQTT for now). 

What I did: 
  • MQTT Setup within KCS
  • Setup Mosquito and MQTT within Home-Assistant (Already existing)
  • Confirmed that the Packages are received by listening to #

I have used the following YAML within Home Assistants configuration.yaml, customized based on the received packages while listening to #:

Code:
mqtt:
  switch:
   - name: 'kcs868-a16-output-1'
     unique_id: kcs868-a16-output-1
     state_topic: 'KC868_A16/2CBCBB646ACC/STATE'
     command_topic: 'KC868_A16/2CBCBB646ACC/SET'
     payload_on:  '{"output1":{"value":true}}'
     payload_off:  '{"output1":{"value":false}}'
     value_template: '{{ value_json.output1.value }}'
     state_on: true
     state_off: false

As a result, I can - after restarting Home Assistant control the Output 1. 
BUT: It does not show the current status of Output one! (See Screenshot). Status is unknown. 

Any Idea what went wrong? What could I check? 

[Image: EClPwLZ.png]
Reply
#2
take a photo of your KCS mqtt setting webpage.
Reply
#3
(12-28-2024, 01:19 AM)admin Wrote: take a photo of your KCS mqtt setting webpage.

Here we go. Not showing the mqtt broker login - which is set and working. As said: Sending requests are working just reading the state seems not to work. 

Version 2.2.5 btw - will update to 2.2.10 today. 
[Image: iug4yvn.png]
Reply
#4
maybe it's your mqtt broker have issue.
Reply
#5
Edit: my bad it is not fully working ...
It was just a blind result, I post to quickly

I will be back :-)


Attached Files Image(s)
       
Reply
#6
thanks share your result.
Reply
#7
So, i am back

note on my setup:
firmware v2.2.10
hardware KC868-A32 V1.2

First 
There is a (minor) mistake in the MQTT payload output by the board, at the end there is an extra comma.
If you look the payload is like:

Quote:{"input1":{"value":false},"input2":{"value":false},..."adc4":{"value":0},}

to be 100% json compliant it should end like:
Quote:{"input1":{"value":false},"input2":{"value":false},..."adc4":{"value":0}}


Second
below the mqtt configuration I manage to make work with the help of HA forum member
this configuration take in account the last extra comma and is compatible with or without this comma

Code:
mqtt:
  switch:
   - name: 'KC32_578_o1'
     unique_id: KC32_578_o1
     state_topic:   'KC868_A32/123456/STATE'
     command_topic: 'KC868_A32/123456/SET'
     payload_on:  '{"output1":{"value":true}}'
     payload_off: '{"output1":{"value":false}}'
     value_template: >
      {% set value_json = value | replace(",}", "}") | from_json %}
      {{ value_json.output1.value }}
     state_on:  true
     state_off: false

Third
I had during my attempts and tries, sometime switch quickly on/off the relay, and sometime the board did not sens it last status.
I tel this just to share my experience,this is not a real problem, not need to try to fix I think because:
switching so fast is not real life
It can be easily bypassed by sending
Code:
get_datas":{"value":true}}

so if anyone get this trouble he can send this periodicaly (eg each minute) or add it in the on/off payload like
Code:
payload_on:  '{"output1":{"value":true},"get_datas":{"value":true}}'
payload_off: '{"output1":{"value":false},"get_datas":{"value":true}}'

Finaly
Thank you for your boards, thank you for KCS firmware.
I think it is a lot of work
but the information is a little messy, for example we have a lot of topic for a lot of firmware version, the uper top topic is not the last firmware version, all boards a not mentioned each time ...
You have a great MQTT pdf documentation but it is not easy to find (and to know it exist)

Have a good day and long life to you and your products ;-)


Attached Files Image(s)
       
Reply
#8
thanks for your suggestion. we will check with KCS v2.2.10
how to do you think easy to find out the newest firmware and documents? because there are much board models.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)