Actually I didn’t have to parse any of the data myself. The docker container has an option for Home Assistant and auto discovery. It played nicely with the MQTT integration so when I setup the container, it created “Xfinity Usage” sensor automatically.
When I look at the MQTT Topic, there are 3 sub topics
I finally got around to revisiting this. I was looking at the wrong logs. The docker app is not scraping the data at all. The issue I’m seeing in the logs is that I need to use a headless version of chrome or Firefox. I’ve done some digging and tried installing a headless version of chrome but I’m still getting the error in the logs. Here are my relevant logs:
Loading Configuration File config.ini
Configuration Successfully Loaded
/usr/local/lib/python3.6/site-packages/selenium/webdriver/phantomjs/webdriver.py:49: UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead
warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ’
[2021-02-23 03:53:10,191 ERROR] Screenshot saved to: /src/webdriver_fail.png
[2021-02-23 03:53:10,193 ERROR] Page title: Sign in to Xfinity
[2021-02-23 03:53:10,201 ERROR] Page source saved to: /src/webdriver_fail.html
[2021-02-23 03:53:10,201 WARNING] Exception while logging in
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py”, line 233, in get_usage_page
self.do_login()
File “/usr/local/lib/python3.6/site-packages/xfinity_usage/xfinity_usage.py”, line 207, in do_login
raise RuntimeError(“Login button clicked but no redirect”)
RuntimeError: Login button clicked but no redirect