Skip to content

Commit 424e0a7

Browse files
authored
Merge pull request #2363 from AppDaemon:notify-kwargs
passing thru kwargs to notify service
2 parents 5705c80 + 5d022b7 commit 424e0a7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

appdaemon/plugins/hass/hassapi.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,9 +1017,10 @@ def time_since_last_press(self, button_id: str, namespace: str | None = None) ->
10171017
async def notify(
10181018
self,
10191019
message: str,
1020-
title: str = None,
1021-
name: str = None,
1020+
title: str | None = None,
1021+
name: str | None = None,
10221022
namespace: str | None = None,
1023+
**kwargs: Any,
10231024
) -> None:
10241025
"""Sends a notification.
10251026
@@ -1032,8 +1033,8 @@ async def notify(
10321033
title (str, optional): Title of the notification.
10331034
name (str, optional): Name of the notification service.
10341035
namespace (str, optional): Namespace to use for the call. See the section on
1035-
`namespaces <APPGUIDE.html#namespaces>`__ for a detailed description.
1036-
In most cases it is safe to ignore this parameter.
1036+
`namespaces <APPGUIDE.html#namespaces>`__ for a detailed description. In most cases it is safe to ignore
1037+
this parameter.
10371038
10381039
Returns:
10391040
Result of the `notify` function if any, see `service call notes
@@ -1045,11 +1046,13 @@ async def notify(
10451046
# will send a message through notify.smtp instead of the default notify.notify
10461047
10471048
"""
1049+
service = f'notify/{name}' if name is not None else 'notify/notify'
10481050
return await self.call_service(
1049-
service=f'notify/{name}' if name is not None else 'notify/notify',
1050-
namespace=namespace,
1051-
title=title,
1051+
service=service,
10521052
message=message,
1053+
title=title,
1054+
namespace=namespace,
1055+
**kwargs,
10531056
)
10541057

10551058
@utils.sync_decorator

0 commit comments

Comments
 (0)