sbabcock23 / hass-tryfi

Home Assistant integration for TryFi Dog Collar GPS monitoring.
https://github.com/sbabcock23/hass-tryfi
Apache License 2.0
52 stars 17 forks source link

Cannot Setup Integration #30

Closed tjsansone closed 3 years ago

tjsansone commented 3 years ago

Repro Steps:

Logger: homeassistant.util.async Source: util/async.py:131 First occurred: 6:38:46 AM (1 occurrences) Last logged: 6:38:46 AM

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for tryfi doing I/O at custom_components/tryfi/config_flow.py, line 47: tryfi = PyTryFi(username=data[CONF_USERNAME], password=data[CONF_PASSWORD])

I was able to get past the error by changing line 47 to:

tryfi = await hass.async_add_executor_job(PyTryFi, data[CONF_USERNAME], data[CONF_PASSWORD])

With this change, the TryFi integration adds successfully. However, no entity ever ends up populating.

The issue seems to stem from config_flow.py - like the user input doesn't appear to save properly (update interval, then next time I go back to options and it's back to the default of 10 again). I spent an hour investigating, but I'm still pretty new to Home Assistant.

Let me know if I can help. I really appreciate your efforts on this project and on PyTryFi!

tjsansone commented 3 years ago

From testing out the PyTryFi module, it seems I am able to log in successfully, but the updates do not return any pets or bases (length = 0). So that explains why the HACS integration isn't working for me.

Anyone else having trouble?

tjsansone commented 3 years ago

@sbabcock23 - First off, I just want to thank you for putting together these projects! I've been wanting to take my pup's TryFi to the next level ever since I got it and was very glad when I learned of your project via HACS. Q: Are community contributions welcome?

I have a couple PRs just about ready to go.. Brief synopsis:

Problem came down to PiTryFi structuring queries with invalid syntax. I'm not familiar with the method being employed; while very clever, it's also kind of confusing. Therefore, I recommend using the graphql-python/gql client, since it's very straightforward and saves work.

Aside from that, the only other issue is with the HACS integration config_flow.py - need to change to async and adjust user input save.

Please let me know if you have any thoughts. Cheers!

sbabcock23 commented 3 years ago

Hi @sans-1 ,

Thanks for your help already on this issue. I'm all for community contributions. I have limited time right now so any help is much appreciated. I haven't used that library for graphql but I'll take a look at it when I can. Feel free to contribute!

sup3rm3ga commented 3 years ago

I am having the same issue.