Files
zorruno-homeassistant/packages/alexa_tplink_actions.yaml
T
2026-08-15 14:58:19 +12:00

112 lines
4.1 KiB
YAML

#:########################################################################################:#
# TP-Link Deco Guest Wi-Fi Package #
#:########################################################################################:#
#
# TITLE:
# TP-Link Deco Guest Wi-Fi
#
# FILE:
# packages/alexa_tplink_actions.yaml
#
# VERSION:
# V2.1 2026-08-04
#
# VERSION HISTORY:
# V2.1 2026-08-04
# - Added sync automation so input_boolean.wifi_guest_network tracks the
# router's actual guest Wi-Fi status via the new guest-network
# binary sensor from the integration.
#
# V2.0 2026-08-04
# - Switched from Alexa voice commands to direct Deco local API control.
# - Uses tplink_deco.set_guest_network service for reliable on/off.
#
# V1.1 2026-07-20
# - Added structured documentation and automation descriptions.
#
# V1.0
# - Initial Alexa-mediated TP-Link guest-network controls.
#
# PURPOSE:
# Enables or disables the TP-Link guest Wi-Fi network via the Deco's local
# API, using the tplink_deco custom integration's set_guest_network service.
#
# DEPENDENCIES:
# - tplink_deco integration must be configured and connected to the Deco.
# - input_boolean.wifi_guest_network is a UI-managed helper that 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 and keeps the helper in
# sync.
#
# OPERATION NOTES:
# - The helper records requested state; the sync automation below then
# reconciles it against the router's actual state so the helper tracks
# the real guest-network status.
# - If the Deco API call fails, the helper can disagree with the
# actual guest-network state.
#
#:########################################################################################:#
automation:
- alias: "Turn on the Wifi Guest Network"
description: "Enables the TP-Link Deco guest Wi-Fi network via local API."
mode: single
triggers:
- trigger: state
entity_id: input_boolean.wifi_guest_network
to: "on"
actions:
- action: tplink_deco.set_guest_network
data:
enable: true
- alias: "Turn off the Wifi Guest Network"
description: "Disables the TP-Link Deco guest Wi-Fi network via local API."
mode: single
triggers:
- trigger: state
entity_id: input_boolean.wifi_guest_network
to: "off"
actions:
- action: tplink_deco.set_guest_network
data:
enable: false
- alias: "Sync Wifi Guest Network button with actual status"
description: >
Reconciles input_boolean.wifi_guest_network against the router's actual
guest Wi-Fi state reported by the guest-network binary sensor, so the
button reflects real status (including changes made outside HA).
mode: single
triggers:
- trigger: state
entity_id: binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network
to: "on"
- trigger: state
entity_id: binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network
to: "off"
conditions:
- condition: template
value_template: >
{{ states('input_boolean.wifi_guest_network')
!= states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network') }}
actions:
- choose:
- conditions:
- condition: template
value_template: >
{{ states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network') == 'on' }}
sequence:
- action: input_boolean.turn_on
target:
entity_id: input_boolean.wifi_guest_network
- conditions:
- condition: template
value_template: >
{{ states('binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network') == 'off' }}
sequence:
- action: input_boolean.turn_off
target:
entity_id: input_boolean.wifi_guest_network