This is a combination of two repos:
https://github.com/jantman/xfinity-usage
https://github.com/billimek/comcastUsage-for-influxdb
This includes a modified xfinity-usage python module. Refer to the following: jantman/xfinity-usage#30 billimek#1
xfinity-usage was modified: -to resolve the above state issues -control request attempt looping. -work under Python3
Status: As of today (2021.01.31), this container is working accurately to scrap xfinity account data. I only perform the data request action 2 times per day, since I presume (based on other user's reports) that xFinity will block your username if you request too often. Use at your own discretion !!!!
Sample output is located in the '/data' folder.
This tool allows you to run periodic data usage checks and save the results to file and/or Influxdb
ToDo:
- Remove extraneous libraries from previous scrap attempts (phantom-js)
- Move to small linux base (previous attempts on debian produced no network connects)
This code is adopted from the work done by barrycarey in the similar thing for capturing speedtest data as well as jantman's xfinity-usage python example
Key | Description |
---|---|
Interval | Interval is seconds between each scraping scheduled task |
Iterations | Iterations is the count of scrap tasks performed before exit; set to zero for indefinite |
Attempts | Attempts is the number of web requests errors before failure |
Verbose | Verbose produces debug log and screenprints to '/data' |
Key | Description |
---|---|
Username | Comcast username (don't include the @comcast.com) |
Password | Password for above user |
Key | Description |
---|---|
Enabled | Set to True to activate |
Key | Description |
---|---|
Enabled | Set to True to activate |
Filename | JSON output is written to to '/data'. default = output.json |
Key | Description |
---|---|
Enabled | Set to True to activate |
Address | IP address of InfluxDB |
Port | InfluxDB port to connect to. 8086 in most cases |
Database | Database to write collected stats to |
Username | User that has access to the database |
Password | Password for above user |
'measurement': 'comcast_data_usage',
'fields': {
'used',
'total',
'unit'
}
See this example json for a singlestat panel as shown in the screenshot above
Docker Currently running on Debian Linux x86, will likely continue further testing on Raspbian for arm32/64 arch
-
Install Docker
-
Clone repo to 'any local folder'
-
Alter config.ini as desired Example:
[XFINITY]
Username = annoying_customer
Password = supersecretpassword
- Build the container
cd <local folder>
docker build -t xfinity .
- Run the container, pointing to the config file, and an output folder (optional,recommended)
docker run \
--name="xfinity" \
-v /some/path/config.ini:/app/config.ini \
-v /some/path/data:/app/data \
xfinity