Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add Freebox device tracker #12727
This pull request adds a device tracker platform for the Freebox, the server/router of the french FAI Free, along the lines of PR #10702. It is based on freepybox, but it necessitates some changes that have not been released yet.
The platform can be set up automatically through discovery (once this netdisco commit will be released), or configured as usual.
There is some documentation in the header of the file, I can make that a full documentation page in home-assistant.github.io if need be.
Example entry for
I've run tox in my local repo, but I have no output so I'm not sure it's actually testing anything...
I have some questions regarding this PR:
First of all, is it ok to make this pull request to initiate discussions even if it depends on a third-party library version that is not released yet, or should I have waited?
Secondly, the Freebox requires a manual intervention from the user to authorize applications, pretty much like the Hue bridge does: the first time an application requests access to the server, the user must authorize it directly on the device. What would be the correct way to handle this? Do I need to make a custom component so that the user can configure the access from the home page, as is done for Hue for instance, or is it acceptable to simply give instructions in the documentation (for starters)?
About the automatic setup through discovery, I was wondering if it is something desirable for device trackers? Device tracking can be seen as a bit intrusive, is it a good idea to start doing it without user intervention? If not, what would be the correct approach to notify the user that we discovered a Freebox device, along with the host and port to use in her configuration file if she wishes to set it up?
WIP PRs are OK.
You can use the configurator component to ask the user to perform actions to facilitate login or setup. Look at eg the August component.
Another alternative is the new config entry flow. See #12830 for hue. This flow is very new and might be considered experimental. It also requires test coverage if you implement it.
The config flow approach will also handle discovery and let the user dismiss a discovered device if its not wanted to be setup as an integration.
The user can turn off discovery component if it's not wanted. It's also possible to configure it to ignore certain platforms.
@MartinHjelmare The new config flow seems to be exactly what I had in mind, I'll read through the related PRs and see if I can implement it.
@ylecuyer Beta testing would be much welcomed, but for now it requires a bit of manual intervention to install the unreleased-yet dependencies. You will need to install freepybox with the latest changes, either from the upstream repo, or from my fork where the version number has already been bumped to 0.0.3. If you want to test discovery, you will need a version of netdisco with this commit, or you can rollback the netdisco version number to 1.2.4 and use manual configuration. Please let me know if you have any questions or feedback!
It's been a while since I reached out to the maintainer of Freepybox without response, so I decided to fork his work in an asynchronous library, which will be more suited to integration in Hass. I've released it on PyPI (aiofreepybox) and I've modified the component to make it asynchronous as well.
However, I still have an error I'm not sure how to solve: my log repeatedly indicates that "
I have this error even when I disable the Freebox device tracker, so I'm not sure it comes from my code, but since it seems to relate to the asyncio loop, I'm wondering if it could be related to the other error. Any insight? FYI, I'm currently working on Windows with Python 3.6.4.
@MartinHjelmare Thanks for the reviews, all good points! I will be on holidays for the next week, I'll make the changes when I'll be back.
However, I still don't understand why
@MartinHjelmare After investigating a bit, I think I understand what the problem is. The Throttle decorator wraps the coroutine function in a non-coroutine function (and rightfully so,
referenced this pull request
May 22, 2018
Jun 5, 2018
added a commit
this pull request
Aug 11, 2018
Hey @gsemet! I have considered making a full-fledged component instead of just a device tracker, with support for toggling wifi, getting list of missed calls, etc., but I wanted to see if there was a need in the community before doing so :)
I won't start working on this before at least a few weeks though, I just had a happy event in my life that will keep me quite busy! In the meantime, how about creating a feature request with the features you would like to see in the component? You can take a look at the Freebox API to see what would be feasible or not.