MQTT Cover with Zwave2Mqtt

Hi,

in order to integrate an MQTT cover drive by Zwave2Mqtt, I need to set different topic for opening and closing (I can’t use the command_topic because there is 2 different topics, one for open and one for close). Is there a way to do that?

For open the cover, I need to send true in xxx/38/1/1/set.
For close the cover, I need to send true in xxx/38/1/2/set.
And for stop the cover, I need to send false in xxx/38/1/1/set or xxx/38/1/2/set.

Thanks

I found no way to do this and I think it need an evolution in the MQTT cover component?

I try to found a workaround by using Template Cover but can’t get it works.

I’m here

sensor:
  - platform: mqtt
    name: "Pos_Bathroom"
    state_topic: "zwave2mqtt/14/38/1/0"

cover:
  - platform: template
    covers:
      bathroom_cover:
        friendly_name: "Salle d'eau"
        open_cover:
          - service: mqtt.publish
            data:
              topic: 'zwave2mqtt/14/37/1/1/set'
              payload: true
        close_cover:
          - service: mqtt.publish
            data:
              topic: 'zwave2mqtt/14/37/1/2/set'
              payload: true
        stop_cover:
          - service: mqtt.publish
            data:
              topic: 'zwave2mqtt/14/37/1/2/set'
              payload: false
        set_cover_position:
          - service: mqtt.publish
            data:
              topic: 'zwave2mqtt/14/37/1/0/set'
              payload: "{{ value | float * 99 / 100) | round(0) }}"
        position_template: "{{ (states('sensor.Pos_Bathroom') | float * 100 / 99) | round(0) }}"

and I have some questions.

  • Is there a way to use mqtt directly for the position_template instead of use a sensor?
  • For the sensor, is there a way to calculate directly the correct value between 0 and 100 (the value publish in zwave2mqtt/14/38/1/0 goes from 0 to 99). In my example, I do the calculation in the position_template but it should be better if I could do it directly in the sensor if I want to reuse the value for other purpose. I’ve try with the value_template but can’t make it works.
  • for the “set_cover_position configuration”, the example I provide doesn’t works it always fully open the cover not depending on the position I select on the slider. The slider allow to set the value between 0 and 100, and my goal is to convert this value to the range 0 -> 99 and publish it to the topic zwave2mqtt/14/37/1/0/set
  • for the open (and same for close or stop), I should publish true to ‘zwave2mqtt/14/37/1/1/set’. If i do that with for example MQTT explorer, it works, but with Home Assistant and the configuration above it doesn’t works.

Thanks

Hi,

I’ve been trying to get my cover to work as well which one do you have? I’ve got the Fibaro one.

cover:
  - platform: mqtt
    name: "MyBlind"
    command_topic: "zwave2mqtt/Hearth_Vent/38/1/0/set"
    position_topic: "zwave2mqtt/Hearth_Vent/38/1/0"
    set_position_topic: "zwave2mqtt/Hearth_Vent/38/1/0/set"
    value_template: "{{ (value_json.value / 99 * 100) | round(0) }}"
    position_open: 99
    position_closed: 0
    payload_open: "99"
    payload_close: "0"

This is mostly working except for the stop button.

Thanks @foxy82,
I’ve seen your solution on issu resolution of Zwave2MQTT github and I works mostly as expected.

But in order to have a fully working solution and for me to better understand how it works, could someone help me to better understant how should I configure the cover template in my situation?

Should I post a feature request to get different topic parameter for the mqtt cover device (instead of only on command topic)?

Thanks

What do you need to publish to the command_topic to stop the cover? Is it false?

Would this work?

payload_stop: false

Or this?

payload_stop: 'false'

Hi,

I finally could try this :
payload_stop: 'false'
and it works prefectly.

Thanks

1 Like

@DavZero do you need the different topics anymore? What solution did you use?

Hi @foxy82,

Yes I need the different topics anymore in order to automatically integrate zwave2mqtt in home assistant.
Actually I use this :

cover:
  - platform: template
    covers:
      bathroom:
        friendly_name: "Volet Sde"
        position_template: "{{ ((states('sensor.cover_bathroom')|float) * 99/100) | round }}"
        open_cover:
          service: mqtt.publish
          data_template:
            topic: "zwave2mqtt/14/38/1/1/set"
            payload: 'true'
        close_cover:
          service: mqtt.publish
          data_template:
            topic: "zwave2mqtt/14/38/1/2/set"
            payload: 'true'
        stop_cover:
          service: mqtt.publish
          data_template:
            topic: "zwave2mqtt/14/38/1/2/set"
            payload: 'false'
        set_cover_position:
          service: mqtt.publish
          data_template:
            topic: "zwave2mqtt/14/38/1/0/set"

