Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102474

Basic help with organizing code - reed switch actions on mail delivery

$
0
0

@rahhhsir wrote:

Hello everyone. I am looking for some basic help organizing code.
I have a wyze sensor on my mailbox next to the front door. Ideally, I would like to play a mail song through google home speaker when the box opens and mail is delivered. I would like to only play the song once a day, or prevent the song from playing if the front door sensor opens just before the mailbox, signifying that it’s not an actual mail delivery.
Regardless, I am trying to also push a notification to the phone, with a picture from a camera, and play a sound on the phone. I am confused about the formatting of the code. I am using Brackets to code in yaml, but need some help:

- action:
  - data:
      entity_id: media_player.kitchen_speaker
      media_content_id: 'http://LOCALIP/local/audio/mail.mp3'
      media_content_type: music
    service: media_player.play_media
  alias: '[Sound] Mailbox Open'
  trigger:
    entity_id: binary_sensor.wyzesense_123456
    platform: state
    to: 'on'
#  condition:
#    condition: template
#    value_template: "{{ (as_timestamp(now()) - as_timestamp(state_attr('automation.doorbell_alert', 'last_triggered') | default(0)) | int > 5)}}"
#  - service: camera.snapshot
#    data:
#      entity_id: camera.front
#      filename: '/config/www/doorbell.jpg'
    service: notify.mobile_app_device_name
    data:
      message: Mailbox has opened.
      data:
        push:
          sound: "Doorbell.wav"
        attachment:
          url: http://IP_URL_TO_CAMERA_SNAPSHOT
  trigger:
    entity_id: binary_sensor.wyzesense_123456
    platform: state
    to: 'on'

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 102474

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>