2017-05-02 16:18:47 +00:00
|
|
|
"""Typing Helpers for Home Assistant."""
|
2020-12-19 11:46:27 +00:00
|
|
|
from enum import Enum
|
2020-09-10 18:41:42 +00:00
|
|
|
from typing import Any, Dict, Mapping, Optional, Tuple, Union
|
2016-07-31 20:56:57 +00:00
|
|
|
|
2016-08-30 16:22:52 +00:00
|
|
|
import homeassistant.core
|
2016-08-07 23:26:35 +00:00
|
|
|
|
2016-08-30 16:22:52 +00:00
|
|
|
GPSType = Tuple[float, float]
|
|
|
|
ConfigType = Dict[str, Any]
|
2019-06-14 22:48:21 +00:00
|
|
|
ContextType = homeassistant.core.Context
|
2020-03-18 17:27:25 +00:00
|
|
|
DiscoveryInfoType = Dict[str, Any]
|
2019-04-19 21:54:48 +00:00
|
|
|
EventType = homeassistant.core.Event
|
2016-08-30 16:22:52 +00:00
|
|
|
HomeAssistantType = homeassistant.core.HomeAssistant
|
2019-06-14 22:48:21 +00:00
|
|
|
ServiceCallType = homeassistant.core.ServiceCall
|
2018-02-28 21:59:14 +00:00
|
|
|
ServiceDataType = Dict[str, Any]
|
2020-08-17 19:02:43 +00:00
|
|
|
StateType = Union[None, str, int, float]
|
2020-09-10 18:41:42 +00:00
|
|
|
TemplateVarsType = Optional[Mapping[str, Any]]
|
2016-07-31 20:56:57 +00:00
|
|
|
|
2016-08-30 16:22:52 +00:00
|
|
|
# Custom type for recorder Queries
|
|
|
|
QueryType = Any
|
2020-12-19 11:46:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
class UndefinedType(Enum):
|
|
|
|
"""Singleton type for use with not set sentinel values."""
|
|
|
|
|
|
|
|
_singleton = 0
|
|
|
|
|
|
|
|
|
|
|
|
UNDEFINED = UndefinedType._singleton # pylint: disable=protected-access
|