MyQ garage door integration does not work with automation, but works on dashboard?


I am a new Home Assistant user and I was able to hook up my craftsman garage door opener on the MyQ plug-in to Home Assistant. It works flawlessly when I press the up and down buttons with the widget I have on the dashboard, however, it stopped working for the automation I set up.

The automation I set up detects when my phone is entering my home zone, and it tells the garage door opener to open up the door. It worked great for a few days, but the past week, it has only worked 1 out of 5 times that I’ve gone home. I had to open the garage door from the Home Assistant dashboard using the widgets, which worked.

I checked the automation and it does indeed get triggered, but it gets the following error when trying to open the garage door:

2022-06-29 19:49:58 ERROR (MainThread) [homeassistant.components.automation.open_garage_door_when_coming_home_phu] Error while executing automation automation.open_garage_door_when_coming_home_phu: Opening of cover Garage Door Opener failed with error: Error requesting data from<Some sort of uuid>/door_openers/<some sort of code>/open: 401 - Unauthorized

This message happens every time the automation doesn’t work properly. Has anyone encountered this or know why it might be happening?

Came here looking to see the exact same thing. this started just a few days ago for me. The most annoying part is if I go into the myq app and logout and back in (I use my google ID) it starts working but only for a short while.

Have you had any luck finding out why?

I haven’t tried changing a cover via an automation, just via the UI (aka widget, as you call it.) However, I had similar issues with my Z-Wave switches. So I wrote a script that repeatedly tries to change a set of switches until either they change as requested, or it’s tried too many times. And if any switch does not change as requested it creates a persistent notification with the details.

I’ve adapted it to covers, although I haven’t tried it myself. You might give it a try and see if it helps, at least in the interim until a real solution is found.

You call it like this:

- service: script.change_covers
      - cover.garage_door
    new_state: closed

covers can include more than one entity ID. And, of course, you can use templates as necessary.

Here’s the script:

    alias: Change Covers
    mode: queued
      - repeat:
          while: >
            {{ states.cover | selectattr('entity_id', 'in', covers)
               | selectattr('state', 'ne', new_state) | list | length > 0 and
               repeat.index <= 3 }}
            - variables:
                covers_to_change: >
                  {{ states.cover | selectattr('entity_id', 'in', covers)
                     | selectattr('state', 'ne', new_state) | map(attribute='entity_id') | list }}
            - service: "cover.{{ 'close' if new_state == 'closed' else 'open' }}_cover"
                entity_id: "{{ covers_to_change }}"
            - wait_template: >
                {{ states.cover | selectattr('entity_id', 'in', covers_to_change)
                   | selectattr('state', 'eq', new_state) | list | length == covers_to_change | length }}
              timeout: 15
      - variables:
          covers_did_not_change: >
            {{ states.cover | selectattr('entity_id', 'in', covers)
               | selectattr('state', 'ne', new_state) | map(attribute='entity_id') | list }}
      - condition: template
        value_template: "{{ covers_did_not_change | length > 0 }}"
      - service: persistent_notification.create
          message: >
            {{ states.cover | selectattr('entity_id', 'in', covers_did_not_change)
               | map(attribute='attributes.friendly_name') | join(', ') }} did not change to {{ new_state }}

EDIT: You might want to increase the timeout in the wait_template. 15 seconds was more than sufficient for Z-Wave switches, but covers, of course, take longer to change state than Z-Wave switches. Maybe 30 seconds???

Have you tried with a regular username/password? Because it sure sounds like a authorization problem. I use myq and its cloud service is garbage at times but it works most times.

Sorry for the late reply, but I did get it working again. I had restarted my home assistant server and it started working again. I did not change any configurations either.