Picture this. You’re writing a notification to notify people in the house that the washing machine is finished.
Specifically, you don’t want people who aren’t in the house to be notified because it’s not relevant to them at all.
Under HA today, you have to:
- List every applicable device to be notified.
- Some of those are owned by a person, while others are communal (e.g., TV).
- Call a service for each of these devices.
- Using a slightly different action interface for each device.
- Wrap around conditional logic for every device you don’t want to receive the notification when a person isn’t home.
- You might have to do this several times depending, on how many people you’re tracking.
- Hope you don’t have to change the automation for a long time.
The current way is clunky and time consuming. I think there is a better way.
Let’s rethink notifications!
I’m hoping to communicate how I imagine automations could behave under a reimagined automation engine. I’ve written about this in the past, but this is a good chance to rehash.
When we use the (say) notify.notify
action, here’s how it could work.
Importantly, when the topology of notification devices changes, actions do not need to be revised by the user to get the same result as before (except for notifying specific devices).
Where does the notification go?
1. Notify person/people
Alongside tracking devices associated with person
entities, we can also have notification devices associated with them.
When a notification is sent to a person
entity, every device listed as a notification device will receive the notification.
2. Notify area(s)
Any notification device that is associated with an area (room/floor/etc.) will receive the notification.
3. Notify zone(s)
Any notification device listed in a zone (work/school/home) will receive the notification. Presumably, any device that isn’t tracked on the map will be assumed to be zone.home
.
4. Notify device(s)
Any notification device that is selected will receive the notification.
5. Mix and match
The user would have the choice of being able to select different criteria. For example, notification devices belonging to a person that are also at home; or devices that are at home or at the office.
The user would have the option of sending the notification that meet all or any of the criteria.
How will the notifications be built?
Currently, the notification engine provides a different service for each device. This is messy because there is a slightly different interface depending on whether it’s a TV, iOS, Android, etc.
The notify.notify
action will contain a generalised interface where the Title and Message fields will be common across all devices.
Any settings relevant to a specific platform can be enumerated underneath, perhaps responding to the devices that are due to be targeted.
Settings that have to be written out in YAML now (such as critical iOS notifications or groupings) will be brought into the UI.