MQTT Switch advice

I have developed my own mqtt controlled blinds using a wemos controller.

By publishing a mqtt command up / down I can control the blinds.
My controller also publishes is state every minute.

This works fine from home assistant accept one thing. I have one switch on the home page.
Lets say the switch in on (Blind up)
If you click the switch on the webpage the switch display goes off and the blind goes down. A few seconds later the switch display goes back on (No mqtt event was seen for this to happen) and finally when the blind reaches its destination my controller sends the new position and the display switch updates to the correct position again.

Does anyone no why this switch changes its position for no reason ?

My switch config is

switch office_blind:

  • platform: mqtt
    name: “Office Blind”
    state_topic: “office/blind/status/”
    command_topic: “office/blind/cmnd/”
    qos: 1
    payload_on: “UP”
    payload_off: “DOWN”
    retain: false

Thanks

If the blind doesn’t update the status correctly, home-assistant will consider that the action didn’t work and set the status back.
You blind maybe send the new status once he reach the destination, explaining the lag in status update.

Also instead of using a switch, the MQTT Cover component might do a better job.

If you push the current position to set_position_topic, you’ll be able to avoid this “unknown” state when the blind is closing/opening itself.

1 Like

You can find an example here: