Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - id: '1714012563709'
- alias: earthquake_automation2
- description: 地震預報通知2
- mode: single
- trigger:
- - platform: webhook
- allowed_methods:
- - POST
- local_only: true
- webhook_id: trigger_ea_cmd
- condition: []
- action:
- - variables:
- lv: '{{ trigger.json.level[:1] | int }}'
- time: '{{ trigger.json.seconds }}'
- - if:
- - condition: template
- value_template: '{{ lv >2 }}'
- alias: 地震是否大於2級
- then:
- - alias: 打開電燈
- service: switch.turn_on
- data: {}
- target:
- entity_id:
- - switch.guest_room
- - switch.living_room
- - alias: 打開Google音箱
- service: media_player.turn_on
- data: {}
- target:
- entity_id:
- - media_player.guest_room_mini
- - alias: 根據震度設定Google音箱音量
- service: media_player.volume_set
- data:
- entity_id:
- - media_player.guest_room_mini
- volume_level: '{{ 0.1*lv }}'
- - alias: Google音箱播放訊息
- service: tts.edge_tts_say
- data:
- entity_id:
- - media_player.guest_room_mini
- message: 警告!{{ lv }}級地震將在{{ time }}秒後抵達
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement