102 lines
3.9 KiB
YAML
102 lines
3.9 KiB
YAML
#:########################################################################################:#
|
|
# TP-Link Deco Guest Wi-Fi Package #
|
|
#:########################################################################################:#
|
|
#
|
|
# TITLE:
|
|
# TP-Link Deco Guest Wi-Fi
|
|
#
|
|
# FILE:
|
|
# packages/tplink_deco_guest_wifi.yaml
|
|
#
|
|
# VERSION:
|
|
# V2.2 2026-08-24
|
|
#
|
|
# VERSION HISTORY:
|
|
# V2.2 2026-08-24
|
|
# - Replaced passive status sync with router-confirmed enforcement.
|
|
# - Repeats requests, reconciles at startup and hourly, and alerts when
|
|
# the Deco cannot confirm the requested state.
|
|
#
|
|
# V2.1 2026-08-04
|
|
# - Added the original router-status sync automation.
|
|
#
|
|
# V2.0 2026-08-04
|
|
# - Switched from Alexa voice commands to the Deco local API.
|
|
#
|
|
# PURPOSE:
|
|
# Enforces the requested TP-Link Deco guest Wi-Fi state and confirms it
|
|
# against the guest-network sensor reported by the router.
|
|
#
|
|
# DEPENDENCIES:
|
|
# - tplink_deco integration must be configured and connected to the Deco.
|
|
# - input_boolean.wifi_guest_network represents the requested guest-network
|
|
# state.
|
|
# - binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network reports
|
|
# the actual guest-network state from the router.
|
|
#
|
|
#:########################################################################################:#
|
|
|
|
automation:
|
|
- id: enforce_wifi_guest_network_state
|
|
alias: "Enforce Wifi Guest Network State"
|
|
description: >
|
|
Reconciles requested guest Wi-Fi with the Deco's reported state, repeats
|
|
the request once after 30 seconds, and alerts on an unconfirmed mismatch.
|
|
mode: restart
|
|
triggers:
|
|
- trigger: state
|
|
entity_id: input_boolean.wifi_guest_network
|
|
- trigger: state
|
|
entity_id: binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network
|
|
- trigger: homeassistant
|
|
event: start
|
|
- trigger: time_pattern
|
|
hours: "*"
|
|
minutes: "0"
|
|
conditions:
|
|
- condition: template
|
|
value_template: >
|
|
{{ states('input_boolean.wifi_guest_network') in ['on', 'off']
|
|
and states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network')
|
|
in ['on', 'off']
|
|
and states('input_boolean.wifi_guest_network')
|
|
!= states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network') }}
|
|
actions:
|
|
- repeat:
|
|
count: 2
|
|
sequence:
|
|
- choose:
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.wifi_guest_network
|
|
state: "on"
|
|
sequence:
|
|
- action: tplink_deco.set_guest_network
|
|
data:
|
|
enable: true
|
|
- conditions:
|
|
- condition: state
|
|
entity_id: input_boolean.wifi_guest_network
|
|
state: "off"
|
|
sequence:
|
|
- action: tplink_deco.set_guest_network
|
|
data:
|
|
enable: false
|
|
- wait_template: >
|
|
{{ states('input_boolean.wifi_guest_network')
|
|
== states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network') }}
|
|
timeout:
|
|
seconds: 30
|
|
continue_on_timeout: true
|
|
- condition: template
|
|
value_template: >
|
|
{{ states('input_boolean.wifi_guest_network')
|
|
!= states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network') }}
|
|
- action: persistent_notification.create
|
|
data:
|
|
notification_id: wifi_guest_network_state_mismatch
|
|
title: "Guest Wi-Fi state not confirmed"
|
|
message: >
|
|
The Deco still reports Guest Wi-Fi as {{ states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network') }}
|
|
after two requests to set it {{ states('input_boolean.wifi_guest_network') }}.
|