robert-alfaro / xfinity-usage Goto Github PK
View Code? Open in Web Editor NEWHome Assistant custom component for retrieving Xfinity data usage
Home Assistant custom component for retrieving Xfinity data usage
I've been noticing that the sensor has been unknown for a while, probably the same issue as #8. I made sure that there isn't a security check by logging in via a browser and then enabled debug logs and restarted. It appears that the component is logging in, but then the actual data is returning a 401 Unauthenticated error code. Logs are below.
2020-06-29 08:56:25 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for xfinity which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant. 2020-06-29 08:56:42 DEBUG (SyncWorker_12) [custom_components.xfinity.sensor] Finding reqId for login... 2020-06-29 08:56:43 DEBUG (SyncWorker_12) [custom_components.xfinity.sensor] Found reqId = 5664b480-3509-48e1-884e-25ab3a225389 2020-06-29 08:56:43 DEBUG (SyncWorker_12) [custom_components.xfinity.sensor] Posting to login... 2020-06-29 08:56:44 DEBUG (SyncWorker_12) [custom_components.xfinity.sensor] Logged in successfully, status_code: 200 2020-06-29 08:56:44 DEBUG (SyncWorker_12) [custom_components.xfinity.sensor] Fetching internet usage AJAX... 2020-06-29 08:56:44 ERROR (SyncWorker_12) [custom_components.xfinity.sensor] Failed to fetch data, status_code:401, resp: {'error': 'unauthenticated'}
I tried to add this as a custom repo and the HA complained about it, for repository.json
20-09-21 18:35:41 INFO (MainThread) [supervisor.store.git] Clone add-on https://github.com/robert-alfaro/xfinity-usage repository
20-09-21 18:35:44 ERROR (MainThread) [supervisor.utils.json] Can't read json from /data/addons/git/139e2ee6/repository.json: [Errno 2] No such file or directory: '/data/addons/git/139e2ee6/repository.json'
20-09-21 18:35:44 WARNING (MainThread) [supervisor.store.data] Can't read repository information from /data/addons/git/139e2ee6/repository.json
20-09-21 18:35:44 INFO (MainThread) [supervisor.store] Load add-ons from store: 68 all - 0 new - 0 remove
20-09-21 18:35:53 INFO (MainThread) [supervisor.snapshots] Found 0 snapshot files
A few updates ago, the Xfinity Usage sensor dropped to a state of "unknown". I believe it was during the update to 0.110.1.
I removed the package via HACS, commented out the integration from my configuration.yaml and reinstalled. Still showing "unknown".
Hey Robert, thanks for this component! Is there any way to make it work with 2FA enabled? ๐ค
Logger: homeassistant.loader
Source: loader.py:794
First occurred: 3:46:11 PM (1 occurrences)
Last logged: 3:46:11 PM
No 'version' key in the manifest file for custom integration 'xfinity'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'xfinity'
It seems the sensor notation described is no longer valid.
How can I add the sensor to configuration.yaml now (after having added the custom integration)?
I was thinking it would be more useful to be able to see the relative usage percent. Let's say you are 15 days into the month with 30 days, and you have used 500 GB you would be at 100% relative usage. This way you can see where you are at and if you need to cut back on usage.
This fails to load any data for me with error below:
I suspect it is because I am on the 1gig plan (no cap)...maybe allowed_usage is not getting populated due to the unlimited....I know I might not be the main use case since I have unlimited but still would be interesting to see this in HA...
Log Details (ERROR)
Mon Dec 16 2019 09:19:47 GMT-0500 (Eastern Standard Time)
Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/xfinity/sensor.py", line 50, in
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, lambda _: _first_run())
File "/config/custom_components/xfinity/sensor.py", line 46, in _first_run
sensor.update()
File "/config/custom_components/xfinity/sensor.py", line 99, in update
self._xfinity_data.update()
File "/config/custom_components/xfinity/sensor.py", line 162, in update
self.remaining_usage = self.allowed_usage - self.total_usage
TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'
Environment
HA 103.0
component installed via HACS
running in hassio on ubuntu
I recently upgraded Home Assistant from 0.106.4 to 0.107.7 and I just noticed that my Xfinity usage in the sensor.xfinity_usage is showing zero. It was working just fine before the upgrade. I'm not sure if this was caused by the HA update though. I logged into my Xfinity account and I see that Xfinity is offering unlimited data from March 13 through May 13 for all customers, so I'm wondering if that's what could be causing it to show zero usage. On the other hand, my sensor is stuck on April 4th and not showing any other dates in the graph (this is around the day I upgraded to 0.107.7). I have the latest version of the integration installed through HACS. Has 0.107 broken this component for anyone else?
Upon login to the Xfinity web services, I now always receive the 'Secure your account' page. The two clickable options are 'Looks good' and 'Ask me later'. I have selected both options, on multiple computers, changed my password, but this page continues to be displayed. I was previously using a earlier python derivation of this component, but which recently started to fail. Since this repo is fairly recent, I attempted to use this custom component, but still no success.
Perhaps this issue is limited to just my account, but I'm providing my current issue in case others see the same failure. Below is the home assistant log for this custom component. Of course, I have triple-checked my password, even surrounded in quotes, but no success. Any suggestions would be appreciated.
2019-10-26 07:13:07 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.xfinity
2019-10-26 07:13:17 DEBUG (SyncWorker_11) [custom_components.xfinity.sensor] Finding reqId for login...
2019-10-26 07:13:18 DEBUG (SyncWorker_11) [custom_components.xfinity.sensor] Found reqId = '8f4d3f9f-586d-4ec0-b647-SOME-LONG-STRING'
2019-10-26 07:13:18 DEBUG (SyncWorker_11) [custom_components.xfinity.sensor] Posting to login...
2019-10-26 07:13:21 DEBUG (SyncWorker_11) [custom_components.xfinity.sensor] Fetching internet usage AJAX...
2019-10-26 07:13:21 DEBUG (SyncWorker_11) [custom_components.xfinity.sensor] Resp: '{"error":"unauthenticated"}'
2019-10-26 07:13:21 ERROR (SyncWorker_11) [custom_components.xfinity.sensor] Failed to fetch data, status_code:401
Not sure if this is the plugin or me? I'm getting this error when I check configuration.yaml:
Platform error sensor.xfinity - Integration 'xfinity' not found.
My YAML is valid on an online validator.
`
sensor:
Uninstalling and re-installing via HACS didn't work.
Downloading and installing manually didn't work.
I'm really at a loss here....
I'm on Home Assistant v0.99.3 and using the Xfinity Gateway integration, but I'm getting a configuration error when I add xfinity-usage to my configuration. When I remove Xfinity Gateway from my configuration.yaml the below error goes await.
Installed with: HACS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.