various tidyups
This commit is contained in:
@@ -1,17 +1,26 @@
|
||||
#:########################################################################################:#
|
||||
# Alexa TP-Link Guest Wi-Fi Package #
|
||||
# TP-Link Deco Guest Wi-Fi Package #
|
||||
#:########################################################################################:#
|
||||
#
|
||||
# TITLE:
|
||||
# Alexa TP-Link Guest Wi-Fi
|
||||
# TP-Link Deco Guest Wi-Fi
|
||||
#
|
||||
# FILE:
|
||||
# packages/alexa_tplink_actions.yaml
|
||||
#
|
||||
# VERSION:
|
||||
# V1.1 2026-07-20
|
||||
# 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.
|
||||
#
|
||||
@@ -19,73 +28,84 @@
|
||||
# - Initial Alexa-mediated TP-Link guest-network controls.
|
||||
#
|
||||
# PURPOSE:
|
||||
# Enables or disables the TP-Link guest Wi-Fi network by sending custom Alexa
|
||||
# requests through the kitchen Echo Show.
|
||||
# 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.
|
||||
# - media_player.view_rd_kitchen_echo_show must be available through the Alexa
|
||||
# Media Player integration.
|
||||
# - The Alexa account must have a working, linked TP-Link skill.
|
||||
#
|
||||
# ALEXA REQUESTS:
|
||||
# - On: ask t.p.link to enable guest network
|
||||
# - Off: ask t.p.link to disable guest network
|
||||
# - 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; it does not confirm router state.
|
||||
# - If Alexa or the TP-Link skill fails, the helper can disagree with the
|
||||
# - 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.
|
||||
# - After the helper remains on for two hours, it is turned off. That state
|
||||
# change then sends the Alexa disable request.
|
||||
# - The two-hour state-trigger period does not persist through a Home Assistant
|
||||
# restart or automation reload.
|
||||
#
|
||||
#:########################################################################################:#
|
||||
|
||||
automation:
|
||||
- alias: "Turn on the Wifi Guest Network"
|
||||
description: "Asks the linked TP-Link Alexa skill to enable the guest Wi-Fi 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: media_player.play_media
|
||||
target:
|
||||
entity_id: media_player.view_rd_kitchen_echo_show
|
||||
- action: tplink_deco.set_guest_network
|
||||
data:
|
||||
media_content_type: custom
|
||||
media_content_id: ask t.p.link to enable guest network
|
||||
enable: true
|
||||
|
||||
- alias: "Turn off the Wifi Guest Network"
|
||||
description: "Asks the linked TP-Link Alexa skill to disable the guest Wi-Fi 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: media_player.play_media
|
||||
target:
|
||||
entity_id: media_player.view_rd_kitchen_echo_show
|
||||
- action: tplink_deco.set_guest_network
|
||||
data:
|
||||
media_content_type: custom
|
||||
media_content_id: ask t.p.link to disable guest network
|
||||
enable: false
|
||||
|
||||
- alias: "Switch guest network off after time"
|
||||
description: "Turns off the guest-network helper after it remains on for two hours."
|
||||
- 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: input_boolean.wifi_guest_network
|
||||
from: "off"
|
||||
entity_id: binary_sensor.data_cupboard_new_sundamage_12_deco_guest_network
|
||||
to: "on"
|
||||
for: "02:00:00"
|
||||
conditions: []
|
||||
- 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:
|
||||
- action: input_boolean.turn_off
|
||||
target:
|
||||
entity_id: input_boolean.wifi_guest_network
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user