Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Issue with loading the custom component #2

Open
catduckgnaf opened this issue May 29, 2023 · 14 comments · May be fixed by #3
Open

Issue with loading the custom component #2

catduckgnaf opened this issue May 29, 2023 · 14 comments · May be fixed by #3

Comments

@catduckgnaf
Copy link

`This error originated from a custom integration.

Logger: homeassistant.setup
Source: custom_components/ryobi_garage/ryobiapi.py:189
Integration: ryobi_garage
First occurred: 10:20:26 AM (1 occurrences)
Last logged: 10:20:26 AM

Error during setup of component ryobi_garage
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 257, in _async_setup_component
result = await task
File "/config/custom_components/ryobi_garage/init.py", line 59, in async_setup
device_info = await ryobi_api.get_device(device["d_id"])
File "/config/custom_components/ryobi_garage/ryobiapi.py", line 146, in get_device
return self.extract_device_info(resp)
File "/config/custom_components/ryobi_garage/ryobiapi.py", line 189, in extract_device_info
"lastSet": garage_door["opMode"]["lastSet"],
KeyError: 'lastSet'
`

@CJOWood
Copy link
Owner

CJOWood commented May 29, 2023

What model of garage door opener do you have?

@catduckgnaf
Copy link
Author

I have the 200. Also it "looks" like HA updated something, as I am not the only one with the first error in setup.py.

@catduckgnaf
Copy link
Author

I wonder if the webhook change in HA caused the issue? can anyone confirm?
https://www.home-assistant.io/blog/2023/05/03/release-20235/#breaking-changes

@CJOWood
Copy link
Owner

CJOWood commented May 29, 2023

The integration doesn't connect to HAs webhooks. It's likely your model of garage door opener response differently to the API requests. I'll need to know what model garage door opener you have and may need some logs to compare API responses.

Looks like it's failing when it tries to get information about the device from the HTTP API using its device ID.

If you can set this components logging to debug. And anonymize the responses and requests.

_ I am in the middle of report cards. But I'll get to it as soon as possible in my free time. _

@catduckgnaf
Copy link
Author

Hello There! I appreciate it a lot. Here is a link to the information. https://pastebin.com/ftcWfMkh

I did see that many HACS integrations are starting to fail, not sure if related: iMicknl/ha-nest-protect@568d538

I also have two garages, and previously had issue getting the Ids. This from the previous project fixed it for me.
https://github.com/catduckgnaf/ryobi_gdo3/blob/master/doorid.py

@HunterDG
Copy link

HunterDG commented Nov 20, 2023

Seconding - I also have a GDO 200.

I added a None fallback (line 189) - unsure what that might break or if it should just fall back to time.now(), but it works great at the moment. Probably not worth a PR unless @CJOWood says otherwise:

"lastSet": garage_door["opMode"].get("lastSet"),
Here's the relevant bit of the API return (missing 'lastSet')

"opMode": {
    "varName": "opMode",
    "varType": "tc_uint8",
    "defv": 0,
    "dataType": "number",
    "units": "",
    "metaData": {"name": "Garage Door Operation Mode"},
    "enum": ["Standard", "Pre-Lockout", "Lockout"],
    "max": 5,
    "min": 0,
    "flags": ["C"],
    "value": 0,
    "lastValue": 0,
}

edit - I actually had to update every instance of ["lastSet"] with .get("lastSet") when the return started missing that key everywhere...

additional edit - I'm guessing this key is probably missing from every newly-added (to the App) GDO, as I had just re-added mine when I started missing all the ["lastSet"] keys

@HunterDG HunterDG linked a pull request Nov 20, 2023 that will close this issue
@catduckgnaf
Copy link
Author

@HunterDG and @CJOWood I have worked hard, and we now have a "proper" integration. Actively improving, auto configures. I welcome any additions.
https://github.com/catduckgnaf/ryobi_gdo

@CJOWood
Copy link
Owner

CJOWood commented Jan 17, 2024

@HunterDG and @CJOWood I have worked hard, and we now have a "proper" integration. Actively improving, auto configures. I welcome any additions.
https://github.com/catduckgnaf/ryobi_gdo

Hey, that is great. My desire with this integration was to have a continuous open websocket connection to get live push updates, rather than polling the API.

The integration I copied to do this worked slightly differently than I expected so it has ended up working inconsistently. I would love to fix it but am just too busy.

Do you find you can get fast enough updates for the entities?

@catduckgnaf
Copy link
Author

That's my next step, and what I'm working on. Building on the work you did and others. Currently trouble shooting some of that, but it'd coming along.

@CJOWood
Copy link
Owner

CJOWood commented Jan 17, 2024

That's my next step, and what I'm working on. Building on the work you did and others. Currently trouble shooting some of that, but it'd coming along.

Awesome. I'll definitely try your in it's current state and help out where I can! If we get web sockets implemented properly than that would be incredible!!

@catduckgnaf
Copy link
Author

That's my next step, and what I'm working on. Building on the work you did and others. Currently trouble shooting some of that, but it'd coming along.

Awesome. I'll definitely try your in it's current state and help out where I can! If we get web sockets implemented properly than that would be incredible!!

I would appreciate you looking at. It discovers all entities, such as light and my parking sensor. We did use what you had to get started with websockets, but its currently still polling. Would love your help to push this over the edge.

@catduckgnaf
Copy link
Author

It should be getting pushes now

@HunterDG
Copy link

HunterDG commented Jan 18, 2024

@catduckgnaf any tips on initial config of yours? not sure what to do after install.

@catduckgnaf
Copy link
Author

@catduckgnaf any tips on initial config of yours? not sure what to do after install.

You go under integrations like any "regular integration"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants