mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Use the action field enums in google_mail (#195725)
This commit is contained in:
@@ -8,11 +8,9 @@ from typing import Any, override
|
||||
from googleapiclient.http import HttpRequest
|
||||
|
||||
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 ServiceValidationError
|
||||
@@ -50,11 +48,11 @@ class GMailNotificationService(BaseNotificationService):
|
||||
@override
|
||||
async def async_send_message(self, message: str, **kwargs: Any) -> None:
|
||||
"""Send a message."""
|
||||
data: dict[str, Any] = kwargs.get(ATTR_DATA) or {}
|
||||
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
||||
data: dict[str, Any] = kwargs.get(NotifyServiceArgument.DATA) or {}
|
||||
title = kwargs.get(NotifyServiceArgument.TITLE, ATTR_TITLE_DEFAULT)
|
||||
|
||||
email = MIMEText(message, "html")
|
||||
if to_addrs := kwargs.get(ATTR_TARGET):
|
||||
if to_addrs := kwargs.get(NotifyServiceArgument.TARGET):
|
||||
email["To"] = ", ".join(to_addrs)
|
||||
|
||||
email_from = data.get(ATTR_FROM, ATTR_ME)
|
||||
|
||||
Reference in New Issue
Block a user