Tasmota status Led as a switch in Home Assistant

Hi

On a tasmotat device I have a LED that I would like to turn on and off from HA.

When I set in this minimal code, I can do that

- platform: mqtt
  name: "Test_Led"
  command_topic: "cmnd/DVES_B1CF9E/LEDPOWER"
  payload_on: "1"
  payload_off: "0"
  retain: false

I can see that i get this mqtt response:

stat/DVES_B1CF9E/RESULT = {"LedPower":"OFF"}

So I would like to use that as feedback, so I can read the actual state of the status led

- platform: mqtt
  name: "Test_Led"
  state_topic: "stat/DVES_B1CF9E/RESULT"
  value_template: "{{ value_json.LEDPOWER }}"
  command_topic: "cmnd/DVES_B1CF9E/LEDPOWER"
  availability_topic: "tele/DVES_B1CF9E/LWT"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  payload_available: "Online"
  payload_not_available: "Offline"
  retain: false

Unfortunatly, this does not work, as the feedback is not reconiced, and the switch in the UI, just goes back to off again after a few seconds.

How to I need to write the YAML to get this working?

Hi,
You need to change state_topic to “stat/DVES_B1CF9E/LEDPOWER”, then the state will be correct in UI.

thank you :slight_smile:

I just did the test, and sadly it still do not work…