Closed jussihi closed 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...
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.
Thank you for contributing. I've added some comments. Feel free to reply if anything is unclear or you have other/better ideas!
You can use tox
to run flake8
/pylint
/pydocstyle
.
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.
Just some minor things. Other than that it looks ok.
@mzdrale If this is resolved, can you release a new version?
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.
Hey @jussihi , please take a look at Steven's comments above. I'm waiting for you to resolve them before releasing a new version.
@jussihi if you want, you can update Home Assistant Ubee component and create PR.
@mzdrale I'm unfamiliar with that process, so you can do it. Thanks.
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
.
Time to move over to nmap device tracker :-)
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.
@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 :)
Absolutely, OpenWRT and DDWRT can do that. It's exactly what I'm doing with my IoT devices.
@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.
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:
DigestAuthAuthenticator
which does proper Digest HTTP auth for the modem I'm using. Old authenticators were not able to auth with my modem.JSONList
boolean param to theMODELS
dict. Theget_connected_devices_lan
method uses this later on when parsing the devices in the JSON list._get
and other parts, see the commit diff...@mzdrale please merge and bump version so that I can enjoy this from upstream in my HomeAssistant! Cheers!