Files
zorruno-homeassistant/packages/internet_traffic.yaml
T
2026-07-24 18:55:12 +12:00

56 lines
2.2 KiB
YAML

#:########################################################################################:#
# Package: Internet Traffic Summary
# File: internet_traffic.yaml
# Version: v1.2.0
# Date: 2026-07-22
#
# Purpose:
# Preserves the household Internet download, upload, and total traffic sensors
# while sourcing current WAN rates from the EdgeRouter SNMP package.
#
# Behaviour:
# - Mirrors the EdgeRouter WAN download and upload rates in kB/s.
# - Calculates total traffic as the sum of download and upload rates.
# - Marks each sensor unavailable when its required source is unavailable.
#
# Dependency:
# - packages/edgerouter_snmp.yaml
#
# Version History:
# - v1.2.0 (2026-07-22): Migrated source data from EdgeOS attributes to the
# EdgeRouter SNMP WAN rate sensors and added availability handling.
# - v1.1.0 (2025-12-21): Migrated the three sensors to modern template syntax.
# - v1.0.0 (2022-10-12): Added the initial EdgeOS-based traffic sensors.
#:########################################################################################:#
template:
- sensor:
- name: "Internet Download Traffic"
unique_id: internet_downtraffic
unit_of_measurement: "kB/s"
state_class: measurement
availability: "{{ has_value('sensor.edgerouter_wan_download_rate') }}"
state: "{{ states('sensor.edgerouter_wan_download_rate') | float(0) }}"
- name: "Internet Upload Traffic"
unique_id: internet_uptraffic
unit_of_measurement: "kB/s"
state_class: measurement
availability: "{{ has_value('sensor.edgerouter_wan_upload_rate') }}"
state: "{{ states('sensor.edgerouter_wan_upload_rate') | float(0) }}"
- name: "Internet Total Traffic"
unique_id: internet_totaltraffic
unit_of_measurement: "kB/s"
state_class: measurement
availability: >-
{{
has_value('sensor.edgerouter_wan_download_rate')
and has_value('sensor.edgerouter_wan_upload_rate')
}}
state: >-
{{
(states('sensor.edgerouter_wan_download_rate') | float(0))
+ (states('sensor.edgerouter_wan_upload_rate') | float(0))
}}