Skip to content

Instantly share code, notes, and snippets.

@oischinger
Last active July 28, 2019 17:51
Show Gist options
  • Save oischinger/92b7600f46f372143d2bf58b080f3662 to your computer and use it in GitHub Desktop.
Save oischinger/92b7600f46f372143d2bf58b080f3662 to your computer and use it in GitHub Desktop.
automation:
- id: 'mailbox_notification'
alias: You have mail
trigger:
- entity_id: sensor.0x00158d000313108a_action
platform: state
to: 'vibration'
condition: # Trying to prevent more than a single trigger every 20 seconds
- condition: template
value_template: '{{ as_timestamp(now()) - as_timestamp(states.automation.mailbox_notification.attributes.last_triggered) | int > 20 }}'
- condition: template
value_template: '{{ states.automation.mailbox_notification.attributes.last_triggered != none }}'
action:
- service: mqtt.publish
data_template:
topic: "/postled/warning"
payload_template: "You have mail"
- service: notify.telegram_notifier
data:
message: You have mail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment