MQTT Cover slider inverted

Hello,

I am trying to integrate a window blind via MQTT. The blind is being controlled from a FHEM instance via Enocean.

If the blind is fully open I get:

2020.09.02 16:43:59 5: MQTT_GENERIC_BRIDGE:DEBUG:> [mqttGeneric] publish: fhem/Eltako_Aktor_FSB61_1992942/anglePos => 0 (qos: 0, retain: 1)
2020.09.02 16:43:59 5: MQTT_GENERIC_BRIDGE:DEBUG:> [mqttGeneric] publish: fhem/Eltako_Aktor_FSB61_1992942/position => 0 (qos: 0, retain: 1)
2020.09.02 16:43:59 5: MQTT_GENERIC_BRIDGE:DEBUG:> [mqttGeneric] publish: fhem/Eltako_Aktor_FSB61_1992942/endPosition => open (qos: 0, retain: 1)
2020.09.02 16:45:26 5: MQTT_GENERIC_BRIDGE:DEBUG:> [mqttGeneric] publish: fhem/Eltako_Aktor_FSB61_1992942/state => open_ack (qos: 0, retain: 1)

position is 0 for open and 100 for fully closed.

I have defined the device like this:

cover:
  - platform: mqtt
    device_class: blind
    name: "Rollo_DG_Rechts"
    command_topic: "fhem/Eltako_Aktor_FSB61_1992942/set"
    set_position_topic: "fhem/Eltako_Aktor_FSB61_1992942/setposition"
    position_topic: "fhem/Eltako_Aktor_FSB61_1992942/position"
    state_topic: "fhem/Eltako_Aktor_FSB61_1992942/state"
    position_open: 0
    position_closed: 100
    retain: false
    qos: 1
    payload_open: "up"
    payload_close: "down"
    payload_stop: "stop"
    state_open: "open_ack"
    state_closed: "closed"
    state_closing: "down"
    state_opening: "up"
    availability_topic: "fhem/connection/status"
    payload_available: "connected"
    payload_not_available: "disconnected"

using a lovelace card I can sucessfully issue up/stop/down commands. What is driving my crazy: The slider in locelace is inverted. When the cover is open the slider is at 100% and full right, when it is closed the slider is 0% full left.

I think HA internally uses 100 for “opened” and 0 for “closed”. Can someone point me in the right direction ? cover.mqtt does have tilt_invert_state but nothing for position and defining position_open / position_closed seems not to invert the slider.

Thanks for any input you might have. I am still like a toddler in the woods with HA.

gadget.

Think of the position slider as % open. Then it is not inverted.

Well, that would work for me, but is counterintuitive and is not accepted by the focus group. :innocent:

I also have sliders for dimmers on the same card, and they work as expected, you would not accept a slider that controls the “level of darkness” either.

Hi. Did you ever get this resolved? I have exactly the same issue with strange slider behaviour.

I’m getting the same thing and did a search in the Github issues. Apparently you can change the slider behaviour by using templating instead of relying on position_open and position_closed.

YMMV but what worked for me was not defining the position_open and position_closed values but instead having set_position_template: "{{ position }}". The bar started behaving itself after I did that. Counter-intuitive I know, the guy on the Github issue said there’s also set_position_template: "{ \"position\": {{ 100 - position }} }" to fully invert, but that caused my entire blind to work backwards.

I also use this this but the slider works backwards anyway

  - platform: "mqtt"
    name: "blind"
    availability_topic: "zigbee2mqtt/bridge/state"
    command_topic: "zigbee2mqtt/blind/set"
    value_template: "{{ value_json.position }}"
    set_position_template: "{ \"position\": {{ position }} }"
    set_position_topic: "zigbee2mqtt/blind/set"
    position_topic: "zigbee2mqtt/blind"