Advertisement
xangin

HA earthquake_alert script

Apr 2nd, 2024 (edited)
1,299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.16 KB | None | 0 0
  1. earthquake_alert:
  2.   alias: 地震通知腳本
  3.   variables:
  4.     lv: "{{ level[:1] | int }}"
  5.   sequence:    
  6.     #要做的事情放在此
  7.     - alias: "Line通知"
  8.       service: notify.line_notify  #修改成自己的line notify名稱
  9.       data:
  10.         message: '警告!{{ lv }}級地震將在{{ seconds }}秒後抵達'
  11.          
  12.     - alias: "打開智慧音箱"
  13.       service: media_player.turn_on
  14.       data: {}
  15.       target:
  16.         entity_id:
  17.           - media_player.living_room_nesthub #可同時寫多個音箱
  18.           - media_player.guest_room_mini
  19.     - alias: "設定智慧音箱音量"
  20.       service: media_player.volume_set
  21.       data:
  22.         entity_id:
  23.        - media_player.guest_room_mini
  24.         - media_player.living_room_nesthub #可同時寫多個音箱
  25.         volume_level: '0.4' #0.1~1 1是最大聲
  26.     - alias: "智慧音箱播報"
  27.       service: tts.edge_tts_say #修改成自己的tts服務
  28.       data:
  29.         entity_id:
  30.          - media_player.living_room_nesthub #可同時寫多個音箱
  31.           - media_player.guest_room_mini
  32.         message: 警告!{{ lv }}級地震將在{{ seconds }}秒後抵達              
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement