Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fbx autodetection #22

Closed
wants to merge 64 commits into from

Conversation

foreign-sub
Copy link

@foreign-sub foreign-sub commented Sep 25, 2019

Detect freebox host, port and api_version
cleanup, format, refactor
Support any number of freeboxes
Open by uid
breaking change : token file has been removed, each freebox now has it's own token file indexed by uid
api modules instances are now created only when they're called.
settings can be stored anywhere using the data_dir option.

Copy link

@stilllman stilllman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice, thanks! I have a small nitpick regarding the version parsing, but apart from that the PR is great, very useful!

aiofreepybox/aiofreepybox.py Outdated Show resolved Hide resolved
@stilllman
Copy link

@SNoof85 Any opinion on this change? If I remember correctly, the API version is fixed in Home Assistant to v4, so the change should not require any changes. It could probably be used to simplify the hass configuration.

@SNoof85
Copy link
Member

SNoof85 commented Oct 15, 2019

For sure in home assistant the api version is fixed in the Freebox integration : https://github.com/home-assistant/home-assistant/blob/71f73af535f68f8df8b4f9e229942942c67a46d3/homeassistant/components/freebox/__init__.py#L63

So in my opinion it won't break anything and i like this feature. Problem is still lack of documentation and i need to test with latest API what we have already in home assistant before using this. (if i see any use case...).

Looks good to me for merging ! 🚀

@foreign-sub
Copy link
Author

Since the latest release (4.1) the API version is now 7.

@SNoof85
Copy link
Member

SNoof85 commented Oct 17, 2019

This release has not hit my Freebox révolution right now I can't do any testing. We must keep an option to make the calls with a specific API version. Autodetect can be good to have but it should be possible to override.

@foreign-sub foreign-sub mentioned this pull request Oct 18, 2019
@stilllman
Copy link

Hey @foreign-sub! Thanks a lot for all the work you put in this library, really, but honestly I don't know how I am supposed to review your PRs: every time I come back on a PR the entire code has changed since the last time I reviewed, so I need to review everything from scratch. I'm not that attached to this library, so I'm not sure I want to spend dozens of evening reviewing code for it (I have a family, and I already do code reviews all day long at work 😄). Moreover, you seem to have more information than me about the Freebox API, the only thing I have is the doc of API v4 here, and I only have a Freebox mini 4K. What would you think of continuing development on your own fork? I would transfer ownership of the pypi package to you (and @SNoof85 if he wants to?) so that you can publish new packages. What do you say?

@foreign-sub
Copy link
Author

foreign-sub commented Nov 21, 2019

Hi, @stilllman, sorry about that, it was totally unforeseen.
If you had asked me about two months ago, my only plan was to add support for the home API, then things kind of came up one after another.
I don't have access to anymore doc than you do, i just scrap whatever data i can find around the web, but it involves mostly browsing and reviewing source code whatever the language may be.
I don't really know if i'm ready to continue on my own, i guess that if you're asking you kind of feel i am (and also want to get rid of my daily push :)), but i want you to know that your contribution has been decisive into making the API what it is now, and that i'd be sad to lose the technical expertise and patience you provided when reviewing my code.
Now i totally understand your motivation, would it be acceptable to commit the remainings pr's, publish one last release, then transfer the ownership afterwards to me and @SNoof85 of course if he want's to. I think i got one last small commit on this branch then i'm done, unless some bugs needs to be fixed of course.

@SNoof85
Copy link
Member

SNoof85 commented Nov 22, 2019

I think we can let some time to @foreign-sub to polish and then make a final review, publish a package.
Then @stilllman if you want to transfer the ownership it's not an issue for me.

@stilllman
Copy link

Sorry for the long silence, I'll try to finalize the reviews during the christmas holidays

@stilllman
Copy link

Oh! @SNoof85 @foreign-sub I just found by accident that the up-to-date API documentation is available in the Freebox help menu, on http://mafreebox.freebox.fr !

@SNoof85
Copy link
Member

SNoof85 commented Dec 20, 2019

No way ! How could we missed that for ages !
That is a real good finding !

Mine says current API is v5... seems outdated again. Not so much than in the official website.

Edit2 : but everything else is correct ! Looks like we have a reliable source !

@foreign-sub
Copy link
Author

Hey @stilllman , @SNoof85 ,

Sorry it took so long, typing was ..., but it's done.

I've merged everything in the following branch if you wanna give it a try:
https://github.com/foreign-sub/aiofreepybox/tree/afpbx-next
I've left out #50 for now, I still need to review it, but it should not be an issue.

aiofreepybox/aiofreepybox.py Outdated Show resolved Hide resolved
aiofreepybox/aiofreepybox.py Show resolved Hide resolved
aiofreepybox/aiofreepybox.py Show resolved Hide resolved
aiofreepybox/aiofreepybox.py Show resolved Hide resolved
aiofreepybox/aiofreepybox.py Show resolved Hide resolved
@SNoof85
Copy link
Member

SNoof85 commented Feb 13, 2020

@stilllman for me it's OK to get the ownership 🎉
Found someone good at python that would help me to review, merge all this.
You can contact me through Discord if needed !

Copy link
Member

@Quentame Quentame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not finished review

@@ -103,3 +103,6 @@ venv.bak/

# mypy
.mypy_cache/

#vscode
.vscode/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have a EOF

return self._get_db_base_url(self._fbx_uid)

@property
def fbx_api_mods(self) -> Optional[list]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def fbx_api_mods(self) -> Optional[list]:
def fbx_api_modules(self) -> Optional[list]:

@Quentame Quentame closed this Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants