Tasmota dimming bulb using PWM doesn't return to previous brightness

By setting a Tasmota v8.1.0 dimmable bulb to use the PWM directly ( SetOption15 0 ) instead of 0-100% dimmer, I can get my bulb to a much lower brightness. This is great since I use it as a night light. I sorted out the configuration below and it works well except that unlike in the Dimmer configuration, hitting the toggle does not restore the light to its previous brightness. Instead, it turn it on the max value in the brightness_scale.

This seems like a bug but I wanted to check if there is something wrong with my configuration. Note that in Pwm config, the bulb doesn’t publish tele/%topic%/STATE so instead I have to subscribe to stat/%topic%/RESULT with that complete payload being:

{
“PWM”: {
“PWM1”: 52
}
}

  • platform: mqtt
    unique_id: ff_front_br_night_light
    name: “Night light”
    command_topic: “cmnd/DVES_89ADF0/Pwm”
    state_topic: “stat/DVES_89ADF0/RESULT”
    state_value_template: “{% if value_json.PWM.PWM1 | float > 0 %}ON{% else %}OFF{% endif %}”
    availability_topic: “tele/DVES_89ADF0/LWT”
    brightness_command_topic: “cmnd/DVES_89ADF0/Pwm”
    brightness_state_topic: “stat/DVES_89ADF0/RESULT”
    brightness_scale: 120
    on_command_type: “brightness”
    brightness_value_template: “{{value_json.PWM.PWM1}}”
    payload_on: “ON”
    payload_off: “OFF”
    payload_available: “Online”
    payload_not_available: “Offline”
    qos: 1
    retain: false

Was hoping that there was something that could be improved in my config. Maybe it actually is a bug?

Hi @willh , did you ever work this out? I’m having a similar issue.,