Home Assistant Unofficial Reference 2024.12.1
const.py
Go to the documentation of this file.
1 """Consts for Cast integration."""
2 
3 from __future__ import annotations
4 
5 from typing import TYPE_CHECKING, TypedDict
6 
7 from homeassistant.util.signal_type import SignalType
8 
9 if TYPE_CHECKING:
10  from .helpers import ChromecastInfo
11 
12 
13 DOMAIN = "cast"
14 
15 # Stores a threading.Lock that is held by the internal pychromecast discovery.
16 INTERNAL_DISCOVERY_RUNNING_KEY = "cast_discovery_running"
17 # Stores UUIDs of cast devices that were added as entities. Doesn't store
18 # None UUIDs.
19 ADDED_CAST_DEVICES_KEY = "cast_added_cast_devices"
20 # Stores an audio group manager.
21 CAST_MULTIZONE_MANAGER_KEY = "cast_multizone_manager"
22 # Store a CastBrowser
23 CAST_BROWSER_KEY = "cast_browser"
24 
25 # Dispatcher signal fired with a ChromecastInfo every time we discover a new
26 # Chromecast or receive it through configuration
27 SIGNAL_CAST_DISCOVERED: SignalType[ChromecastInfo] = SignalType("cast_discovered")
28 
29 # Dispatcher signal fired with a ChromecastInfo every time a Chromecast is
30 # removed
31 SIGNAL_CAST_REMOVED: SignalType[ChromecastInfo] = SignalType("cast_removed")
32 
33 # Dispatcher signal fired when a Chromecast should show a Home Assistant Cast view.
34 SIGNAL_HASS_CAST_SHOW_VIEW: SignalType[
35  HomeAssistantControllerData, str, str, str | None
36 ] = SignalType("cast_show_view")
37 
38 CONF_IGNORE_CEC = "ignore_cec"
39 CONF_KNOWN_HOSTS = "known_hosts"
40 
41 
42 class HomeAssistantControllerData(TypedDict):
43  """Data for creating a HomeAssistantController."""
44 
45  hass_url: str
46  hass_uuid: str
47  client_id: str | None
48  refresh_token: str