Using MQTT to create a `cover` with `device_class: garage` so that MIMOlite switch can be used in Alexa, Open/Close Garage Door

  • EDIT: This is a how-to but there’s also a question about getting the correct state for the cover.

I’ve been mostly successful in that I now have a Garage Door opener in Alexa that prompts for voice code and actually does open, close or stop the garage door as opposed to saying “Garage Door doesn’t support that.”. The trick to getting it to work is not only device_class: garage but also device type cover.

cover:
  - platform: mqtt
    name: "Garage Door Opener"
    unique_id: mqtt-garage-door-opener
    device_class: 'garage'
    device:
      identifiers: "z-wave"
      manufacturer: "FotrezZ"
      model: "MIMOlite"
      name: "MIMOlite"
      sw_version: "1.17"
      via_device: "OpenZWave"
    command_topic: "OpenZWave/1/command/setvalue/"
    state_topic: "OpenZWave/1/node/11/instance/1/commandclass/48/value/189530128"
    state_open: "open"
    state_closed: "closed"
    payload_open: '{ "ValueIDKey": 155795472, "Value": true }'
    payload_close: '{ "ValueIDKey": 155795472, "Value": true }'
    payload_stop: '{ "ValueIDKey": 155795472, "Value": true }'
    value_template: "{{ value_json.Value }}"
    optimistic: false
    retain: true

I appear though to be missing the correct state of this new garage door opener in my new ‘cover’. I am attempting to reference the state of the ozw tilt sensor which is true|false but the state of the cover in HA remains unknown

image

Mimolite Node 9
OpenZWave/1/node/9/instance/1/commandclass/37/value/155795472/

{
    "Label": "Switch",
    "Value": false,
    "Units": "",
    "ValueSet": true,
    "ValuePolled": false,
    "ChangeVerified": false,
    "Min": 0,
    "Max": 0,
    "Type": "Bool",
    "Instance": 1,
    "CommandClass": "COMMAND_CLASS_SWITCH_BINARY",
    "Index": 0,
    "Node": 9,
    "Genre": "User",
    "Help": "Turn On/Off Device",
    "ValueIDKey": 155795472,
    "ReadOnly": false,
    "WriteOnly": false,
    "Event": "valueChanged",
    "TimeStamp": 1609904761
}

Ecolink Tilt Sessor Node 11
OpenZWave/1/node/11/instance/1/commandclass/48/value/189530128/

{
    "Label": "Sensor",
    "Value": false,
    "Units": "",
    "ValueSet": true,
    "ValuePolled": false,
    "ChangeVerified": false,
    "Min": 0,
    "Max": 0,
    "Type": "Bool",
    "Instance": 1,
    "CommandClass": "COMMAND_CLASS_SENSOR_BINARY",
    "Index": 0,
    "Node": 11,
    "Genre": "User",
    "Help": "Binary Sensor State",
    "ValueIDKey": 189530128,
    "ReadOnly": true,
    "WriteOnly": false,
    "Event": "valueChanged",
    "TimeStamp": 1609904770
}

Any ideas how to get the state set to Open or Closed?

I think it’s a alexa thing

I have garage cover if I say “alexa open garage door” she don’t
But
If I say alexa turn on garage door it opens

If did work but with one of the updates it stops
Can just remember reading some where alexa stop it for security reasons

Thanks, I know what you’re saying about the Alexa thing Garage door doesn’t support that.
Her issue is the device has to be a device_class: garage cover which then triggers her to set it up like a lock with a voice code PIN but if the device is not a cover, she cannot open, close or stop it as those are cover functions. I was using the MIMOlite switch in Alexa with voice routines When I say… Alexa, open garage door or Alexa, close garage door she would toggle the MIMOlite switch.

I’m past that now and have a working garage door opener in Alexa without special voice routines and she can now open it since the MQTT device is a cover, device_class: garage.

I’m trying to figure out if/how I can get the state of the new cover to be Open or Closed.

If I can get state to say open or closed then the icon in the UI will be correct.

image image

image image

I just tried changing the MQTT value_template: but it’s doing the trick either…
value_template: "{% if value_json.Value %} Open {% else %} Closed {% endif %}"

Resolved!!!

  1. I was missing a trailing / in the state topic
  2. value_template: "{% if value_json.Value %} open {% else %} closed {% endif %}"
  3. Removed state_open: "open" and state_closed: "closed"
  - platform: mqtt
    name: "Garage Door Opener"
    unique_id: mqtt-garage-door-opener
    device_class: 'garage'
    device:
      identifiers: "z-wave"
      manufacturer: "FotrezZ"
      model: "MIMOlite"
      name: "MIMOlite"
      sw_version: "1.17"
      via_device: "OpenZWave"
    command_topic: "OpenZWave/1/command/setvalue/"
    state_topic: "OpenZWave/1/node/11/instance/1/commandclass/48/value/189530128/"
    payload_open: '{ "ValueIDKey": 155795472, "Value": true }'
    payload_close: '{ "ValueIDKey": 155795472, "Value": true }'
    payload_stop: '{ "ValueIDKey": 155795472, "Value": true }'
    value_template: "{% if value_json.Value %} open {% else %} closed {% endif %}"
    optimistic: false
    retain: true

The cover now reflects the state of the Garage Door…

image

image

…AND it works properly from Alexa!

1 Like

good spotting

I had made that same mistake some time ago and when I read a note somewhere in HA MQTT docs about …/…/… versus …/…/…/ I knew that I had likely done it again!