mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
Use the action field enums in pushover (#196069)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user