Add binary_sensors.yaml with note to add Server 243 via UI
This commit is contained in:
260
binary_sensors.yaml
Normal file
260
binary_sensors.yaml
Normal file
@@ -0,0 +1,260 @@
|
||||
# ========== NETWORK MONITORING BINARY SENSORS - FIXED ==========
|
||||
# The ping platform has been removed - must be configured via UI
|
||||
# Instructions:
|
||||
# 1. Go to Settings → Devices & Services → Add Integration
|
||||
# 2. Search for "Ping (ICMP)"
|
||||
# 3. Add three integrations with these settings:
|
||||
# - Router: IP 10.0.0.254, Name "Ping Router"
|
||||
# - Google DNS: IP 8.8.8.8, Name "Ping Google"
|
||||
# - Cloudflare DNS: IP 1.1.1.1, Name "Ping Cloudflare"
|
||||
# - Server 243: IP 10.0.0.243, Name "Server 243 Status"
|
||||
|
||||
# ========== TEMPLATE BINARY SENSORS ==========
|
||||
- platform: template
|
||||
sensors:
|
||||
router_authenticated:
|
||||
friendly_name: "Router Authenticated"
|
||||
value_template: >
|
||||
{{ states('input_text.router_token') not in ['unknown', '', 'unavailable', ''] }}
|
||||
icon_template: >
|
||||
{% if states('input_text.router_token') not in ['unknown', '', 'unavailable', ''] %}
|
||||
mdi:check-circle
|
||||
{% else %}
|
||||
mdi:close-circle
|
||||
{% endif %}
|
||||
|
||||
internet_connectivity:
|
||||
friendly_name: "Internet Connectivity"
|
||||
value_template: >
|
||||
{{ states('binary_sensor.ping_google') == 'on' or states('binary_sensor.ping_cloudflare') == 'on' }}
|
||||
icon_template: >
|
||||
{% if states('binary_sensor.ping_google') == 'on' or states('binary_sensor.ping_cloudflare') == 'on' %}
|
||||
mdi:web
|
||||
{% else %}
|
||||
mdi:web-off
|
||||
{% endif %}
|
||||
|
||||
network_system_healthy:
|
||||
friendly_name: "Network System Healthy"
|
||||
value_template: >
|
||||
{{ states('binary_sensor.ping_router') == 'on' and
|
||||
states('binary_sensor.router_authenticated') == 'on' and
|
||||
states('sensor.system_health_score') | int >= 70 }}
|
||||
icon_template: >
|
||||
{% if states('binary_sensor.ping_router') == 'on' and
|
||||
states('binary_sensor.router_authenticated') == 'on' and
|
||||
states('sensor.system_health_score') | int >= 70 %}
|
||||
mdi:check-circle-outline
|
||||
{% else %}
|
||||
mdi:alert-circle-outline
|
||||
{% endif %}
|
||||
|
||||
any_device_blocked:
|
||||
friendly_name: "Any Device Blocked"
|
||||
value_template: >
|
||||
{{ states('sensor.devices_currently_blocked') | int > 0 }}
|
||||
icon_template: >
|
||||
{% if states('sensor.devices_currently_blocked') | int > 0 %}
|
||||
mdi:shield-check
|
||||
{% else %}
|
||||
mdi:shield-off-outline
|
||||
{% endif %}
|
||||
|
||||
bedtime_hours:
|
||||
friendly_name: "Bedtime Hours"
|
||||
value_template: >
|
||||
{% set now_time = now().strftime('%H:%M') %}
|
||||
{% set bedtime_start = states('input_text.bedtime_start') %}
|
||||
{% set bedtime_end = states('input_text.bedtime_end') %}
|
||||
{% if bedtime_start and bedtime_end %}
|
||||
{% if bedtime_start > bedtime_end %}
|
||||
{# Bedtime crosses midnight #}
|
||||
{{ now_time >= bedtime_start or now_time <= bedtime_end }}
|
||||
{% else %}
|
||||
{# Normal bedtime within same day #}
|
||||
{{ bedtime_start <= now_time <= bedtime_end }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
icon_template: >
|
||||
{% set now_time = now().strftime('%H:%M') %}
|
||||
{% set bedtime_start = states('input_text.bedtime_start') %}
|
||||
{% set bedtime_end = states('input_text.bedtime_end') %}
|
||||
{% if bedtime_start and bedtime_end %}
|
||||
{% if bedtime_start > bedtime_end %}
|
||||
{% if now_time >= bedtime_start or now_time <= bedtime_end %}
|
||||
mdi:sleep
|
||||
{% else %}
|
||||
mdi:sleep-off
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if bedtime_start <= now_time <= bedtime_end %}
|
||||
mdi:sleep
|
||||
{% else %}
|
||||
mdi:sleep-off
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
mdi:sleep-off
|
||||
{% endif %}
|
||||
|
||||
homework_hours:
|
||||
friendly_name: "Homework Hours"
|
||||
value_template: >
|
||||
{% set now_time = now().strftime('%H:%M') %}
|
||||
{% set homework_start = states('input_text.homework_start') %}
|
||||
{% set homework_end = states('input_text.homework_end') %}
|
||||
{% if homework_start and homework_end %}
|
||||
{{ homework_start <= now_time <= homework_end }}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
icon_template: >
|
||||
{% if states('binary_sensor.homework_hours') == 'on' %}
|
||||
mdi:school
|
||||
{% else %}
|
||||
mdi:school-outline
|
||||
{% endif %}
|
||||
|
||||
emergency_mode:
|
||||
friendly_name: "Emergency Mode"
|
||||
value_template: >
|
||||
{{ states('input_boolean.emergency_unblock_all') == 'on' or
|
||||
states('input_boolean.bypass_mode_enabled') == 'on' }}
|
||||
icon_template: >
|
||||
{% if states('input_boolean.emergency_unblock_all') == 'on' or
|
||||
states('input_boolean.bypass_mode_enabled') == 'on' %}
|
||||
mdi:alert-octagon
|
||||
{% else %}
|
||||
mdi:shield-check-outline
|
||||
{% endif %}
|
||||
|
||||
strict_parental_mode:
|
||||
friendly_name: "Strict Parental Mode"
|
||||
value_template: >
|
||||
{{ states('input_boolean.strict_mode_enabled') == 'on' and
|
||||
states('sensor.devices_currently_blocked') | int >= 4 }}
|
||||
icon_template: >
|
||||
{% if states('input_boolean.strict_mode_enabled') == 'on' and
|
||||
states('sensor.devices_currently_blocked') | int >= 4 %}
|
||||
mdi:shield-lock
|
||||
{% else %}
|
||||
mdi:shield-outline
|
||||
{% endif %}
|
||||
|
||||
# ========== DEVICE CONNECTIVITY SENSORS ==========
|
||||
- platform: template
|
||||
sensors:
|
||||
jess_laptop_1_reachable:
|
||||
friendly_name: "Jess Laptop 1 Device Reachable"
|
||||
value_template: >
|
||||
{% if states('input_text.jess_laptop_1_testing_mac') not in ['unknown', '', 'unavailable'] %}
|
||||
{{ states('input_boolean.jess_laptop_1_online') == 'on' }}
|
||||
{% else %}
|
||||
false
|
||||
{% endif %}
|
||||
icon_template: >
|
||||
{% if states('input_text.jess_laptop_1_testing_mac') not in ['unknown', '', 'unavailable'] %}
|
||||
{% if states('input_boolean.jess_laptop_1_online') == 'on' %}
|
||||
mdi:laptop
|
||||
{% else %}
|
||||
mdi:laptop-off
|
||||
{% endif %}
|
||||
{% else %}
|
||||
mdi:help-box
|
||||
{% endif %}
|
||||
|
||||
bella_devices_reachable:
|
||||
friendly_name: "Bella Devices Reachable"
|
||||
value_template: >
|
||||
{{ states('input_boolean.bella_iphone_online') == 'on' or
|
||||
states('input_boolean.bella_laptop_wireless_online') == 'on' or
|
||||
states('input_boolean.bella_desktop_wireless_online') == 'on' }}
|
||||
icon_template: >
|
||||
{% if states('input_boolean.bella_iphone_online') == 'on' or
|
||||
states('input_boolean.bella_laptop_wireless_online') == 'on' or
|
||||
states('input_boolean.bella_desktop_wireless_online') == 'on' %}
|
||||
mdi:account-check
|
||||
{% else %}
|
||||
mdi:account-off
|
||||
{% endif %}
|
||||
|
||||
xander_devices_reachable:
|
||||
friendly_name: "Xander Devices Reachable"
|
||||
value_template: >
|
||||
{{ states('input_boolean.xander_desktop_wired_online') == 'on' or
|
||||
states('input_boolean.xander_desktop_wireless_online') == 'on' }}
|
||||
icon_template: >
|
||||
{% if states('input_boolean.xander_desktop_wired_online') == 'on' or
|
||||
states('input_boolean.xander_desktop_wireless_online') == 'on' %}
|
||||
mdi:account-check
|
||||
{% else %}
|
||||
mdi:account-off
|
||||
{% endif %}
|
||||
|
||||
william_devices_reachable:
|
||||
friendly_name: "William Devices Reachable"
|
||||
value_template: >
|
||||
{{ states('input_boolean.william_desktop_wireless_online') == 'on' or
|
||||
states('input_boolean.william_laptop_wireless_online') == 'on' }}
|
||||
icon_template: >
|
||||
{% if states('input_boolean.william_desktop_wireless_online') == 'on' or
|
||||
states('input_boolean.william_laptop_wireless_online') == 'on' %}
|
||||
mdi:account-check
|
||||
{% else %}
|
||||
mdi:account-off
|
||||
{% endif %}
|
||||
|
||||
# ========== SYSTEM STATUS SENSORS ==========
|
||||
- platform: template
|
||||
sensors:
|
||||
configuration_complete:
|
||||
friendly_name: "Configuration Complete"
|
||||
value_template: >
|
||||
{% set required_macs = [
|
||||
'input_text.jess_laptop_1_testing_mac',
|
||||
'input_text.bella_iphone_mac',
|
||||
'input_text.bella_laptop_wireless_mac',
|
||||
'input_text.xander_desktop_wired_mac',
|
||||
'input_text.william_desktop_wireless_mac',
|
||||
'input_text.william_laptop_wireless_mac'
|
||||
] %}
|
||||
{% set empty_count = namespace(value=0) %}
|
||||
{% for mac in required_macs %}
|
||||
{% if states(mac) in ['', 'unknown', 'unavailable'] %}
|
||||
{% set empty_count.value = empty_count.value + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ empty_count.value == 0 and states('input_text.router_password') not in ['', 'unknown', 'unavailable'] }}
|
||||
icon_template: >
|
||||
{% set required_macs = [
|
||||
'input_text.jess_laptop_1_testing_mac',
|
||||
'input_text.bella_iphone_mac',
|
||||
'input_text.bella_laptop_wireless_mac',
|
||||
'input_text.xander_desktop_wired_mac',
|
||||
'input_text.william_desktop_wireless_mac',
|
||||
'input_text.william_laptop_wireless_mac'
|
||||
] %}
|
||||
{% set empty_count = namespace(value=0) %}
|
||||
{% for mac in required_macs %}
|
||||
{% if states(mac) in ['', 'unknown', 'unavailable'] %}
|
||||
{% set empty_count.value = empty_count.value + 1 %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if empty_count.value == 0 and states('input_text.router_password') not in ['', 'unknown', 'unavailable'] %}
|
||||
mdi:check-circle
|
||||
{% else %}
|
||||
mdi:cog-outline
|
||||
{% endif %}
|
||||
|
||||
mac_addresses_stable:
|
||||
friendly_name: "MAC Addresses Stable"
|
||||
value_template: >
|
||||
{{ states('sensor.devices_with_changed_macs') | int == 0 }}
|
||||
icon_template: >
|
||||
{% if states('sensor.devices_with_changed_macs') | int == 0 %}
|
||||
mdi:check-network-outline
|
||||
{% else %}
|
||||
mdi:alert-network-outline
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user