Advertisement
yurghie

Home Assistant Unifi traffic rule

Dec 31st, 2024
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.56 KB | None | 0 0
  1. automation:
  2.   - alias: youtube auto
  3.     trigger:
  4.       - platform: time
  5.         at: input_datetime.youtube_auto_pa
  6.       - platform: time
  7.         at: input_datetime.youtube_auto_av
  8.       - platform: homeassistant
  9.         event: start
  10.     action:
  11.       - service: >-
  12.           {% set n = as_timestamp(now(), true)|timestamp_custom('%H:%M') %}
  13.           switch.turn_{{ 'off' if n>=states('input_datetime.youtube_auto_pa')[:5] and n<states('input_datetime.youtube_auto_av')[:5] else 'on'}}
  14.  
  15.         target:
  16.           entity_id: switch.unifi_network_youtube_off
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement