Add new notify entity component #1041
-
ContextMore than 67 integrations (and custom integrations) implement the
ProposalImplement an entity component platform for the Aim is that integrations can add as many entities as needed (e.g. one per target). Users can target the entities through the new entity service. If integrations support a list of The initial implementation will be basic and only have one required parameter for def send_message(self, message: str, title: str | None = None) -> None:
"""Send a message."""
... async def async_send_message(self, message: str, title: str | None = None) -> None:
"""Send a message."""
.... Later we can add functionality for supplying recipients or additional data. Device classesBased on the inventory the intitial proposed device classes are: NotifyDeviceClass.DIRECT_MESSAGE = "direct_message"
NotifyDeviceClass.DISPLAY = "display"
NotifyDeviceClass.EMAIL = "email"
NotifyDeviceClass.SMS = "sms" Device class support will be left out of the MVP, to be implemented later. ConsequencesThe use of the legacy service notify services should be deprecated in phases and integrations should implement the new notify entity platform. This is breaking because the custom notify services will no longer be available. Users should update their automation's to use the new service instead. Prove of ConceptProve of Concept (including demo in with the Phased approachIn the fist phase of this proposal we'll implement a basic entity without features. We only apply it for basic notify integrations with predefined targets/recipients and without |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 31 replies
-
It would be preferable to represent each notify target with an entity. The problem with that is that we don't know all targets before hand in some integrations. I think a suggestion should solve this problem to be accepted. |
Beta Was this translation helpful? Give feedback.
-
I discussed this proposal today with Martin, Robert and Eric. We agree and we want to move forward. However, we want to move with a small step first to get a feeling for how the architecture will work. So I think the first step should be to add service entities only for cases where the recipient is fixed. For example, this would allow the mobile app integration to provide a notify entity. I would not include supported feature support yet and just focus on message for the MVP. I am writing up a proposal for config subentries (coming soon!), which can function as a contact registry as you described above for integrations like telegram. |
Beta Was this translation helpful? Give feedback.
-
The following device classes are part of the proposal: NotifyDeviceClass.DIRECT_MESSAGE = "direct_message"
NotifyDeviceClass.DISPLAY = "display"
NotifyDeviceClass.EMAIL = "email"
NotifyDeviceClass.SMS = "sms" This will not be part of the MVP, so there is some time to discuss. |
Beta Was this translation helpful? Give feedback.
-
I'd like to extend the proposal with a
The def send_message(self, message: str, title: str | None = None) -> None:
"""Send a message."""
...
async def async_send_message(self, message: str, title: str | None = None) -> None:
"""Send a message."""
... Integration supporting the title arg should add the Draft PR to implement the proposal: home-assistant/core#116426 |
Beta Was this translation helpful? Give feedback.
-
I'm not sure I'm rocking the boat here, but the model name "notify" seems off to me. All other entity domains are nouns (sensor, button, switch, etc), but the word "notify" is a verb, not a noun. A sentence where you say "all my notifys are misbehaving because..." seems very weird to me, even as a non-native speaker. Shouldn't it be a noun, such as "notification", "notifier" or similar? |
Beta Was this translation helpful? Give feedback.
-
@jbouwh Are any updates planned for this? |
Beta Was this translation helpful? Give feedback.
-
I have looked into the usage and patterns of the custom The new signature for the def send_message(self, message: str, title: str | None = None, data: dict[str, Any] | None = None) -> None:
"""Send a message."""
...
async def async_send_message(self, message: str, title: str | None = None, data: dict[str, Any] | None = None) -> None:
"""Send a message."""
... Integration we can potentially migrate to use the new notification entities are listed below:
|
Beta Was this translation helpful? Give feedback.
I discussed this proposal today with Martin, Robert and Eric. We agree and we want to move forward. However, we want to move with a small step first to get a feeling for how the architecture will work.
So I think the first step should be to add service entities only for cases where the recipient is fixed. For example, this would allow the mobile app integration to provide a notify entity.
I would not include supported feature support yet and just focus on message for the MVP.
I am writing up a proposal for config subentries (coming soon!), which can function as a contact registry as you described above for integrations like telegram.