Use the action field enums in pushover (#196069)

This commit is contained in:
epenet
2026-12-02 16:13:43 +01:00
committed by GitHub
parent 85f5411fbb
commit 4bdddd7eb3
+4 -6
View File
@@ -6,11 +6,9 @@ from typing import TYPE_CHECKING, Any, override
from pushover_complete import BadAPIRequestError, PushoverAPI
from homeassistant.components.notify import (
ATTR_DATA,
ATTR_TARGET,
ATTR_TITLE,
ATTR_TITLE_DEFAULT,
BaseNotificationService,
NotifyServiceArgument,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
@@ -79,8 +77,8 @@ class PushoverNotificationService(BaseNotificationService):
"""Send a message to a user."""
# Extract params from data dict
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
data = kwargs.get(ATTR_DATA) or {}
title = kwargs.get(NotifyServiceArgument.TITLE, ATTR_TITLE_DEFAULT)
data = kwargs.get(NotifyServiceArgument.DATA) or {}
url = data.get(ATTR_URL)
url_title = data.get(ATTR_URL_TITLE)
priority = data.get(ATTR_PRIORITY)
@@ -117,7 +115,7 @@ class PushoverNotificationService(BaseNotificationService):
result = self.pushover.send_message(
user=self._user_key,
message=message,
device=",".join(kwargs.get(ATTR_TARGET, [])),
device=",".join(kwargs.get(NotifyServiceArgument.TARGET, [])),
title=title,
url=url,
url_title=url_title,