Xfinity Usage Monitoring
Description
This project takes raw internet usage data from Xfinity, sourced from the hassio-xfinity-usage, and transforms it into sensors within Home Assistant. It tracks current usage, remaining data, and averages, displaying daily usage for the current month, along with a historical view of the last 12 months of data. The dashboard was inspired by this gist and further modified to suit specific needs.
Some of the key sensors this flow creates are:
- Current Usage
- Remaining Usage
- Average Usage (daily and monthly)
- Graphical representation of daily usage
- Daily usage notifications
Here's an improved version of the requirements list with some additional context for clarity:
Requirements
- Home Assistant - GitHub Repository
- Node-RED - GitHub Repository
- node-red-contrib-home-assistant-websocket - GitHub Repository
- Node-RED Companion Custom Component - GitHub Repository
Flow Overview
[{"id":"6615a5aad4b9ba51","type":"group","z":"1222406.8e2dfc","name":"Xfinity Usage","style":{"label":true},"nodes":["379b142b447e8ab7","4a33964bcdbd56d2","f85adedd5b32df85","68b863061ef4854f","d366fcc43a925970","9e55614bb42a6ef2","ab7a80d12efeaf5f","9d90f05012917222","b6ed587759967948","ee7d560c9248b5ed","08f4b8c0bfe2e999","d4897a6db2c8f634","da4171d93923d766","c6b4b9b22c1638c8","3a690e3333160edd","caf83470cf44375d","2111e9b06b258ddf","82e81d1a2fed3a97","9ae81fe6351498ae"],"x":14,"y":1095,"w":1084,"h":562},{"id":"379b142b447e8ab7","type":"function","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"hours left","func":"const now = new Date();\nconst lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);\nconst hoursLeft = (lastDay.getDate() - now.getDate()) * 24 - now.getHours();\nconst hoursPassed = (now.getDate() - 1) * 24 + now.getHours();\nconst percent = hoursPassed / (hoursPassed + hoursLeft) * 100;\n\nmsg.payload = Math.round(percent);\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":324,"y":1136,"wires":[["4a33964bcdbd56d2"]]},{"id":"4a33964bcdbd56d2","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Percent of hours passed","entityConfig":"fe831d83fa8a12c1","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"block","outputProperties":[],"x":742,"y":1136,"wires":[[]]},{"id":"f85adedd5b32df85","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Usage Percent","entityConfig":"8c7d0c6eecee9819","version":0,"state":"$round(usagePercent)","stateType":"jsonata","attributes":[],"inputOverride":"block","outputProperties":[],"x":712,"y":1232,"wires":[[]]},{"id":"68b863061ef4854f","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Today's Usage","entityConfig":"cfe3bcc794d1f2c1","version":0,"state":"todaysUsage","stateType":"msg","attributes":[],"inputOverride":"block","outputProperties":[],"x":710,"y":1472,"wires":[[]]},{"id":"d366fcc43a925970","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Current Usage","entityConfig":"71242371557e25f3","version":0,"state":"currentUsage","stateType":"msg","attributes":[],"inputOverride":"block","outputProperties":[],"x":712,"y":1184,"wires":[[]]},{"id":"9e55614bb42a6ef2","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Remaining Daily Average","entityConfig":"12a17e3c3e3d36ed","version":0,"state":"$round(averageRemaining,1)","stateType":"jsonata","attributes":[],"inputOverride":"block","outputProperties":[],"x":742,"y":1328,"wires":[[]]},{"id":"ab7a80d12efeaf5f","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Used Daily Average","entityConfig":"3d5eaa4799914c8e","version":0,"state":"$round(averageUsed,1)","stateType":"jsonata","attributes":[],"inputOverride":"block","outputProperties":[],"x":732,"y":1376,"wires":[[]]},{"id":"9d90f05012917222","type":"function","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"build sensors","func":"const usage = msg.usageMonths?.reverse();\n\nif (!usage) return;\n\nusage.forEach((month, index) => {\n // skip current month\n if (index === 0) return;\n\n const currentDate = new Date(month.startDate)\n const name = currentDate.toLocaleString(\"defualt\", { month: 'long', year: 'numeric' })\n const nodeId = `xfinity_month_usage_${index - 1}`; \n\n // in case sensor has been created yet use nodeId as the entity id\n msg.payload = { data: {\n type: \"nodered/discovery\",\n server_id: \"noderedserver\",\n node_id: nodeId,\n component: \"sensor\",\n config: {\n name: nodeId\n }\n }}; \n node.send(msg); \n \n // Update monthly usage to use friendly month name\n msg.payload = { data: {\n type: \"nodered/discovery\",\n server_id: \"noderedserver\",\n node_id: nodeId,\n component: \"sensor\",\n config: {\n name\n }\n }};\n \n node.send(msg); \n \n msg.payload = { data: {\n type: \"nodered/entity\",\n server_id: \"noderedserver\",\n node_id: nodeId,\n state: month.totalUsage,\n }};\n\n node.send(msg);\n});\n\nnode.done();","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":710,"y":1424,"wires":[["ee7d560c9248b5ed"]]},{"id":"b6ed587759967948","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Yesterday's Usage","entityConfig":"2c0a50b69a193618","version":0,"state":"yesterdaysUsage","stateType":"msg","attributes":[],"inputOverride":"block","outputProperties":[],"x":720,"y":1520,"wires":[[]]},{"id":"ee7d560c9248b5ed","type":"ha-api","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"create monthly usage sensors","server":"","version":1,"debugenabled":false,"protocol":"websocket","method":"get","path":"","data":"","dataType":"jsonata","responseType":"json","outputProperties":[],"x":942,"y":1424,"wires":[[]]},{"id":"08f4b8c0bfe2e999","type":"function","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"build message","func":"if(msg.payload === \"open\") {\n context.set(\"open\", true);\n return;\n}\nif(context.get(\"open\") !== true) return;\n\nconst today = new Date();\nconst monthlyReset = today.getDate() === 1;\nconst lastMonth = msg.usageMonths.find(e => e.startDate.split(\"/\")[0] == getPreviousMonth(today.getMonth() + 1));\nconst currentUsage = monthlyReset ? lastMonth.totalUsage : msg.currentUsage;\nconst startOfYesterday = !isNaN(msg.xfinityStartedTodayAt) ? msg.xfinityStartedTodayAt : 0;\nconst usedYesterday = currentUsage - startOfYesterday; \n\nmsg.payload = `${usedYesterday} GB used yesterday`;\nmsg.yesterdaysUsage = usedYesterday;\n\nif(monthlyReset) {\n const percent = currentUsage/lastMonth.allowableUsage * 100;\n msg.payload += `<br>Used ${currentUsage} of ${lastMonth.allowableUsage} GB (${percent.toFixed(1)}%) last month`;\n} else {\n msg.payload += ` ${msg.remainingUsage} GB remaining`;\n}\n\ncontext.set(\"open\", false);\n\nmsg.todaysUsage = 0;\nmsg.xfinityStartedTodayAt = msg.currentUsage;\n\nreturn msg;\n\nfunction getPreviousMonth(month) { \n return month === 1 ? 12 : month - 1;\n}","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":464,"y":1472,"wires":[["b6ed587759967948","c6b4b9b22c1638c8","82e81d1a2fed3a97","68b863061ef4854f"]]},{"id":"d4897a6db2c8f634","type":"function","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"transform data","func":"const todayStartedAt = msg.xfinityStartedTodayAt || 0;\nconst today = new Date();\nconst currentDay = today.getDate();\nconst daysInMonth = new Date(today.getFullYear(), today.getMonth()+1, 0).getDate();\nconst daysLeftInMonth = daysInMonth - currentDay + 1;\nconst currentMonth = msg.payload.usageMonths.find(e => e.startDate.split(\"/\")[0] == today.getMonth() + 1)\nconst allowableUsage = currentMonth.allowableUsage;\nconst currentUsage = currentMonth.totalUsage;\nconst remainingUsage = allowableUsage - currentUsage;\nconst averageUsed = currentUsage / currentDay;\nconst averageRemaining = remainingUsage / daysLeftInMonth;\nconst todaysUsage = currentUsage - todayStartedAt;\nconst usagePercent = currentUsage / allowableUsage * 100;\n\nreturn {\n usagePercent,\n currentUsage,\n allowableUsage,\n todaysUsage,\n averageUsed,\n averageRemaining,\n remainingUsage,\n usageMonths: msg.payload.usageMonths,xfinityStartedTodayAt: todayStartedAt,\n};\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":464,"y":1328,"wires":[["f85adedd5b32df85","d366fcc43a925970","9e55614bb42a6ef2","ab7a80d12efeaf5f","9d90f05012917222","2111e9b06b258ddf","68b863061ef4854f","08f4b8c0bfe2e999"]]},{"id":"da4171d93923d766","type":"mqtt in","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"","topic":"xfinity","qos":"2","datatype":"auto-detect","broker":"644903cf.1e7dbc","nl":false,"rap":true,"rh":0,"inputs":0,"x":94,"y":1328,"wires":[["9ae81fe6351498ae"]]},{"id":"c6b4b9b22c1638c8","type":"api-call-service","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"send daily notification","server":"","version":7,"debugenabled":false,"action":"notify.person","floorId":[],"areaId":[],"deviceId":[],"entityId":[],"labelId":[],"data":"{\t \"title\": \"Data Usage\",\t \"message\": payload\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"notify","service":"person","x":732,"y":1616,"wires":[[]]},{"id":"3a690e3333160edd","type":"inject","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"12 am","props":[{"p":"payload"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"open","payloadType":"str","x":268,"y":1472,"wires":[["08f4b8c0bfe2e999"]]},{"id":"caf83470cf44375d","type":"inject","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"every hour","props":[],"repeat":"","crontab":"0 0-23 * * *","once":true,"onceDelay":0.1,"topic":"","x":130,"y":1136,"wires":[["379b142b447e8ab7"]]},{"id":"2111e9b06b258ddf","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Remaining Usage","entityConfig":"edb2ab02c66aafda","version":0,"state":"remainingUsage","stateType":"msg","attributes":[],"inputOverride":"block","outputProperties":[],"x":722,"y":1280,"wires":[[]]},{"id":"82e81d1a2fed3a97","type":"ha-sensor","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"Started Today At","entityConfig":"8e9f1b420bd7ac23","version":0,"state":"xfinityStartedTodayAt","stateType":"msg","attributes":[],"inputOverride":"block","outputProperties":[],"x":722,"y":1568,"wires":[[]]},{"id":"9ae81fe6351498ae","type":"api-current-state","z":"1222406.8e2dfc","g":"6615a5aad4b9ba51","name":"startedTodayAt","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.xfinity_started_today_at","state_type":"str","blockInputOverrides":true,"outputProperties":[{"property":"xfinityStartedTodayAt","propertyType":"msg","value":"","valueType":"entityState"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":272,"y":1328,"wires":[["d4897a6db2c8f634"]]},{"id":"fe831d83fa8a12c1","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Percent of hours passed","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Percent of hours passed"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"%"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"8c7d0c6eecee9819","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Xfinity Usage","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Usage Percent"},{"property":"icon","value":"mdi:percent"},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"%"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"cfe3bcc794d1f2c1","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Xfinity Today's Usage","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Today's Usage"},{"property":"icon","value":"mdi:calendar-today"},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"GB"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"71242371557e25f3","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Xfinity Current Usage","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Current Usage"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"GB"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"12a17e3c3e3d36ed","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Xfinity Remaining Daily Average","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Average GB Remaining"},{"property":"icon","value":"mdi:chart-ppf"},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"GB/day"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"3d5eaa4799914c8e","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Used Daily Average","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Average GB Used"},{"property":"icon","value":"mdi:chart-line"},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"GB/day"},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"2c0a50b69a193618","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Xfinity Yesterday's Usage","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Yesterday's Usage"},{"property":"icon","value":"mdi:calendar-today"},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"GB"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"edb2ab02c66aafda","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Xfinity Remaining Usage","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Remaining Usage"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"GB"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"8e9f1b420bd7ac23","type":"ha-entity-config","server":"","deviceConfig":"157d6b39b3e283d5","name":"Xfinity Started Today At","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Xfinity Started Today At"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":"GB"},{"property":"state_class","value":""}],"resend":true,"debugEnabled":false},{"id":"157d6b39b3e283d5","type":"ha-device-config","name":"Xfinity Usage","hwVersion":"","manufacturer":"Node-RED","model":"","swVersion":""}]
Items to Update After Importing the Flow:
- Home Assistant Nodes: Ensure all Home Assistant nodes are configured with the correct server instance.
- MQTT Node: Select the appropriate MQTT broker for your setup.
- Notification Action Node: Update the "Send Daily Notification" node to target the correct device notifications.
These adjustments will ensure that the flow works correctly within your specific environment.
Frontend Dashboard Setup
The Home Assistant frontend is designed to give you a clear, organized overview of your internet usage. The dashboard consists of eight distinct sections:
Click to view the YAML code for the dashboard
type: custom:vertical-stack-in-card
title: Xfinity Usage
cards:
- type: custom:mini-graph-card
icon: mdi:download-network
entities:
- entity: sensor.xfinity_current_usage
name: Xfinity Data
show_graph: false
aggregate_func: last
- entity: sensor.xfinity_today_s_usage
name: Xfinity Data
show_graph: true
show_state: true
aggregate_func: last
hours_to_show: 672
group_by: date
font_size_header: 14
font_size: 100
line_width: 3
group: false
lower_bound: 0
animate: true
smoothing: false
color_thresholds:
- value: 0
color: rgba(42, 187, 155, 0.9)
- value: 30
color: var(--label-badge-yellow)
- value: 40
color: "#b93829"
show:
points: false
labels: false
labels_secondary: false
legend: false
graph: bar
icon: false
name: false
tap_action: none
- type: entities
show_header_toggle: false
entities:
- type: custom:bar-card
name: Xfinity
icon: mdi:download-network
entity: sensor.xfinity_usage_percent
entity_row: true
max: 100
unit_of_measurement: "%"
positions:
name: "off"
indicator: "off"
value: outside
height: 30px
card_mod:
style: >-
ha-card { border-width: 0 } bar-card-background { margin-right: 13px
!important; margin-top: 5px !important; }
- type: custom:bar-card
name: Month Percent
icon: mdi:calendar-arrow-right
entity: sensor.percent_of_hours_passed
entity_row: true
max: 100
positions:
name: "off"
indicator: "off"
value: outside
height: 30px
card_mod:
style: >-
ha-card { border-width: 0; width: 100%; } bar-card-background {
margin-right: 13px !important; margin-top: 5px !important; }
- name: Remaining Usage
entity: sensor.xfinity_remaining_usage
icon: mdi:chart-donut
- name: Average Used
entity: sensor.xfinity_average_gb_used
- name: Average Remaining
entity: sensor.xfinity_average_gb_remaining
- type: markdown
card_mod:
style: |
ha-card { border-width: 0; }
ha-markdown.no-header { padding: 0 !important; text-align: center; }
ha-markdown { color: var(--secondary-text-color); }
content: >-
Updated {{relative_time(states.sensor.xfinity_usage_percent.last_reported)
}} ago
- type: entities
show_header_toggle: false
entities:
- type: custom:bar-card
entity: sensor.xfinity_month_usage_0
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_1
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_2
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_3
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_4
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_5
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_6
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_7
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_8
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_9
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
- type: custom:bar-card
entity: sensor.xfinity_month_usage_10
unit_of_measurement: GB
entity_row: true
max: 1229
severity:
- from: 950
to: 1100
color: var(--label-badge-yellow)
- from: 1100
to: 1229
color: "#b93829"
positions:
icon: "off"
height: 30px
tap_action: none
card_mod:
style: "ha-card { border-width: 0 }"
Dashboard Sections:
- Top Row: Shows current monthly and daily usage.
- Second Row: A graph showing daily usage for the current month.
- Third Row: Percentage of total monthly usage consumed.
- Fourth Row: Percentage of hours passed for the current month.
- Fifth Row: Remaining usage for the current month.
- Sixth Row: Average daily usage for the month.
- Seventh Row: Remaining daily usage for the month.
- Bottom Rows: Last 11 months of usage in a historical graph.
Required Custom Components for the Dashboard
- Vertical Stack in Card: GitHub Repo
- Mini Graph Card: GitHub Repo
- Bar Card: GitHub Repo
Additional Features
You can extend this setup with the following ideas:
- Notification for Usage Threshold: Add a Switch Node and Action Node to send notifications when usage reaches a specific percentage (e.g., 90% of monthly limit).
- Monitor for Data Update: Use a Trigger Node and Action Node to alert you if the data hasn’t updated in a specified time frame (e.g., 24 hours).
- InfluxDB Integration: Use a Change Node and InfluxDB Node to store usage data in a database for long-term tracking and analysis.