Mqtt-cover roller shutter with stop


We have some quite dumb roller shutters installed in our house. They have two wires, connect 13V one way, and they open until they’re fully open, then stop. Reverse the polarity, and they close until they’re fully closed. Of course you can disconnect the power while they’re moving, and they stop where they are.

Unfortunately they’re solar-battery operated, so I can’t really be 100% sure on how far along they are based on time.

I’ve hooked them up to relays and MQTT, and I have three settings: Send the request “OPEN” and they move up, and reply “OPEN” on the status topic. Send the request “CLOSE”, they move down, and send “CLOSED” on the status topic. And send “STOP”, power is interrupted, and “STOPPED” is sent on the status topic.

Here’s how I configured it in home assistant:

- platform: mqtt
  unique_id: shutter_living
  name: "Shutter Living Room"
  device_class: shutter
  icon: "mdi:window-shutter-open"
  state_topic: "home/shutter/living/status"
  command_topic: "home/shutter/living/request"
   - topic: "home/shutter/status"
     payload_available: "ONLINE"
     payload_not_available: "OFFLINE"
  payload_open: "OPEN"
  payload_close: "CLOSE"
  payload_stop: "STOP"
  state_opening: "OPEN"
  state_closing: "CLOSED"
  state_stopped: "STOPPED"
  qos: 2
  retain: true

This has a weird effect: When I send the open, the status changes to “opening”, and when I click stop, home assistant assumes that they now have fully opened.
This means that the ‘open’ button is now greyed out.

How would you configure what I really want: displaying that the shutters are somewhere between open and close, and give the option to both open and close?

Thank you

Update: I have been able to keep the button enabled by using the option optimistic: true. Any other suggestions?