[SOLVED] MQTT cover for myHome/Bticino with no percentage and no open/closed states

Hi

I’m trying to use an mqtt cover to define a myHome/Bticino with no percentage and no opne/closed states.

I can only send 3 commands (open, close, stop), but there is no “feedback” from the gateway if the blind has reached the start or the end and there is no percentage info returned.

I’ve created the cover, but when I press the first time the UP or DOWN button, and then STOP, the first button become grey and I cannot press anymore.

Is there any way to define a cover in this particular case?

Thanks

Please post your configuration.

The cover entity should assume optimistic mode if you don’t set state_topic nor position_topic. The buttons up/down should not be disabled in optimistic mode.

cover:
  - platform: mqtt
    name: "My covers"
    command_topic: "command_topic_here"

Thanks

This Is my actual config

- platform: mqtt
  name: "MQTT Cover"
  command_topic: "cover/cmd"
  state_topic: "bticino/out"
  qos: 1
  retain: true
  payload_open: '{"idx": 73, "nvalue": "1" }'
  payload_close: '{"idx": 73, "nvalue": "2" }'
  payload_stop: '{"idx": 73, "nvalue": "0" }'
  state_open: "opening"
  state_closed: "closing"
  state_stopped: "stopped"
  optimistic: false
  value_template: '{% if value_json.idx == 73 %} {% if value_json.nvalue == 1 %} opening {% elif value_json.nvalue == 2 %} closing {% else %} stopped {% endif %} {% endif %}'

The simplest way would be to remove state_topic altogether:

- platform: mqtt
  name: "MQTT Cover"
  command_topic: "cover/cmd"
  qos: 1
  retain: true
  payload_open: '{"idx": 73, "nvalue": "1" }'
  payload_close: '{"idx": 73, "nvalue": "2" }'
  payload_stop: '{"idx": 73, "nvalue": "0" }'

The documentation says:

For covers that only report 3 states (opening, closing, stopped), a state_stopped state can be configured to indicate that the device is not moving. When this payload is received on the state_topic, and a position_topic is not configured, the cover will be set to state closed if its state was closing and to state open otherwise.

That would explain the behavior you are seeing. Sorry, but I don’t know how to fix it without giving up state_topic or explicitly setting optimistic: true.
I found this topic, but it has no answer either: Mqtt-cover roller shutter with stop

Thanks, it’s working fine now!!!