Advertisement
zubir2k

HA Automation - Mengaji sebelum Maghrib

Aug 3rd, 2021
966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.31 KB | None | 0 0
  1. alias: Azan Maghrib 25min Reminder
  2. description: ''
  3. trigger:
  4.   - platform: template
  5.     value_template: >-
  6.       {{state_attr("sensor.esolat_maghrib", "24hours") ==
  7.       (as_local(now()).strftime("%s") | int + (25*60)) |
  8.      timestamp_custom("%H:%M", false)}}
  9. condition: []
  10. action:
  11.   - service: tts.google_say
  12.     data:
  13.       message: It is 15 minutes before Maghrib! Get prepare.
  14.       entity_id: media_player.all_devices
  15.       language: en
  16.   - delay:
  17.       hours: 0
  18.       minutes: 0
  19.       seconds: 10
  20.       milliseconds: 0
  21.   - service: media_player.play_media
  22.     data:
  23.       media_content_type: audio/mp3
  24.       media_content_id: media-source://media_source/local/audio/alfatihah.mp3
  25.     entity_id: media_player.all_devices
  26.   - delay:
  27.       hours: 0
  28.       minutes: 0
  29.       seconds: 37
  30.       milliseconds: 0
  31.   - service: media_player.play_media
  32.     data:
  33.       media_content_type: audio/mp3
  34.       media_content_id: |
  35.        {{ ["media-source://media_source/local/audio/arrahman.mp3",
  36.             "media-source://media_source/local/audio/almuminun.mp3",
  37.             "media-source://media_source/local/audio/aljumuah.mp3",
  38.             "media-source://media_source/local/audio/abasa.mp3",
  39.             ] | random }}
  40.       extra:
  41.         title: Surah
  42.     entity_id: media_player.all_devices
  43. mode: single
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement