Add title param to notify send_message service - add blog post (#2163)

* Add notify title option to send_message service

* Rephrase
This commit is contained in:
Jan Bouwhuis 2024-05-03 15:01:58 +02:00 committed by GitHub
parent 0177ff3741
commit 6f1e49b00d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 2 deletions

View File

@ -0,0 +1,20 @@
---
author: Jan Bouwhuis
authorURL: https://github.com/jbouwh
authorImageURL: https://avatars.githubusercontent.com/u/7188918?s=96&v=4
title: Second phase of notify entity platform implementation
---
### Title option for send_message service notify entity platform
Recently we added the notify [entity platform](https://developers.home-assistant.io/docs/core/entity/notify/). The new `notify` platform method implements service `send_message`. This service now also accepts an optional `title` as an argument. This allows some new integrations that can be migrated now to use the new entity platform:
- cisco_webex_teams
- file
- sendgrid
- syslog
- tibber
The [architecture discussion](https://github.com/home-assistant/architecture/discussions/1041) is still ongoing.
When integrations are migrated, users will need to use the new `notify.send_message` service, so the migration changes will cause automations to break after the deprecation period is over.

View File

@ -32,9 +32,9 @@ The send message method is used to send a message to a device or service.
class MyNotifier(NotifyEntity):
# Implement one of these methods.
def send_message(self, message: str) -> None:
def send_message(self, message: str, title: str | None = None) -> None:
"""Send a message."""
async def async_send_message(self, message: str) -> None:
async def async_send_message(self, message: str, title: str | None = None) -> None:
"""Send a message."""
```