Files
fresh-home/automations/things/restart_router.yaml
T
2024-04-14 14:08:56 -04:00

56 lines
1.4 KiB
YAML

id: automation_restart_router
alias: Restart Router
mode: single
# Hide warnings when triggered while in delay.
max_exceeded: silent
trigger:
- id: button_pressed
platform: state
entity_id: input_button.restart_router
- id: boolean_turned_on
platform: state
entity_id: input_boolean.restart_router
from: 'off'
to: 'on'
action:
- choose:
- conditions:
- condition: trigger
id: button_pressed
sequence:
- alias: Create a persistent notification for testing
service: persistent_notification.create
data:
message: "The router would have restarted at {{now()}}"
title: "Router restarting"
- conditions:
- condition: trigger
id: boolean_turned_on
sequence:
- alias: Turn off switch controlling router
service: switch.turn_off
data: {}
target:
entity_id: switch.computer_area_double_power_plug_router
- alias: Wait for 10 seconds
delay: '00:00:10'
- alias: Turn on switch controlling router
service: switch.turn_on
data: {}
target:
entity_id: switch.computer_area_double_power_plug_router
- alias: Turn of input_boolean controlling the restart
service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.restart_router