jaraco / jaraco.abode

MIT License
11 stars 9 forks source link

Investigate compatibility issues #15

Closed jaraco closed 1 year ago

jaraco commented 1 year ago
    Homeassistant unit tests passed after updating to 3.1.1 and making a few changes:

With these changes, HA passes the unit tests. I can add the Abode integration to HA and it correctly detects the Abode Cam 2 devices!

image

Originally posted by @tradel in https://github.com/jaraco/jaraco.abode/issues/13#issuecomment-1372349408

jaraco commented 1 year ago
* Many of the imports had to be changed (e.g. `from jaraco.abode.automation import Automation as AbodeAuto` instead of `from abodepy import AbodeAutomation`)

* Timeline group constants had to be updated to match your new names.

These changes were made intentionally in the 1.0 and 2.0 releases. 1.0 dropped the abodepy library structure and 2.0 renamed the classes to remove the Abode prefixes (which just added noise).

* Removed the cache parameter to `Client` constructor (looks like you got rid of caching in 3.0?)

Yes, 3.0 removes the cache parameter. There wasn't much going on in the way of caching. There were essentially two things being saved, the cookies and the generated UUID, which was also stored in the cookies. I eliminated saving of the UUID and moved the cookie storage into "app data". For the most part, the system should continue to behave the same as before except it shouldn't be generating a "cache" file in the current directory and it's no longer possible to override the location through the API. If one has a use-case for overriding the location of the cookies file, let me know, but I'm hoping the new default location is suitable for every use case.

* Tests were all failing until I created the `/root/.local/share/Abode` folder for the shelved cookie jar. I haven't looked at the code for `jaraco.net` yet, but maybe it needs to check whether the path exists before trying to save the cookies?

The tests do attempt to ensure a path is present. I suspect in the refactor to use platformdirs that the monkeypatch is failing and the tests are using the user's data dir (which is undesirable). But if that's the case, why are tests passing in CI? Probably this concern should be a separate issue.

* `event_controller.py:189` has a typo: `.values` should be `.values()`.

* Looks like you removed `_on_websocket_connecting` from `socketio.py`, which causes an ignorable `AttributeError`. I added code to suppress the exception.

* Your implementation of `ShelvedCookieJar` does not implement a `get_dict()` method, which causes `event_controller.py:172` to fail. I added a quick and dirty implementation.

Addressed these concerns in #14. Thanks again.

tradel commented 1 year ago

These changes were made intentionally in the 1.0 and 2.0 releases. 1.0 dropped the abodepy library structure and 2.0 renamed the classes to remove the Abode prefixes (which just added noise).

I figured as much. Only pointed it out for completeness and to show what was required to get it working with HA.