Use the action field enums in google_mail (#195725)

This commit is contained in:
epenet
2026-12-01 06:52:55 +00:00
committed by GitHub
parent b04055d41e
commit 327cd5711b
@@ -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)