1 """Support for Google Assistant SDK broadcast notifications."""
3 from __future__
import annotations
12 from .const
import CONF_LANGUAGE_CODE, DOMAIN
13 from .helpers
import async_send_text_commands, default_language_code
16 LANG_TO_BROADCAST_COMMAND = {
17 "en": (
"broadcast {0}",
"broadcast to {1} {0}"),
19 "Nachricht an alle {0}",
20 "Nachricht an alle an {1} {0}",
22 "es": (
"Anuncia {0}",
"Anuncia en {1} {0}"),
23 "fr": (
"Diffuse {0}",
"Diffuse dans {1} {0}"),
24 "it": (
"Trasmetti a tutti {0}",
"Trasmetti in {1} {0}"),
25 "ja": (
"{0}とブロードキャストして",
"{0}と{1}にブロードキャストして"),
26 "ko": (
"{0} 라고 방송해 줘",
"{0} 라고 {1}에 방송해 줘"),
27 "pt": (
"Transmitir {0}",
"Transmitir {0} para {1}"),
32 """Get the commands for broadcasting a message for the given language code.
34 Return type is a tuple where [0] is for broadcasting to your entire home,
35 while [1] is for broadcasting to a specific target.
37 return LANG_TO_BROADCAST_COMMAND[language_code.split(
"-", maxsplit=1)[0]]
43 discovery_info: DiscoveryInfoType |
None =
None,
44 ) -> BaseNotificationService:
45 """Get the broadcast notification service."""
50 """Implement broadcast notification service."""
52 def __init__(self, hass: HomeAssistant) ->
None:
53 """Initialize the service."""
62 entry: ConfigEntry = self.
hasshass.config_entries.async_entries(DOMAIN)[0]
63 language_code = entry.options.get(
67 commands: list[str] = []
68 targets = kwargs.get(ATTR_TARGET)
None async_send_message(self, str message="", **Any kwargs)
None __init__(self, HomeAssistant hass)
list[CommandResponse] async_send_text_commands(HomeAssistant hass, list[str] commands, list[str]|None media_players=None)
str default_language_code(HomeAssistant hass)
tuple[str, str] broadcast_commands(str language_code)
BaseNotificationService async_get_service(HomeAssistant hass, ConfigType config, DiscoveryInfoType|None discovery_info=None)