mzdrale / pyubee

Simple library for getting stats from Ubee routers.
GNU General Public License v3.0
2 stars 4 forks source link

Add support for UBC1303BA00 and other modems with JSON-formatted lists #24

Closed jussihi closed 4 years ago

jussihi commented 4 years ago

As it seems like there is some need for the JSON-formatted lists (https://github.com/mzdrale/pyubee/issues/13 and https://github.com/mzdrale/pyubee/issues/10), and the original devs seem to have abandoned these newer devices... and ofc the fact that I have a UBC1303BA00, I decided to extend the code a little for my needs for HomeAssistant :-)

I have only tested the functionality on my own modem, so I don't know if this change breaks something in the old. I haven't really coded in python so there might be some errors.

Things I did:

@mzdrale please merge and bump version so that I can enjoy this from upstream in my HomeAssistant! Cheers!

jussihi commented 4 years ago

Ok, fixed some quickly found errors. Mainly: the auto-detection does not seem to work with UBC1303BA00, since it does not have the RootDevice.xml file. But this is not an issue for myself. Maybe it should be written down to some readme or something though...

jussihi commented 4 years ago

The latest commit also removes all dictionary entities with "unknown" as their hostname. These seem to be some recently connected but at the moment disconnected devices.

StevenLooman commented 4 years ago

Thank you for contributing. I've added some comments. Feel free to reply if anything is unclear or you have other/better ideas!

StevenLooman commented 4 years ago

You can use tox to run flake8/pylint/pydocstyle.

jussihi commented 4 years ago

I fixed some of the conventional problems in the latest commit, I left the problematic parts still unresolved. You may edit them and merge when it is properly done. I think that the Authenticator will be as is, since I don't have other Ubee model to test other Authenticator methods if I changed the code flow towards how I did with the DigestAuth.

StevenLooman commented 4 years ago

Just some minor things. Other than that it looks ok.

@mzdrale If this is resolved, can you release a new version?

mzdrale commented 4 years ago

Thank you @jussihi for contributing and @StevenLooman for reviewing this PR.

I'm not near computer right now. I will release a new version tomorrow, probably. In the meantime, @jussihi please resolve @StevenLooman's comments.

mzdrale commented 4 years ago

Hey @jussihi , please take a look at Steven's comments above. I'm waiting for you to resolve them before releasing a new version.

mzdrale commented 4 years ago

New version 0.11 released. Thank you guys!

mzdrale commented 4 years ago

@jussihi if you want, you can update Home Assistant Ubee component and create PR.

jussihi commented 4 years ago

@mzdrale I'm unfamiliar with that process, so you can do it. Thanks.

mzdrale commented 4 years ago

Home Assistant PR #43708.

mzdrale commented 4 years ago

Unfortunately, Home Assistant guys reviewed code and decided not to merge my PR and to remove Ubee compoment from Home Assistant. See their comment. We'll have to create custom Home Assistant integration for Ubee. In the meantime you can update ubee component in your home assistant manually, to use pyubee 0.11 instead of 0.10.

jussihi commented 4 years ago

Time to move over to nmap device tracker :-)

mzdrale commented 4 years ago

Or to do what I did: Buy a router that supports OpenWRT or DDWRT, for example TP-Link Archer C7, install OpenWRT or DDWRT on it and configure Ubee router just to forward all traffic to your OpenWRT/DDWRT router. I guess you got Ubee router from your ISP, like I did and you can't replace it.

jussihi commented 4 years ago

@mzdrale that's what I might very well do.

Does your router allow you to block specific devices from accessing WAN, but they can still access/be accessed from LAN? At the moment, I have a Roomba vacuum but I don't want it to be able to access its cloud. Anyway, I should be able to access the roomba itself from the LAN (homeassistant). Is this setup possible with OpenWRT/DDWRT? At the moment I need to have separate device as the LAN firewall which routes all traffic in my LAN (and blocks WAN for Roomba). I would love to get rid of it. Sorry for offtopic :)

mzdrale commented 4 years ago

Absolutely, OpenWRT and DDWRT can do that. It's exactly what I'm doing with my IoT devices.

jussihi commented 3 years ago

@Hukuma1 , the component will not come back, as it needs web scraping in order to work. Also, your issue is completely off-topic from this subject we talked about earlier. You can always make a new issue, though. It is indeed possible to make it power cycle every now and then, the request website just needs to be configured to ubee. But yes, I would suggest you to make a new issue.