Fetch Xfinity Internet Service Usage Data and publish it to a Home Assistant sensor. The Python code logic was originally based on zachowj/xfinity-data-usage and uses Playwright.
https://github.com/thor0215/hassio-xfinity-usage
to Home Assistant as a source for third-party addons. See the Home Assistant documentation if you have questions on how to do that. You can also use the button below.Addon Defaults: Page Timeout is 60 seconds and the script runs every 60 minutes (3600 seconds)
There is a known limitation that the sensor will be unavailable if you restart Home Assistant. This is caused by the way Home Assistant handles sensors which are not backed up by an entity, but instead come from an add-on or AppDaemon. You can easily fix that with the following blueprint:
Or use this automation directly:
alias: Restore Xfinity Internet Usage sensor on startup
description: Restore Xfinity Internet Usage sensor on startup
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: hassio.addon_restart
metadata: {}
data:
addon: 989f231b_xfinity-usage
mode: single
state: 554
policy_name: 1.2 Terabyte Data Plan
start_date: 04/01/2024
end_date: 04/30/2024
home_usage: 554
wifi_usage: 0
total_usage: 554
allowable_usage: 1229
unit_of_measure: GB
display_usage: true
devices:
- id: 44:A5:XX:XX:XX:XX
usage: 559
policyName: XI Superfast
additional_blocks_used: 0
additional_cost_per_block: 10
additional_units_per_block: 50
additional_block_size: 50
additional_included: 0
additional_used: 0
additional_percent_used: 0
additional_remaining: 0
billable_overage: 0
overage_charges: 0
overage_used: 0
current_credit_amount: 0
max_credit_amount: 0
maximum_overage_charge: 100
policy: limited
courtesy_used: 0
courtesy_remaining: 1
courtesy_allowed: 1
courtesy_months: 03/2023
in_paid_overage: false
remaining_usage: 675
friendly_name: Xfinity Usage
unit_of_measurement: GB
device_class: data_size
state_class: measurement
icon: mdi:wan
internet_download_speeds_Mbps: 800
internet_upload_speeds_Mbps: 20