Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KCS firmware - MQTT LWT?
#1
Hi,

Do you plan to implement MQTT LWT/availability topics in your firmware?

This is actually crucial functionality in IoT for the broker to be informed of disconnections and state changes on reconnection made by other means when the device is offline.

Say you have your board in Home Assistant, you lose connection and then change the state of a relay with a physical switch. On reconnection Home Assistant doesn’t know about the state change and displays the previously set one until the state changes again and appropriate message gets sent to the MQTT broker.

As a bonus, with LWT implemented, your broker knows the availability topic stopped getting messages and displays the device as offline.

I’m pretty surprised this wasn’t implemented from the beginning.

Anyway, thanks for the otherwise nice product. Documentation is somewhat lacking, but I eventually managed to connect my KC868-A8 to Home Assistant with your KCS firmware. Unfortunately, I can’t deploy it in my scenario without LWT.

I refuse to put Tasmota on the board. Tried it and it was flakey, and their support is user hostile. ESPHome is also not an option for me.
Reply
#2
thanks for your suggestion, maybe in furture we can update for MQTT LWT.
here is sample config integrate to home assistant by MQTT using KinCony KC868-A series board: https://www.kincony.com/forum/showthread.php?tid=3274
every digital input or digital output changed, will auto upload mqtt message to mqtt broker.
Reply
#3
Sooo...

Another thing that you should consider looking at in your KCS firmware is that the temp and humidity sensor values do not update unless you trigger an input or output of the relay. An MQTT message should be sent on value change of the sensor data according to the threshold set.

I solved it with an automation in Home Assistant that periodically publishes a command to the SET topic with the following payload to update all values available through MQTT:

Code:
'{"get_datas":{"value":true}}'

If anyone is wondering how to get the sensor values in HA, here's the code to add in your configuration.yaml file. Note that it's "humity", not "humidity" as one would expect.

Code:
  sensor:
    - name: "sensor1-temperature"
      unique_id: sensor1-temperature
      state_topic: "KC868_A8/24XXC3AFXXXX/STATE"
      device_class: temperature
      unit_of_measurement: " °C"
      value_template: '{{ value_json.sensor1.temperature }}'

    - name: "sensor1-humidity"
      unique_id: sensor1-humidity
      state_topic: "KC868_A8/24XXC3AFXXXX/STATE"
      device_class: humidity
      unit_of_measurement: " %"
      value_template: '{{ value_json.sensor1.humity }}'
Reply
#4
"An MQTT message should be sent on value change of the sensor data according to the threshold set." there is an option in "sensor" webpage, you can set the threshold value for auto feedback MQTT message.
Reply
#5
(11-07-2023, 10:37 PM)admin Wrote: there is an option in "sensor" webpage, you can set the threshold value for auto feedback MQTT message.

Yes, I tried setting it to 0.1, but that appears to do nothing. No message is sent even though the temp and humidity values changed in the time period when I was testing this feature.

I’ll test it again over the weekend with MQTT Explorer to see if it’s maybe a bug in Home Assistant, but for now my workaround to poll the relay every 2 minutes works.

I’m using KCS v2.1.9.
Reply
#6
yes, ok, it's also a solution.
Reply
#7
Same problem. Temperature from 2 attached DS18B20 sensors is changed ( this change can be seen in web interface Monitor\Sensor\Channel 1 and 2). But no MQTT update is send to MQTT server. Checked with MQTT explorer.
Setting Sensor / Temperature threshold to "0.1" does not have effect.

Setting relay state will update also temperature values.
Workaround from Tarmas to setting
Code:
{"get_datas":{"value":true}}'
works, but this is something what should be fixed in firmware.


Running KC868_A6, Software Version v2.2.2
Reply
#8
ok, will save your feedback.
Reply
#9
Hello
I have the problem that the temperature and adc values don't change also.
Only when you switch on or off the relais the values changes.

I have an urgent question: With which command Ican set the relais on and off???

I see in my MQQTT broker :
output1_value true or false, when I switch in the web frontend by the monitor the relais

but I can't switch on or off the relais from my broker!!!!!!

and why has a relais status true/false and not on or off???
Reply
#10
temperature and adc values will change, but it need set "Threshold" value in sensor config webpage.
[Image: sensor-webpage.png]
about relay control by MQTT , here is protocol:
https://www.kincony.com/forum/showthread.php?tid=3105

if you have problem, you need list your question details. if i don't understand details, how to help you???
Reply


Forum Jump:


Users browsing this thread: