Last active
July 12, 2023 16:44
-
-
Save peterkeen/c07ed11ae1494897849997665e5fbe4e to your computer and use it in GitHub Desktop.
Home Assistant YouTube Blocker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type: custom:timer-bar-card | |
entities: | |
- entity: timer.youtube_15_minutes | |
state_color: true | |
name: YouTube | |
translations: | |
idle: Blocked | |
extend_paper_buttons_row: | |
position: right | |
buttons: | |
- icon: mdi:play | |
tap_action: | |
action: call-service | |
service: timer.start | |
service_data: | |
entity_id: timer.youtube_15_minutes | |
- icon: mdi:stop | |
tap_action: | |
action: call-service | |
service: timer.cancel | |
service_data: | |
entity_id: timer.youtube_15_minutes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Block YouTube | |
description: "" | |
trigger: | |
- platform: state | |
entity_id: | |
- sensor.YOUR_ROKU_active_app | |
to: YouTube | |
for: | |
hours: 0 | |
minutes: 0 | |
seconds: 5 | |
condition: [] | |
action: | |
- service: media_player.select_source | |
data: | |
source: Home | |
target: | |
device_id: YOUR_ROKU_DEVICE_ID | |
mode: single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Block YouTube When Timer Ends | |
description: "" | |
trigger: | |
- platform: state | |
entity_id: | |
- timer.youtube_15_minutes | |
from: null | |
to: idle | |
condition: [] | |
action: | |
- service: automation.turn_on | |
data: {} | |
target: | |
entity_id: automation.block_youtube | |
- service: automation.trigger | |
data: | |
skip_condition: true | |
target: | |
entity_id: automation.block_youtube | |
mode: single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Enable YouTube When Timer Starts | |
description: "" | |
trigger: | |
- platform: state | |
entity_id: | |
- timer.youtube_15_minutes | |
from: null | |
to: active | |
condition: [] | |
action: | |
- service: automation.turn_off | |
data: | |
stop_actions: true | |
target: | |
entity_id: automation.block_youtube | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment