I’m attempting to setup a simple alert for my garage door but the setup for notifications is not clear based on the doc. It says:
To setup the alert integration, first, you must setup a notification integration.
# Example configuration.yaml entry
alert:
garage_door:
name: Garage is open
done_message: Garage is closed
entity_id: input_boolean.garage_door
state: 'on'
repeat: 30
can_acknowledge: true
skip_first: true
notifiers:
- ryans_phone
- kristens_phone
I tried searching for the notification integration doc and closest I could find by name is this? But it says nothing about how to setup something like ryans_phone in the example. Only how to call notifications from other places like automations.
There is also Notify Group (which is not mentioned by name in the Alert doc) but seemingly could be it? Even then the example in that doc uses the notify.xyz syntax when calling the notification group which is different than the Alert doc.
What am I missing? Where / how do you configure the notifiers used in the Alert example?
Anything really, it’s not clear how / where to configure anything listed under notifiers in their example. In my case I want to notify the companion app as well as send a tts message to a WallPanel via MQTT (not sure if that’s within scope for this notifiers feature)
If so it still doesn’t answer the question of how to do it via the method in their example. I can see the value in using these abstractions they create to avoid duplication throughout the config files and would like to know how to leverage it properly.
My use case is exactly why the Alert feature was created and in the more recent threads I read about trying to accomplish this the suggestion was the Alert feature. It can but done with automations but it’s a little clunky and I think they’re being used because they were the only option until this came along.
#send a repeating alert if the garage door is left open. I put '/ackGarage' at the end of the message to allow the
#recipient to easily acknowledge it by tapping on it.
alert:
garage_door:
name: '{{now().strftime("%H:%M:%S %Y-%m-%d")}}: Garage door open for {{ relative_time(states.cover.garage_door.last_changed) }}. /ackGarage'
entity_id: cover.garage_door
state: 'open'
repeat:
- 15
- 30
can_acknowledge: True
skip_first: True
notifiers:
- telegramBot1
I might be able to work with this but it’s frustrating the doc doesn’t make this clear. Nowhere that I’ve found at least.
Is that really relevant? Maybe people just don’t realize it’s an option. I don’t think Automations is the right option for this use case and as stated the Alert feature was created for example this case. From someone who wrote an extensive blog post on doing it via automations originally: “honestly, I couldn’t imagine anyone trying to do it any other way but the alert component.”
The example in the doc is exactly what I’m after but it’s missing some key information, hence I’m trying to fill in the gaps.
Not trying to sound rude but if you’ve never used the Alert component and don’t know how the notification section works then why reply and debate things that aren’t contributing to a solution? Sorry, I know you’re attempting to help, I’m just frustrated with the gaps in the documentation. They present a perfect solution but not enough information to implement it.
In the notifier section, you simply name the notifier name and no additional information. Please note, in your example, you dont use ‘notify.’, just ‘mobile_app_YOURPHONE’
The alert component will then use perform something like this
data;
message: name
service: notify.notifiers
name is literally the name used in the alert configuration. It will serve as the message in the notification
The service will be a service call to each of the notifiers service specified in the configuration
If you would like to pass more information to the notifier service, you can either include it in the alert or you could create your own notifier service using notifier group. In my opinion, the notify group is slightly easier to understand. In my case, i use the kitchen_push notifier in other places so it makes sense for me to just create another notifier instead of trying to include the notifier data in the alert
Example:
alert:
fridge_door:
name: The fridge door is open
entity_id: binary_sensor.fridge_door
state: 'on'
repeat: 3
skip_first: true
done_message: The fridge door has been closed
notifiers:
- kitchen_push
- broadcast
notify:
- name: broadcast
platform: rest
resource: http://localhost:3000/assistant
method: POST
message_param_name: command
data:
broadcast: true
- name: kitchen_push
platform: group
services:
- service: notify
data:
title: Kitchen
data:
message_type: notification
tag: kitchen
In my example, I am using the notifiers broadcast and kitchen_push. Kitchen push is basically the notifier service notify (which is provided by the mobile app I’m using) but with predefined data that will always be included when kitchen_push is used.
With this configurations I get:
Receive a Google Home broadcast and a mobile notification after the first 3 minutes of binary_sensor.fridge_door being on and every 3 minutes. If skip_first were false, the notification will be sent immediately when binary_sensor.fridge_door goes from ‘off’ to ‘on’ and then 3 minutes after that. The message I receive will say “The fridge door is open”
Receive a Google Home broadcast and a mobile notification after binary_sensor.fridge_door is ‘off’. The message will say “The fridge door has been closed”. If done_message were not specified, no notification will be given when binary_sensor.fridge_door is off
In your example, this may work better.
alert:
garage_door:
name: Garage is open
done_message: Garage is closed
entity_id: input_boolean.garage_door
state: 'on'
repeat: 30
can_acknowledge: true
skip_first: true
notifiers:
- mobile_app_YOURPHONE
The first question is: what are you currently using to notify? Are you using anything?
If you are not using anything that you personally configured yourself, there are various available to choose from https://www.home-assistant.io/integrations/#notifications
If the link doesn’t take you directly to the notification, please select Notifications from the left sidebar
If you installed any of the mobile apps such as the companion apps, they also provide a notifier service.
You can view which notifiers are currently registered for you to use under Developer Tools-> Services
I have some of the companion app notifiers setup which maybe is where some of the confusion is coming in. Other places that I use those notifiers I use the syntax notify.mobile_app_my_iphone. But in the examples for the Alert component there’s no notify. which makes it seem like a different thing but with no instructions on how / where to set that up.
Can I use the notify.mobile_app_my_iphone notifier with the Alert and if so what’s the syntax?
Works well, even the example from the doc now that I know the notify. just gets dropped for the phone notifications compared to other places it’s called from.
However, I’m not sure how to include a call to MQTT Publish. I haven’t found any example of doing it from an Alert directly just clunky abstracted workarounds like this
Presumably the notify. is assumed by the fact that it is under the heading notifiers:. The syntax is clear enough from the docs. If you don’t think so, then change them.
As far as an mqtt is concerned, or calling another service, the solution in the post you pointed to is not really clunky, and is pretty simple.