Created
July 7, 2024 06:54
-
-
Save luuquangvu/e685a857942fb320e416d52dbd74ae42 to your computer and use it in GitHub Desktop.
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: Nhắc xem thời sự hàng ngày | |
description: "" | |
trigger: | |
- platform: time | |
at: "19:00:00" | |
condition: | |
- condition: template | |
value_template: "{{ is_state('person.mo_mo', 'home') }}" | |
action: | |
- variables: | |
action_confirm: "{{ 'CONFIRM_' ~ context.id }}" | |
action_cancel: "{{ 'CANCEL_' ~ context.id }}" | |
- service: notify.mobile_app_iporn | |
metadata: {} | |
data: | |
message: Bạn có muốn xem tin tức thời sự ngày hôm nay không? | |
title: "Thông báo" | |
data: | |
tag: daily_news | |
actions: | |
- action: "{{ action_confirm if action_confirm is defined }}" | |
title: Đồng ý | |
- action: "{{ action_cancel if action_cancel is defined }}" | |
title: Bỏ qua | |
- wait_for_trigger: | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_confirm if action_confirm is defined }}" | |
- platform: event | |
event_type: mobile_app_notification_action | |
event_data: | |
action: "{{ action_cancel if action_cancel is defined }}" | |
timeout: | |
hours: 0 | |
minutes: 15 | |
seconds: 0 | |
milliseconds: 0 | |
- variables: | |
wait_action: >- | |
{{ 'timeout' if wait.trigger.event is undefined else | |
wait.trigger.event.data.action }} | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ wait_action == action_confirm }}" | |
sequence: | |
- service: remote.turn_on | |
metadata: {} | |
data: {} | |
target: | |
entity_id: | |
- remote.sony_kd_49x8300c | |
- remote.x4q | |
- service: media_player.play_media | |
metadata: {} | |
data: | |
media_content_type: url | |
media_content_id: https://www.youtube.com/feed/news_destination | |
target: | |
entity_id: media_player.x4q | |
- conditions: | |
- condition: template | |
value_template: "{{ wait_action == action_cancel }}" | |
sequence: | |
- stop: User cancelled | |
default: | |
- service: notify.mobile_app_iporn | |
metadata: {} | |
data: | |
message: clear_notification | |
data: | |
tag: daily_news | |
mode: parallel | |
max: 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment