Advertisement
marlar

Postkassesensor

Dec 28th, 2022
1,344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.10 KB | None | 0 0
  1. alias: Postkasse
  2. description: ''
  3. trigger:
  4.   - type: motion
  5.     platform: device
  6.     device_id: 7ba07dcbc083c27b04a108622c384713
  7.     entity_id: binary_sensor.hue_motion_sensor_1_motion
  8.     domain: binary_sensor
  9. condition:
  10.   - condition: or
  11.     conditions:
  12.       - condition: state
  13.         entity_id: input_boolean.postkasse_notifikation_sendt
  14.         state: 'off'
  15.       - condition: template
  16.         value_template: >-
  17.           {{ state_attr("automation.postkasse","last_triggered").strftime("%d")
  18.           != now().strftime("%d") }}
  19. action:
  20.   - service: script.1670247447247
  21.     data:
  22.       message: Der er kommet post!
  23.       title: Postkassen
  24.       type: persistent
  25.       id: postkasse
  26.   - service: notify.mobile_app_clt_l29
  27.     data:
  28.       message: Der er kommet post!
  29.       title: Besked fra postkassen
  30.       data:
  31.         notification_icon: mdi:mailbox-outline
  32.         ttl: 0
  33.         priority: high
  34.         channel: postkasse
  35.         icon_url: https://cdn-icons-png.flaticon.com/512/948/948695.png
  36.         actions:
  37.           - action: POSTKASSE_NOTIFIKATION_MODTAGET
  38.             title: Okay!
  39.   - if:
  40.       - condition: time
  41.         after: '09:00:00'
  42.         before: '21:30:00'
  43.     then:
  44.       - service: tts.edge_tts_say
  45.         data:
  46.           entity_id: media_player.nestmini8623
  47.           message: Der er kommet post.
  48.           language: da-DK-JeppeNeural
  49.           options:
  50.             volume: 100
  51.             rate: +15%
  52.   - service: input_boolean.turn_on
  53.     data: {}
  54.     target:
  55.       entity_id: input_boolean.postkasse_notifikation_sendt
  56.   - wait_for_trigger:
  57.       - platform: event
  58.         event_type: mobile_app_notification_action
  59.         event_data:
  60.           action: POSTKASSE_NOTIFIKATION_MODTAGET
  61.       - platform: event
  62.         event_type: mobile_app_notification_cleared
  63.     timeout:
  64.       hours: 16
  65.     continue_on_timeout: true
  66.   - service: input_boolean.turn_off
  67.     target:
  68.       entity_id: input_boolean.postkasse_notifikation_sendt
  69.     data: {}
  70.   - service: persistent_notification.dismiss
  71.     data:
  72.       notification_id: postkasse
  73. mode: single
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement