774 lines
25 KiB
YAML
774 lines
25 KiB
YAML
---
|
|
|
|
homeassistant:
|
|
customize:
|
|
package.node_anchors:
|
|
package_name: &package_name "internet_online"
|
|
common_attrs: &common_attrs
|
|
package: *package_name
|
|
common_attrs_templated: &common_attrs_templated
|
|
templated: true
|
|
<<: *common_attrs
|
|
|
|
binary_sensor.ping_internet_online_cloudflare_1:
|
|
friendly_name: "Cloudflare 1.1.1.1"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_internet_online_cloudflare_2:
|
|
friendly_name: "Cloudflare: 1.0.0.1"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_internet_online_google_1:
|
|
friendly_name: "Google: 8.8.8.8"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_internet_online_google_2:
|
|
friendly_name: "Google: 8.8.4.4"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_internet_online_hi_1:
|
|
friendly_name: "Haskoli Islands: hi.is"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_s21_dns:
|
|
friendly_name: "S21 main DNS server"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_vpn_ber1:
|
|
friendly_name: "ping to ber1"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_vpn_ls54_edge:
|
|
friendly_name: "ping to ls54 edge router"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_turris_wwan_lte_gateway:
|
|
friendly_name: "Ping to WWAN_LTE gateway (Alcatel)"
|
|
<<: *common_attrs
|
|
binary_sensor.ping_turris_wwan_lte_interface:
|
|
friendly_name: "Ping to WWAN_LTE interface br-wwan-lte"
|
|
<<: *common_attrs
|
|
|
|
|
|
binary_sensor.internet_online:
|
|
friendly_name: "Internet connection is up"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.internet_offline:
|
|
friendly_name: "Internet connection"
|
|
<<: *common_attrs_templated
|
|
|
|
## VPN, Online
|
|
binary_sensor.vpn_sudo_is_online:
|
|
friendly_name: "sudo.is vpn"
|
|
entity_picture: "https://www.sudo.is/img/wireguard.png"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.vpn_sudo_is_ls54_online:
|
|
friendly_name: "sudo.is vpn to LS54"
|
|
entity_picture: "https://www.sudo.is/img/wireguard.png"
|
|
<<: *common_attrs_templated
|
|
|
|
## VPN, Offline
|
|
binary_sensor.vpn_sudo_is_offline:
|
|
friendly_name: "sudo.is vpn"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.vpn_sudo_is_ber1_offline:
|
|
friendly_name: "sudo.is vpn connection with ber1"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.vpn_sudo_is_ls54_edge_offline:
|
|
friendly_name: "sudo.is vpn connection to LS54 edge router"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.vpn_sudo_is_ls54_offline:
|
|
friendly_name: "sudo.is vpn to LS54"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.vpn_sudo_is_rvk0_offline:
|
|
friendly_name: "sudo.is vpn to rvk0"
|
|
comment: "not part of binary_sensor.vpn_sudo_is"
|
|
<<: *common_attrs_templated
|
|
|
|
|
|
binary_sensor.internet_failover_mwan3_wwan_lte_up:
|
|
friendly_name: "WWAN_LTE interface br-wwan-lte state"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.internet_failover_mwan3_wwan_lte_down:
|
|
friendly_name: "WWAN_LTE interface br-wwan-lte DOWN"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.internet_failover_mwan3_wwan_lte_active:
|
|
friendly_name: "WWAN_LTE mwan3 failover active"
|
|
<<: *common_attrs_templated
|
|
binary_sensor.cloudflare_ddns_home0157_sudo_is:
|
|
friendly_name: "home0157.sudo.is is up to date"
|
|
source_entity_ids:
|
|
- "sensor.dns_whoami_akamai_net"
|
|
- "sensor.sudo_is_api_myip"
|
|
<<: *common_attrs_templated
|
|
|
|
sensor.download_avg:
|
|
friendly_name: "Internet download (averge)"
|
|
sources: "speedtest.net, fast.com"
|
|
source_ids:
|
|
- "sensor.fast_com_download"
|
|
- "sensor.speedtest_download"
|
|
<<: *common_attrs_templated
|
|
|
|
# WAN
|
|
sensor.edge_wan_in:
|
|
friendly_name: "Edge router WAN in"
|
|
device: eth2.7
|
|
interface: WAN
|
|
<<: *common_attrs_templated
|
|
sensor.edge_wan_out:
|
|
friendly_name: "Edge router WAN out"
|
|
device: eth2.7
|
|
interface: WAN
|
|
<<: *common_attrs_templated
|
|
# WWAN_LTE
|
|
sensor.edge_wwan_lte_in:
|
|
friendly_name: "Edge router WWAN_LTE in"
|
|
device: br-wwan-lte
|
|
interface: WWAN_LTE
|
|
<<: *common_attrs_templated
|
|
sensor.edge_wwan_lte_out:
|
|
friendly_name: "Edge router WWAN_LTE out"
|
|
device: br-wwan-lte
|
|
interface: WWAN_LTE
|
|
<<: *common_attrs_templated
|
|
# wg0
|
|
sensor.edge_wg0_in:
|
|
friendly_name: "Edge router wg0 in"
|
|
entity_picture: "https://www.sudo.is/img/wireguard.png"
|
|
device: wg0
|
|
interface: WG0
|
|
<<: *common_attrs_templated
|
|
sensor.edge_wg0_out:
|
|
friendly_name: "Edge router wg0 out"
|
|
entity_picture: "https://www.sudo.is/img/wireguard.png"
|
|
device: wg0
|
|
interface: WG0
|
|
<<: *common_attrs_templated
|
|
sensor.edge_wg0_combined:
|
|
friendly_name: "Edge router wg0 (combined)"
|
|
entity_picture: "https://www.sudo.is/img/wireguard.png"
|
|
device: wg0
|
|
interface: WG0
|
|
<<: *common_attrs_templated
|
|
# LAN
|
|
sensor.edge_lan_in:
|
|
friendly_name: "Edge router LAN in"
|
|
device: br-lan
|
|
interface: LAN
|
|
<<: *common_attrs_templated
|
|
sensor.edge_lan_out:
|
|
friendly_name: "Edge router LAN out"
|
|
device: br-lan
|
|
interface: LAN
|
|
<<: *common_attrs_templated
|
|
sensor.edge_lan_combined:
|
|
friendly_name: "Edge router LAN (combined)"
|
|
device: br-lan
|
|
interface: LAN
|
|
<<: *common_attrs_templated
|
|
# LAN_CARE
|
|
sensor.edge_lan_care_in:
|
|
friendly_name: "Edge router LAN_CARE in"
|
|
device: br-lan-care
|
|
interface: LAN_CARE
|
|
<<: *common_attrs_templated
|
|
sensor.edge_lan_care_out:
|
|
friendly_name: "Edge router LAN_CARE out"
|
|
device: br-lan-care
|
|
interface: LAN_CARE
|
|
<<: *common_attrs_templated
|
|
sensor.edge_lan_care_combined:
|
|
friendly_name: "Edge router LAN_CARE (combined)"
|
|
device: br-lan-care
|
|
interface: LAN_CARE
|
|
<<: *common_attrs_templated
|
|
# NVR
|
|
sensor.edge_nvr_in:
|
|
friendly_name: "Edge router NVR in"
|
|
device: br-nvr
|
|
interface: NVR
|
|
<<: *common_attrs_templated
|
|
sensor.edge_nvr_out:
|
|
friendly_name: "Edge router NVR out"
|
|
device: br-nvr
|
|
interface: NVR
|
|
<<: *common_attrs_templated
|
|
sensor.edge_nvr_combined:
|
|
friendly_name: "Edge router NVR (combined)"
|
|
device: br-nvr
|
|
interface: NVR
|
|
<<: *common_attrs_templated
|
|
|
|
# CPU
|
|
sensor.edge_cpu:
|
|
friendly_name: "Edge router CPU"
|
|
<<: *common_attrs_templated
|
|
|
|
sensor:
|
|
- platform: netdata
|
|
host: !secret s21_router_hostname
|
|
resources:
|
|
# WAN / eth2.7
|
|
# It's better to refer to eth2 (without the VLAN id) because if the interface is
|
|
# down, the vlan eth2.7 interface does not exist in netdata.
|
|
turris_wan_in:
|
|
data_group: "net.eth2"
|
|
element: "received"
|
|
icon: "mdi:download-network-outline"
|
|
turris_wan_out:
|
|
data_group: "net.eth2"
|
|
element: "sent"
|
|
icon: "mdi:upload-network-outline"
|
|
|
|
# WWAN_LTE / br-wwan-lte
|
|
turris_wwan_lte_in:
|
|
data_group: "net.br-wwan-lte"
|
|
element: "received"
|
|
icon: "mdi:download-network-outline"
|
|
turris_wwan_lte_out:
|
|
data_group: "net.br-wwan-lte"
|
|
element: "sent"
|
|
icon: "mdi:upload-network-outline"
|
|
|
|
# WG0 / wg0
|
|
turris_wg0_in:
|
|
data_group: "net.wg0"
|
|
element: "received"
|
|
icon: "mdi:download-network-outline"
|
|
turris_wg0_out:
|
|
data_group: "net.wg0"
|
|
element: "sent"
|
|
icon: "mdi:upload-network-outline"
|
|
|
|
# LAN / br-lan
|
|
turris_br_lan_in:
|
|
data_group: "net.br-lan"
|
|
element: "received"
|
|
icon: "mdi:download-network-outline"
|
|
turris_br_lan_out:
|
|
data_group: "net.br-lan"
|
|
element: "sent"
|
|
icon: "mdi:upload-network-outline"
|
|
|
|
# LAN_CARE / br-lan-care
|
|
turris_br_lan_care_in:
|
|
data_group: "net.br-lan-care"
|
|
element: "received"
|
|
icon: "mdi:download-network-outline"
|
|
turris_br_lan_care_out:
|
|
data_group: "net.br-lan-care"
|
|
element: "sent"
|
|
icon: "mdi:upload-network-outline"
|
|
|
|
# NVR / br-nvr
|
|
turris_br_nvr_in:
|
|
data_group: "net.br-nvr"
|
|
element: "received"
|
|
icon: "mdi:download-network-outline"
|
|
turris_br_nvr_out:
|
|
data_group: "net.br-nvr"
|
|
element: "sent"
|
|
icon: "mdi:upload-network-outline"
|
|
|
|
# CPU
|
|
turris_cpu_softirq:
|
|
data_group: "system.cpu"
|
|
element: "softirq"
|
|
turris_cpu_user:
|
|
data_group: "system.cpu"
|
|
element: "user"
|
|
turris_cpu_system:
|
|
data_group: "system.cpu"
|
|
element: "system"
|
|
turris_cpu_nice:
|
|
data_group: "system.cpu"
|
|
element: "nice"
|
|
turris_cpu_iowait:
|
|
data_group: "system.cpu"
|
|
element: "iowait"
|
|
|
|
template:
|
|
- sensor:
|
|
- name: download_avg
|
|
icon: "mdi:download-network"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
# with a dict:
|
|
# this.attributes.get("source_ids", {}).items() | map("last") | select("has_value") | list | length > 0
|
|
availability: |
|
|
{{
|
|
this.attributes.get('source_ids')
|
|
| select("has_value")
|
|
| map("states")
|
|
| select("is_number")
|
|
| list
|
|
| length > 0
|
|
}}
|
|
state: |
|
|
{% set fast_com = this.attributes.get("fast_com") | float(0.0) -%}
|
|
{% set speedtest = this.attributes.get("speedtest") | float(0.0) -%}
|
|
{% set down = [fast_com, speedtest] | select(">", 0.0) | list -%}
|
|
{% set down_avg = down|sum / max(down|length, 1) -%}
|
|
{{ down_avg | float | round(0) }}
|
|
attributes:
|
|
fast_com: |
|
|
{{ states("sensor.fast_com_download") }}
|
|
speedtest: |
|
|
{{ states("sensor.speedtest_download") }}
|
|
|
|
|
|
# WAN
|
|
- name: edge_wan_in
|
|
icon: "mdi:download-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_wan_in") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_wan_in") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|round(2) }}
|
|
- name: edge_wan_out
|
|
icon: "mdi:upload-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_wan_out") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_wan_out") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|abs|round(2) }}
|
|
|
|
# WWAN_LTE
|
|
- name: edge_wwan_lte_in
|
|
icon: "mdi:download-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_wwan_lte_in") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_wwan_lte_in") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|round(2) }}
|
|
- name: edge_wwan_lte_out
|
|
icon: "mdi:upload-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_wwan_lte_out") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_wwan_lte_out") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|abs|round(2) }}
|
|
|
|
# wg0
|
|
- name: edge_wg0_in
|
|
icon: "mdi:download-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_wg0_in") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_wg0_in") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|round(2) }}
|
|
- name: edge_wg0_out
|
|
icon: "mdi:upload-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_wg0_out") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_wg0_out") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|abs|round(2) }}
|
|
- name: edge_wg0_combined
|
|
icon: "mdi:network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{
|
|
states("sensor.edge_wg0_in") | is_number
|
|
and states("sensor.edge_wg0_out") | is_number
|
|
}}
|
|
state: |
|
|
{% set in = states("sensor.edge_wg0_in") %}
|
|
{% set out = states("sensor.edge_wg0_out") %}
|
|
{% set total = in|float + out|float %}
|
|
{{ total|float(0.0)|round(2) }}
|
|
|
|
# LAN
|
|
- name: edge_lan_in
|
|
icon: "mdi:download-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_br_lan_in") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_br_lan_in") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|round(2) }}
|
|
- name: edge_lan_out
|
|
icon: "mdi:upload-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_br_lan_out") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_br_lan_out") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|abs|round(2) }}
|
|
- name: edge_lan_combined
|
|
icon: "mdi:network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{
|
|
states("sensor.edge_lan_in") | is_number
|
|
and states("sensor.edge_lan_out") | is_number
|
|
}}
|
|
state: |
|
|
{% set in = states("sensor.edge_lan_in") %}
|
|
{% set out = states("sensor.edge_lan_out") %}
|
|
{% set total = in|float + out|float %}
|
|
{{ total|float(0.0)|round(2) }}
|
|
|
|
# LAN_CARE
|
|
- name: edge_lan_care_in
|
|
icon: "mdi:download-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_br_lan_care_in") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_br_lan_care_in") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|round(2) }}
|
|
- name: edge_lan_care_out
|
|
icon: "mdi:upload-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_br_lan_care_out") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_br_lan_care_out") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|abs|round(2) }}
|
|
- name: edge_lan_care_combined
|
|
icon: "mdi:network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{
|
|
states("sensor.edge_lan_care_in") | is_number
|
|
and states("sensor.edge_lan_care_out") | is_number
|
|
}}
|
|
state: |
|
|
{% set in = states("sensor.edge_lan_care_in") %}
|
|
{% set out = states("sensor.edge_lan_care_out") %}
|
|
{% set total = in|float + out|float %}
|
|
{{ total|float(0.0)|round(2) }}
|
|
|
|
# NVR
|
|
- name: edge_nvr_in
|
|
icon: "mdi:download-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_br_nvr_in") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_br_nvr_in") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|round(2) }}
|
|
- name: edge_nvr_out
|
|
icon: "mdi:upload-network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{ states("sensor.netdata_turris_br_nvr_out") | is_number }}
|
|
state: |
|
|
{% set kbits = states("sensor.netdata_turris_br_nvr_out") %}
|
|
{% set mbits = kbits|float / 1000 %}
|
|
{{ mbits|abs|round(2) }}
|
|
- name: edge_nvr_combined
|
|
icon: "mdi:network-outline"
|
|
unit_of_measurement: "Mbit/s"
|
|
state_class: measurement
|
|
device_class: data_rate
|
|
availability: |
|
|
{{
|
|
states("sensor.edge_nvr_in") | is_number
|
|
and states("sensor.edge_nvr_out") | is_number
|
|
}}
|
|
state: |
|
|
{% set in = states("sensor.edge_nvr_in") %}
|
|
{% set out = states("sensor.edge_nvr_out") %}
|
|
{% set total = in|float + out|float %}
|
|
{{ total|float(0.0)|round(2) }}
|
|
|
|
# CPU
|
|
- name: edge_cpu
|
|
icon: "mdi:router-network"
|
|
unit_of_measurement: "%"
|
|
state_class: measurement
|
|
device_class: "power_factor"
|
|
availability: |
|
|
{{
|
|
is_number(states("sensor.netdata_turris_cpu_softirq"))
|
|
and is_number(states("sensor.netdata_turris_cpu_user"))
|
|
and is_number(states("sensor.netdata_turris_cpu_system"))
|
|
and is_number(states("sensor.netdata_turris_cpu_nice"))
|
|
and is_number(states("sensor.netdata_turris_cpu_iowait"))
|
|
}}
|
|
state: |
|
|
{% set softirq = states("sensor.netdata_turris_cpu_softirq") %}
|
|
{% set user = states("sensor.netdata_turris_cpu_user") %}
|
|
{% set system = states("sensor.netdata_turris_cpu_system") %}
|
|
{% set nice = states("sensor.netdata_turris_cpu_nice") %}
|
|
{% set iowait = states("sensor.netdata_turris_cpu_iowait") %}
|
|
{% set cpu = [softirq|float, user|float, system|float, nice|float, iowait|float] %}
|
|
{{ cpu | sum | float(0.0) | round(2) }}
|
|
|
|
- binary_sensor:
|
|
- name: internet_online
|
|
device_class: "connectivity"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:check-network
|
|
{% else %}
|
|
mdi:close-network
|
|
{% endif %}
|
|
state: |
|
|
{{ not is_state("binary_sensor.internet_offline", "on") }}
|
|
attributes:
|
|
comment: |
|
|
Is false if >4 'binary_sensor.ping_internet_online_*' are "off"
|
|
source_entity_id: binary_sensor.internet_offline
|
|
active_uplink: |
|
|
{% if is_state("binary_sensor.internet_failover_mwan3_wwan_lte_active", "on") %}
|
|
WWAN_LTE
|
|
{% else %}
|
|
WAN
|
|
{% endif %}
|
|
vpn: |
|
|
{{ not is_state("binary_sensor.vpn_sudo_is_online", "off") }}
|
|
LS54: |
|
|
{{ not is_state("binary_sensor.vpn_sudo_is_ls54_online", "off") }}
|
|
wwan_lte_failover_connection_up: |
|
|
{{ not is_state("binary_sensor.internet_failover_mwan3_wwan_lte_down", "on") }}
|
|
|
|
- name: internet_offline
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:close-network
|
|
{% else %}
|
|
mdi:check-network
|
|
{% endif %}
|
|
state: |
|
|
{% set ping_unreachable = [
|
|
is_state("binary_sensor.ping_internet_online_cloudflare_1", "off"),
|
|
is_state("binary_sensor.ping_internet_online_cloudflare_2", "off"),
|
|
is_state("binary_sensor.ping_internet_online_google_1", "off"),
|
|
is_state("binary_sensor.ping_internet_online_google_2", "off"),
|
|
is_state("binary_sensor.ping_internet_online_hi_1", "off"),
|
|
is_state("binary_sensor.ping_internet_online_en_wikipedia_org", "off"),
|
|
is_state("binary_sensor.ping_internet_online_github_com", "off"),
|
|
is_state("binary_sensor.ping_internet_online_home_assistant_io", "off"),
|
|
is_state("binary_sensor.ping_internet_online_rc_home_assistant_io", "off"),
|
|
is_state("binary_sensor.ping_internet_online_debian_org", "off")
|
|
]
|
|
%}
|
|
{{
|
|
ping_unreachable
|
|
| select("==", true)
|
|
| list
|
|
| length > 4
|
|
}}
|
|
|
|
- name: vpn_sudo_is_offline
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:close-network
|
|
{% else %}
|
|
mdi:check-network
|
|
{% endif %}
|
|
state: |
|
|
{{
|
|
is_state("binary_sensor.ping_vpn_turris", "off")
|
|
and is_state("binary_sensor.ping_vpn_ber1", "off")
|
|
and is_state("binary_sensor.ping_vpn_ls54_edge", "off")
|
|
and is_state("binary_sensor.ping_vpn_mainframe", "off")
|
|
and is_state("binary_sensor.ping_vpn_edge", "off")
|
|
}}
|
|
|
|
- name: vpn_sudo_is_online
|
|
device_class: "connectivity"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:check-network
|
|
{% else %}
|
|
mdi:close-network
|
|
{% endif %}
|
|
state: |
|
|
{{ not is_state("binary_sensor.vpn_sudo_is_offline", "on") }}
|
|
|
|
- name: vpn_sudo_is_ber1_offline
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:close-network
|
|
{% else %}
|
|
mdi:check-network
|
|
{% endif %}
|
|
state: |
|
|
{{ is_state("binary_sensor.ping_vpn_ber1", "off") }}
|
|
|
|
- name: vpn_sudo_is_rvk0_offline
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:close-network
|
|
{% else %}
|
|
mdi:check-network
|
|
{% endif %}
|
|
state: |
|
|
{{ is_state("binary_sensor.ping_vpn_rvk0", "off") }}
|
|
|
|
- name: vpn_sudo_is_ls54_edge_offline
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:close-network
|
|
{% else %}
|
|
mdi:check-network
|
|
{% endif %}
|
|
state: |
|
|
{{ is_state("binary_sensor.ping_vpn_ls54_edge", "off") }}
|
|
|
|
# binary_sensor.pihole_ls_54_sudo_is_status turns 'unavailable' when
|
|
# disconnected.
|
|
# and is_state("binary_sensor.pihole_ls54_sudo_is_status", "on")
|
|
- name: vpn_sudo_is_ls54_online
|
|
device_class: "connectivity"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:check-network
|
|
{% else %}
|
|
mdi:close-network
|
|
{% endif %}
|
|
state: |
|
|
{{
|
|
not is_state("binary_sensor.vpn_sudo_is_ls54_edge_offline", "on")
|
|
and not is_state("binary_sensor.vpn_sudo_is_ber1_offline", "on")
|
|
and not is_state("device_tracker.unifi_lychener_str", "away")
|
|
}}
|
|
- name: vpn_sudo_is_ls54_offline
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:close-network
|
|
{% else %}
|
|
mdi:check-network
|
|
{% endif %}
|
|
state: |
|
|
{{ is_state("binary_sensor.vpn_sudo_is_ls54_online", "off") }}
|
|
|
|
- name: internet_failover_mwan3_wwan_lte_down
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:close-network
|
|
{% else %}
|
|
mdi:check-network
|
|
{% endif %}
|
|
state: |
|
|
{{ is_state("binary_sensor.ping_turris_wwan_lte_gateway", "off") }}
|
|
|
|
- name: internet_failover_mwan3_wwan_lte_active
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:alert-box-outline
|
|
{% else %}
|
|
mdi:network-outline
|
|
{% endif %}
|
|
state: |
|
|
{{
|
|
this.attributes.get("sudo_is_check_failed", False)
|
|
or this.attributes.get("akamai_check_failed", False)
|
|
or states("sensor.edge_wwan_lte_in")|float(0.0) > states("sensor.edge_wan_in")|float(0.0)
|
|
}}
|
|
attributes:
|
|
akamai_check_failed: |
|
|
{{ is_state("binary_sensor.internet_failover_akamai_check", "on") }}
|
|
sudo_is_check_failed: |
|
|
{{ is_state("binary_sensor.sudo_is_api_myip_check", "on") }}
|
|
|
|
|
|
# meant to be updated through restapi or appdaemon
|
|
# but this is something for starters
|
|
- name: internet_failover_akamai_check
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:alert-box-outline
|
|
{% else %}
|
|
mdi:network-outline
|
|
{% endif %}
|
|
availability: |
|
|
{{ has_value("sensor.dns_whoami_akamai_net") }}
|
|
state: |
|
|
{% set akamai_myip = states("sensor.dns_whoami_akamai_net") %}
|
|
{% set akamai_check = not (
|
|
akamai_myip.startswith("79.")
|
|
or akamai_myip.startswith("217.19")
|
|
or akamai_myip.startswith("217.2")
|
|
)
|
|
and (
|
|
akamai_myip.startswith("46.")
|
|
or akamai_myip.startswith("176.")
|
|
|
|
)
|
|
%}
|
|
{{ akamai_check }}
|
|
|
|
- name: cloudflare_ddns_home0157_sudo_is
|
|
device_class: "problem"
|
|
icon: |
|
|
{% if is_state(this.entity_id, "on") %}
|
|
mdi:web-off
|
|
{% else %}
|
|
mdi:web
|
|
{% endif %}
|
|
state: |
|
|
{% set home0157 = states("sensor.dns_home0157_sudo_is") -%}
|
|
{{
|
|
this.attributes.source_entity_ids
|
|
| select("has_value")
|
|
| map("states")
|
|
| select("eq", home0157)
|
|
| list
|
|
| length != this.attributes.source_entity_ids|length
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|