and this :

sensor:
  - platform: mqtt
    name: "cover_bathroom"
    state_topic: "zwave2mqtt/14/38/1/0"

but this solution is not optimal,

  • first I need to create on sensor by cover because I can’t use directly the position topic in the cover (when I say I can’t, I mean I think it’s possible but can’t made it works).
  • second, read the position works correctly but I can’t set the position (I should try again but I remeber that the last time I play with it, when change the position in the HA interface completely open the roller when I set the position to any value).

So for now I stay with this configuration because I prefer to made open / close / stop button instead of position but I think that adding capability in the MQTT Cover configuration to define open topic / close topic and stop topics with for each topic payload should be the best solution (and As I say I think after that we could integrate automatically the zwave2mqtt cover through the home assistant discover process)

Thanks again for all the help.

Hi All,
not sure if this is specific to the mqtt cover but i can sent true or false to

zwave/cover/38/1/0/set

This seems to work for me by putting this into the Hass Device JSON when using discovery is detected fine:

{
  "type": "cover",
  "object_id": "cover",
  "discovery_payload": {
    "payload_open": true,
    "payload_close": false,
    "device_class": "blind",
    "value_template": "{{ value }}",
    "command_topic": "zwave/bedroom_blinds/38/1/0/set",
    "state_topic": "zwave/bedroom_blinds/38/1/0",
    "state_open": 1,
    "state_closed": 0,
    "json_attributes_topic": "zwave/bedroom_blinds/38/1/0",
    "device": {
      "identifiers": [
        "zwave2mqtt_bedroom_blinds"
      ],
      "manufacturer": "Somfy",
      "model": "0x5401",
      "name": "Somfy Blinds",
      "sw_version": "Unknown"
    },
    "name": "bedroom_blinds_cover",
    "unique_id": "zwave2mqtt_bedroom_blinds_27-38-1-0"
  },
  "discoveryTopic": "cover/bedroom_blinds/config",
  "values": [
    "38-1-0"
  ],
  "persistent": true,
  "id": "cover_cover"
}
1 Like

@DavZero Your template works great for my blinds. Thanks. I added payload: "{{ position }}" to your set_cover_position: data_template: to make the slider work. My blinds are Somfy made by Springs Window Fashions (Graber).

Thanks @loafbread, using
payload: "{{ position }}"
works good for me too.

Hi foxy82, did you ever get the stop button working?

I moved to use the OZW integration. However that still isn’t perfect.

1 Like

What functionality are you still missing? And do you mind sharing an example of your cover config for OZW?

Hi @dooz127, @foxy82,

I finally made the cover fully functionnal with zwave2mqtt by using this configuration :

- platform: template
  covers:
    bathroom:
      friendly_name: "Volet Sde"
      position_template: "{{ ( ( states('sensor.cover_bathroom') | float ) * 100 / 99 ) | round }}"
      open_cover:
        service: mqtt.publish
        data_template:
          topic: "zwave2mqtt/14/38/1/1/set"
          payload: 'true'
      close_cover:
        service: mqtt.publish
        data_template:
          topic: "zwave2mqtt/14/38/1/2/set"
          payload: 'true'
      stop_cover:
        service: mqtt.publish
        data_template:
          topic: "zwave2mqtt/14/38/1/2/set"
          payload: 'false'
      set_cover_position:
        service: mqtt.publish
        data_template:
          topic: "zwave2mqtt/14/38/1/0/set"
          payload: "{{ position }}"

We need to add a sensor per cover :

 sensor:
  - platform: mqtt
    name: "cover_bathroom"
    state_topic: "zwave2mqtt/14/38/1/0"

I think there should be evolution in mqtt cover in order to integrate it automatically.

1 Like

This works perfectly for my Aeotec Nano Shutters. Thank you!

Stop button still doesn’t work for my Fibaro Roller Shutter 2 in the OZW (Beta) integration. Also until recently covers weren’t in it .

I`m trying to use this example for a Zwave.Me motor controller but it looks like some of the MQTT topics are different the unit is detected as dimmer and switch

Switch

2020-09-05 12:27:58 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on homeassistant/nodeID_23/37/1/0/set: True
2020-09-05 12:27:58 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/nodeID_23/37/1/0/set: b'True'

Dimmer

2020-09-05 12:29:40 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on homeassistant/nodeID_23/38/1/0/set: 84
2020-09-05 12:29:40 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on homeassistant/nodeID_23/38/1/0/set: b'84'

The sensor for example is not working but this might be due to the fact that the module is not realy sending status updates

My Bali shades act as both a switch (shades up or down) and a dimmer (set the position of the shades).