Comcast/Xfinity Data Usage Sensor

@ralfaro

Got home and gave your custom component a try. Installed thru HACS easily and Works exactly like I wanted. Took a couple of re-starts to get it going and now it is updating perfectly.

Thank you

Right on! I’ll be extending the attributes for the sensor…there are other data fields in the json received from Xfinity.

thank you robert, i’m having this problem

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’

Can you help me to solve it …

thank you

Sorry you’re having an issue. I’ll try and look into this, but first, can you provide me some more information. I’ve seen an a couple of issues opened in the github repo relating to

  • two factor authentication
  • unlimited data plan

Do either of these apply to you?

Robert, thank you for your answer, i have an unlimited plan, no two factor authentication and install it using HACS.
thanks again

Hi Nelson, I’ll be looking at this soon (regular job is demanding at the moment)… You will find updates in this issue: https://github.com/robert-alfaro/xfinity-usage/issues/3

I see you’ve found that on your own. Thanks.

Xfinity works great! Did you end up publishing the PG&E custom component?

PS: it’s great seeing other people from SF on here :sunglasses:

Thanks! I’ve got to get on publishing the PG&E component… I’ll try soon.

p.s. Bay area!

1 Like

Is there a reason this is reporting 0 now? No physical errors in the logs.

JR

Same here, reporting 0.

They are not capping data the past few months. (COVID response) If you go to the actual site you likely will see the same.

My I haven’t checked recently but my past two months were 0 all month long.

So xfinity for us says…

Our Response to Coronavirus (COVID-19): With so many of our customers working and learning from home, we want you to access the Internet without thinking about data plans. That’s why we’re providing all our Xfinity Internet customers with unlimited data at no additional charge from March 13 – June 30, 2020.

Can anyone let me know if you start reporting data usage tomorrow? I think I am going to reinstate this sensor as we had an overage at the start of covid. I think I fixed the usage issue but it would be nice to keep an eye on it.

It was showing zero but now errors in the logs:

2020-07-06 11:26:44 ERROR (SyncWorker_7) [custom_components.xfinity.sensor] Failed to fetch data, status_code:401, resp: {'error': 'unauthenticated'}

I know my credentials are correct.

Also receiving the same error

It appears that the xfinity login page has started rejecting authentication attempts by automation engines like selenium or python based session requests. Even though I am using a valid username and password, and can login from the same computer and browser into my xfinity account, xfinity returns an invalid username and password error when attempting to do the same thing via this script.

The work around I found was with another homeassistant project that uses Selenium to login and get this data. I posted an issue with a solution to fix the Selenium based approach here: jantman/xfinity-usage#30. I use that approach to get the JSON needed for homeassistant.

2 Likes

I’ve removed mine. Thinking this may not be updated anytime soon and the constant log failures are causing Comcast to force me to keep changing my password due to questionable activities on my account.

Sadly, I have had to do the same, for the same reasons.

Alain

would you be so kind and share with us your working json files for xfinity usage monitor?

is it still working on your end?

This is still working great for me. I have compressed my comcast custom config dir and pointed to the url at the end of this post that you can download. It contains a comcast.yamls file with all of the different places I changed in the hass yaml files to support this flow. You can uncompress this into your hass/config/ dir. You can look through the files and figure out what to change to make it work for you. I’ve posted it on my website since I couldn’t attach it here. You can download it from here: comcast.tar.gz

hello Alan, it is giving me this error, any idea what might be wrong?