MQTT Autodiscover State Issues wih zigbee light

Hi all, this is not an easy topic, to explain, basically I am facing issues with converting manual mqtt lights to autodiscovery.
I started migrating manual mqtt entities to mqtt discovery.
I switched from manual mqtt to tasmota integration years ago, so most devices are autodiscovered, but I use some zigbee sensors / bulbs all on a sonoff v1 gateway which is tasmota based.
The gateway is working well but It behaves different form other devices:

  • it needs Json command message with device name in it
  • the normal zigbee shares state_topic ist shared between devices, so there is a lot of trouble (and erros logged) when the state of a device needs to be extracted. So I tried to mimic a distinct topic state behavior whith some ruless on the gateway. This seem to work well, even the state can be retained, so this is basically important when HA starts, so the internal state of a light / swicth is read from retained mqtt messages, else it will show as "unknown" unless the device reports the state itself on a periodically message or based on interaction)

So I have this manual working light (Tradfri Bulb just on/off -- dont need brightness atm):

light:
  - name: "Tripod mqtt"
    schema: template
    unique_id: "light.zigbee_tripod_0xec1bbdfffeae209a"
    command_topic: "tasmota/zigbee/cmnd/ZbSend"
    command_on_template: '{"Device":"Tripod","Send":{"Power":"ON"}}'
    command_off_template: '{"Device":"Tripod","Send":{"Power":"OFF"}}'
    state_topic: "zigbee/tripod/stat/POWER"
    availability:
    - topic: "tasmota/zigbee/tele/LWT"
      payload_available: "Online"
      payload_not_available: "Offline"

which is working:
ON:

tasmota/zigbee/cmnd/ZbSend {"Device":"Tripod","Send":{"Power":"ON"}}
tasmota/zigbee/tele/SENSOR {"ZbReceived":{"Tripod":{"Device":"0xA5D7","Name":"Tripod","Power":1,"Endpoint":1,"LinkQuality":0}}}
zigbee/tripod/stat/POWER on

OFF:

tasmota/zigbee/cmnd/ZbSend {"Device":"Tripod","Send":{"Power":"OFF"}}
tasmota/zigbee/tele/SENSOR {"ZbReceived":{"Tripod":{"Device":"0xA5D7","Name":"Tripod","Power":0,"Endpoint":1,"LinkQuality":5}}}
zigbee/tripod/stat/POWER off

I converted to Json on topc "homeassistant/light/tripod/config"

First if I use json in command_on_template HA still sends plain string "ON" (same for OFF). Its working when I use same Json as "payload_on".

While this seems so work there is still another issue with the state. While manua llight works the autodiscover one is always on, so I can switch it off, but the state stays on, If I open the entity the button turns off and on immedeatly. but the ligjt goes off -- the mqtt one changes. If button turns off I can re-click quickly and an on command is send if the light was previously off.
I checked the entity and the azrodiscored value and it shows correct, like the static manual one. I am currently lost why HA does noc pickup the stat_topics state. Its retained and on/off like shown in the output above.