You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
2.4 KiB
54 lines
2.4 KiB
######################################################################
|
|
# @CCOSTAN - Follow Me on X
|
|
# For more info visit https://www.vcloudinfo.com/click-here
|
|
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
|
|
# -------------------------------------------------------------------
|
|
# Speedtest Alerts - Log sustained WAN degradation, outages, and recovery
|
|
# Related Issue: 1550
|
|
# Uses the normalized WAN health sensors plus `script.send_to_logbook`.
|
|
# -------------------------------------------------------------------
|
|
# Notes: Brief Speedtest transitions do not create Activity entries; outages are immediate and performance degradation requires 6 continuous hours.
|
|
######################################################################
|
|
|
|
automation:
|
|
- alias: "Internet WAN Degraded (Logbook)"
|
|
id: notify-carlo-slow-internet-speed
|
|
description: "Logs an Activity entry for an immediate outage or sustained WAN degradation."
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.infra_wan_quality_degraded
|
|
from: 'off'
|
|
to: 'on'
|
|
action:
|
|
- service: script.send_to_logbook
|
|
data:
|
|
topic: "NETWORK"
|
|
message: >-
|
|
{% set outage = is_state('binary_sensor.infra_wan_outage', 'on') %}
|
|
Download: {{ states('sensor.speedtest_download') }} Mbps,
|
|
upload: {{ states('sensor.speedtest_upload') }} Mbps,
|
|
latency: {{ states('sensor.infra_wan_latency_ms') }} ms,
|
|
packet loss: {{ states('sensor.infra_wan_packet_loss') }}%.
|
|
{{ 'Immediate WAN outage detected.' if outage else 'WAN performance remained degraded for 6 hours.' }}
|
|
mode: single
|
|
|
|
- alias: "Internet WAN Restored (Logbook)"
|
|
id: notify-carlo-internet-speed-restored
|
|
description: "Logs an Activity entry when the normalized WAN alert clears."
|
|
trigger:
|
|
- platform: state
|
|
entity_id: binary_sensor.infra_wan_quality_degraded
|
|
from: 'on'
|
|
to: 'off'
|
|
action:
|
|
- service: script.send_to_logbook
|
|
data:
|
|
topic: "NETWORK"
|
|
message: >-
|
|
Download: {{ states('sensor.speedtest_download') }} Mbps,
|
|
Upload: {{ states('sensor.speedtest_upload') }} Mbps,
|
|
latency: {{ states('sensor.infra_wan_latency_ms') }} ms,
|
|
packet loss: {{ states('sensor.infra_wan_packet_loss') }}%.
|
|
WAN alert cleared.
|
|
mode: single
|