Myq componenet issues

Awesome! I’m glad to see so much progress being made on this component.

PR submitted, will see how much the real developers beat me up on it during review.

https://github.com/home-assistant/home-assistant/pull/5886

2 Likes

@Bahnburner @rabittn The PR has been merged, should be available in 0.39. Note for everyone: once .39 comes out the custom component will need to be removed and also a change to your config. Simply change “brand” to “type”. So basically its just username, password, type as the config parameters. The new online documentation will have a simple example.

5 Likes

Awesome. I didn’t expect the PR to be accepted to quickly. I’ve seen it take quite a while with a few other components.

This is awesome. Thanks a TON!

I had just updated my custom component yesterday with the newest code using the new api etc… and got this working again.
Today, after updating Home Assistant to 0.38.2 I am getting an error in login method. Seems the API is not allowing login anymore. Is anyone else seeing a similar error? I see the error returned which I don’t think is particularly useful:

Your request has been denied.

[5442595389188212690]

Myq was working for me earlier today. After restarting HASS, it has died for me as well. I was running the custom component that had been posted above ( https://raw.githubusercontent.com/arraylabs/myq/master/myq.py )

My error log:

17-02-13 14:46:21 ERROR (MainThread) [homeassistant.components.cover] Error while setting up platform myq
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/hass/.homeassistant/custom_components/cover/myq.py", line 64, in setup_platform
    add_devices(MyQCoverDevice(myq, door) for door in myq.get_garage_doors())
  File "/home/hass/.homeassistant/custom_components/cover/myq.py", line 144, in get_garage_doors
    devices = self.get_devices()
  File "/home/hass/.homeassistant/custom_components/cover/myq.py", line 122, in get_devices
    self._logged_in = self.login()
  File "/home/hass/.homeassistant/custom_components/cover/myq.py", line 113, in login
    auth = login.json()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/requests/models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode
    raise ValueError(errmsg("Expecting value", s, err.value)) from None
ValueError: Expecting value: line 1 column 1 (char 0)

@mike-geiger @ih8gates I just updated the myq.py file with endpoint changes (argggg!). Working again on my end.

https://raw.githubusercontent.com/arraylabs/myq/master/myq.py

1 Like

@lordsiris thanks that fixed it.
I really wish this company would open things up and be a little more supportive of 3rd party apps and developers. i feel locked in because I already have the unit, but I wouldn’t recommend it to anyone else just because of the hostility towards people trying to integrate with their api. I never know when it’s going to stop working, and that could mean leaving the door open when i leave the house or overnight.

1 Like

So once this is a released component in the next major version, how would something like this get resolved?

If they fiddle with the API once this is a released component would a .x version update to home assistant be necessary to resolve the issue?

yes and no. a new release would be the “automatic” update or easy fix but you could still apply a manual fix by updating a file.

@mike-geiger @Fresh Not sure they will change too much moving forward, at least not as much as the last week or so. I have it on “good authority” the endpoints are valid ones. With that said I will be testing a couple more things here locally that I just discovered tonight, nothing revolutionary just had an aha moment earlier this evening and I am validating my endpoints and inputs to those endpoints against those known be in use by other “things”. Also found a new APP_ID to add in, also appears the APP_ID doesn’t matter anymore based on the brand, same goes for the HOST_URI, I can validate against both the myexternal and craftexternal with the same credentials.

So will have myq.py changes in another day or so, just mostly a cleanup and the one you have should continue to work for now (unless they kill off the APP_ID it’s currently using).

The API stuff is all in an external library in my github account and the official myq component loads that on installation (or maybe on restart? unsure of that?).

@rabittn do you have more information, or can point me to it, on how the required external libraries are loaded in HA. I can see it in my dev environment on setup go out, grab them, then install them. I use docker for my live HA so I don’t really know how a normal install works (non dev, non docker).

@lordsiris

when HA starts it reads the library requirement for myq from this line.

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/cover/myq.py#L16

and downloads the required version of the library.

So once you update your code you need to increment the version number on your library.

Then submit a PR for HA to require the new version number. If you note in the PR that this is to fix a breaking change it should be included in the next hotfix release.

@rabittn Thanks, you confirmed what I thought had to happen.

Just pushed a new version of the file to github. Basically cleaned up the endpoints a bit more, updated to latest APP_IDs, changed supported brands dropping craftmaster and adding craftsman and merlin (AU device). Dropping craftmaster as I can’t find any reference to it in any of the latest information I have found. Definitely have info for craftsman and merlin.

Hopefully with these endpoints we should be good for a while. Will make the changes required for the official component and get a new PR in for them.

https://raw.githubusercontent.com/arraylabs/myq/master/myq.py

This is working great for me and my Chamberlain MyQ!

@jayknott I’ve been following along but got lost at some point. Did you have to keep the custom component in or were you able to get it working just by updating HA and changing your config to match the new version? Thanks!

@jayknott Glad to hear!!

@jschwalbe Currently still need the custom component as it won’t be in HA official until the .39 release (think thats next weekend). Will have to change “brand” to “type” in .39 config to use the official.

@jschwalbe You still need the custom component.

@lordsiris I am now getting this error. Everything still works, but thought you might want to try and clear it up:

17-02-17 22:15:12 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 336, in _async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 186, in async_add_entity
    object_id = entity.name or DEVICE_DEFAULT_NAME
  File "/home/homeassistant/.homeassistant/custom_components/cover/myq.py", line 217, in name
    return self._name if self._name else DEFAULT_NAME
NameError: name 'DEFAULT_NAME' is not defined

I added the DEFAULT_NAME back in. Just have to re-download the myq.py file. Thanks!