Closed jcallaghan closed 3 years ago
notification
documentation - https://companion.home-assistant.io/docs/notifications/notifications-basicThe mobileapp notify platform accepts the standard title, message and target parameters used by the notify platform. The mobile\app notify platform supports targets as services. As long as you granted notifications permissions during setup, you will find all your devices listed as targets for the notify service with names prefixed notify.mobileapp followed by the Device ID of you device. This can be checked in the App Configuration menu of the sidebar and defaults to the name specified in the General>About within the iOS settings app or under About>Phone in Android settings (with spaces and non alphanumeric characters replaced by underscores). A requirement of the notify platform is that you must specify at least message
Mobile App
documentation - https://companion.home-assistant.io/docs/core/coreThe Home Assistant Companion App provides a convenient way to view and control your Home Assistant instance however it also extends the power of your instance by allowing your device to act as a data source. The Home Assistant Companion App adds numerous sensors (such as battery and network status among others), creates a device_tracker entity to allow location updates to be sent from the device and also provides action shortcuts to trigger scripts or automations.
Additional to the alert
integration I've also leveraged an actionable alert which allows me to disable the alert and stop it from repeating.
To achieve this I create a generic notification category in my iOS configuration.
ios:
push:
categories:
- name: Alert
identifier: 'alert_acknowledgement'
actions:
- identifier: 'alert_acknowledgement_disable'
title: 'Disable alert?'
authenticationRequired: false
destructive: true
behavior: 'default'
activationMode: 'background'
Then in my alert group, I provide the alert entity_id in the action data that is sent back to Home Assistant with the actionable alert (category).
platform: group
name: alert_kitchen_fridge_door
services:
- service: mobile_app_james_iphone
data_template:
# title: ''
# message: ''
data:
apns_headers:
apns-collapse-id: "alert_kitchen_fridge_door"
push:
category: 'alert_acknowledgement'
action_data:
entity_id: alert.kitchen_fridge_door
I then have an automation that is triggered when the ios.notification_action_fired
is fired for this actionable alert ALERT_ACKNOWLEDGEMENT_DISABLE
.
alias: 'System - Alert acknowledgement action'
id: 'dfaca9d5-fc80-4455-b54d-0b363b721aaa'
description: 'Disables alert via actionable alert.'
initial_state: true
mode: 'single'
trigger:
# Trigger on actionable alert event.
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: ALERT_ACKNOWLEDGEMENT_DISABLE
condition: []
action:
# Disable the alert.
- service: alert.turn_off
data_template:
entity_id: "{{ trigger.event.data.action_data.entity_id }}"
# Acknowledge the alert has been disabled.
- service: notify.mobile_app_james_iphone
data_template:
title: '🆘 Alert disabled'
message: "Alert '{{ trigger.event.data.action_data.entity_id }}' has been disabled."
Shared on Twitter.
If you add a message
and done_message
to your alert
notify.group
configuration then these will be passed to the notification service unless you explicitly define a message
with your service.
notify:
platform: group
name: alert_kitchen
services:
- service: mobile_app_james_iphone
data_template:
- service: html5_notification
- service: alexa_media
data:
target: ["media_player.alexa_kitchen","media_player.alexa_james_desk","media_player.alexa_hall_dot"]
data:
type: 'announce'
method: 'all'
alert
integration documentation https://www.home-assistant.io/integrations/alertHome Assistant
Instructions on how to setup automatic alerts within Home Assistant.
One consideration with the notify.group
is that I cannot see a way to route notifications based on who is home or where there was last activity, or even respecting quite hours. It is likely this is possible with further templating but I've not tried that yet.
Add alert entities to my warning card on my main Lovelace dashboard #207.
Great examples here https://github.com/scstraus/home-assistant-config/blob/29656bfe3ab7647b5a242665626e66f3b4989add/alerts.yaml
GitHub
My HomeAssistant Configuration (Home Assistant Supervised, Ubuntu Server 18.04.1 LTS, 2011 Mac Mini) - scstraus/home-assistant-config
Shared more on Twitter.
You should make these notifications critical so that they bypass Do Not Disturb and low volume, in addition to making them appear on CarPlay.
https://twitter.com/Robbie/status/1290734087313874944
“@jamescallaghan @home_assistant Now make them critical alerts so they break through DND/volume limits on iOS!”
GitHub
Home assistant configuration files. Contribute to jamesawebb/homeassistant development by creating an account on GitHub.
GitHub
Contribute to rbflurry/Home-Assistant-Config development by creating an account on GitHub.
GitHub
Contribute to reefab/homeassistant-config development by creating an account on GitHub.
GitHub
Contribute to honkerst/homeassistant development by creating an account on GitHub.
Don't forget the really helpful relative_time
function that presents the time in a friendly format.
{{ as_timestamp(states.binary_sensor.front_door_contact.last_changed) | timestamp_local }}
{{ relative_time(states.binary_sensor.front_door_contact.last_changed) }}
This is truly inspiring @basesnow
https://twitter.com/Basesnow/status/1291773453700390912
“@jamescallaghan @home_assistant Love actionable notifications! My HA garage door notification with live stream, snooze options, and cover toggle is light years ahead of the old iOS notification I was getting with HomeKit.”
Thanks! here is the yaml
I use automations to send a number of notifications when an event such as a door or temperature is too low. While this works for one notification making it loop is a little tricky (less so with the new automation) but the
alert
integration is built for just this use-case. The alert is also persistent is annoying and likely will lead to the event being corrected, particularly when TTS is used.Example alert
The following example will cause the alert to activate when
binary_sensor.fridge_door_contact
ison
. The alert will activate after 2 minutes (as skip_first is true) and repeat every 5 minutes. This is due to the repeat pattern I've provided.Automation to refactor