MQTT cover + GarageQTPi state indication?

I am trying to get MQTT Cover working here, using the configuration.yaml from the components page. The commands work fine: the relay is activated for up, down, and stop so that part works. But the entity state is stuck on “Unknown”. Subscribing to the state_topic shows the state changes (“open”, “closed”) as expected, but that info never makes it into home assistant (running hassio, MQTT broker is mosquitto on a separate Pi server).

I got home-assistant mainly to open and close that stupid door. I am enjoying all the other features/components, but this door thing is driving me crazy. Any ideas would be welcome.

Without seeing your mqtt config/automations/switch/cover code it’s pretty hard to say :frowning: Also what do the logs say?

From configure.yaml:
mqtt:
broker: 192.168.1.107

cover:

  • platform: mqtt
    state_topic: “home-assistant/cover/state_topic”
    command_topic: “home-assistant/cover/set”
    name: “Garage Door”
    qos: 1
    retain: true
    payload_open: “OPEN”
    payload_close: “CLOSE”
    payload_stop: “STOP”
    state_open: “OPEN”
    state_closed: “CLOSED”
    optimistic: false
    value_template: ‘{{ value.x }}’
    The only log entry I can find is from the hassio homeassistant log:
    2017-08-17 00:38:46 WARNING (MainThread) [homeassistant.components.cover.mqtt] Payload is not True, False, or integer (0-100):
    Nothing in the HA logbook. States shows the cover.garage_door as “unknown”. The GarageQTPi config.yaml is:
    mqtt:
    host: localhost
    port: 1883
    user: user
    password: password
    doors:

    id: door
    relay: 22
    state: 17
    

state_mode: normally_closed #defaults to normally open, uncomment to switch

    state_topic: "home-assistant/cover/state_topic"
    command_topic: "home-assistant/cover/set"

The relay works as it should, mosquitto_sub sees the state response come back, i.e. “OPEN” or “CLOSED” but HA itself never sees this, or never shows it to me.

Client mosqsub/2633-core-ssh received PUBLISH (d0, q0, r0, m0, ‘home-assistant/cover/state_topic’, … (4 bytes))
home-assistant/cover/state_topic OPEN
Client mosqsub/2633-core-ssh received PUBLISH (d0, q0, r0, m0, ‘home-assistant/cover/state_topic’, … (6 bytes))
home-assistant/cover/state_topic CLOSED

Also I don’t know why the freaky fonts, etc. in that reply

Well it looks like it should be true or false not open or closed? Try publishing via ssh window with true and false and see if HA reacts accordingly?

None of those worked: 0, 1, true, false, open, closed, OPEN, CLOSED. The host sees all the messages, so mqtt is working, but HA never reacts

You don’t seem to have setup the mqtt password and user in HA?

Yes I did, but I’m not disclosing those here. I just overwrote those fields for the comment

Okay I see what you mean. I’ll put username and password entries under the mqtt: class entry

Errm nope in the HA definition they are not there, in other they are, ahh I see you did an edit :slight_smile:

Anyway I need to be up for work in a couple of hours, so we’ll continue this l8r :slight_smile:

Thanks for looking at it. I’m going to keep working on it to see what I can accomplish

Sometimes HA seems to be confused by quotes in the payload definitions, so have you tried

 state_open: OPEN
 state_closed: CLOSED

Just tried it - no change. I also put ‘homeassistant’ as a user in mosquitto with the API password. Also no change.

I have just tried on my test machine, and I think your value_template was unnecessary. This seems to work

cover:
  platform: mqtt
  state_topic: "home-assistant/cover/state_topic"
  command_topic: "home-assistant/cover/set"
  name: "Garage Door"
  qos: 1
  retain: true
  payload_open: "OPEN"
  payload_close: "CLOSE"
  payload_stop: "STOP"
  state_open: "OPEN"
  state_closed: "CLOSED"
  optimistic: false

sending

graham@lubuntu1610-VirtualBox:~/.homeassistant
$ mosquitto_pub -t home-assistant/cover/state_topic -m OPEN
graham@lubuntu1610-VirtualBox:~/.homeassistant
$ mosquitto_pub -t home-assistant/cover/state_topic -m CLOSED
graham@lubuntu1610-VirtualBox:~/.homeassistant
$ 

Changes the state correctly

And just like that it works! I am pretty sure I had tried that earlier but that was before I sorted out the user and API password. Thanks for that, now I can move on to automations. Much appreciated!

1 Like

claughinghouse1m
Has anyone had any luck with garage door wall panels that do not just require breaking or completing a circuit? I have a Genie 2028 and the wall panel has a PCB in it.

I wired GarageQtPi in and was able to successfully turn the light on the wall panel on and off but not activate the garage door.

It seems that the garage door is expecting some sort of signal from the wall panel since it has a light activate button, vacation mode, and door open/close using only 2 wires.

Anyone have any ideas where to look to see if this is possible with my or similar models?