Compare commits
2 Commits
ec377c290c
...
156762bca9
Author | SHA1 | Date |
---|---|---|
Jesse Hills | 156762bca9 | |
David Friedland | 26d8e616bb |
|
@ -1718,3 +1718,29 @@ message TimeCommandRequest {
|
|||
uint32 minute = 3;
|
||||
uint32 second = 4;
|
||||
}
|
||||
|
||||
// ==================== EVENT ====================
|
||||
message ListEntitiesEventResponse {
|
||||
option (id) = 107;
|
||||
option (source) = SOURCE_SERVER;
|
||||
option (ifdef) = "USE_EVENT";
|
||||
|
||||
string object_id = 1;
|
||||
fixed32 key = 2;
|
||||
string name = 3;
|
||||
string unique_id = 4;
|
||||
|
||||
string icon = 5;
|
||||
bool disabled_by_default = 6;
|
||||
EntityCategory entity_category = 7;
|
||||
string device_class = 8;
|
||||
repeated string event_types = 9;
|
||||
}
|
||||
message EventResponse {
|
||||
option (id) = 108;
|
||||
option (source) = SOURCE_SERVER;
|
||||
option (ifdef) = "USE_EVENT";
|
||||
|
||||
fixed32 key = 1;
|
||||
string event_type = 2;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -44,6 +44,7 @@ from .api_pb2 import ( # type: ignore
|
|||
DeviceInfoResponse,
|
||||
DisconnectRequest,
|
||||
DisconnectResponse,
|
||||
EventResponse,
|
||||
ExecuteServiceRequest,
|
||||
FanCommandRequest,
|
||||
FanStateResponse,
|
||||
|
@ -63,6 +64,7 @@ from .api_pb2 import ( # type: ignore
|
|||
ListEntitiesCoverResponse,
|
||||
ListEntitiesDateResponse,
|
||||
ListEntitiesDoneResponse,
|
||||
ListEntitiesEventResponse,
|
||||
ListEntitiesFanResponse,
|
||||
ListEntitiesLightResponse,
|
||||
ListEntitiesLockResponse,
|
||||
|
@ -368,4 +370,6 @@ MESSAGE_TYPE_TO_PROTO = {
|
|||
104: TimeStateResponse,
|
||||
105: TimeCommandRequest,
|
||||
106: VoiceAssistantAudio,
|
||||
107: ListEntitiesEventResponse,
|
||||
108: EventResponse,
|
||||
}
|
||||
|
|
|
@ -262,6 +262,17 @@ class CoverState(EntityState):
|
|||
return self.position == 0.0
|
||||
|
||||
|
||||
# ==================== EVENT ==================
|
||||
@_frozen_dataclass_decorator
|
||||
class EventInfo(EntityInfo):
|
||||
event_types: list[str] = converter_field(default_factory=list, converter=list)
|
||||
|
||||
|
||||
@_frozen_dataclass_decorator
|
||||
class Event(EntityState):
|
||||
event_type: str = ""
|
||||
|
||||
|
||||
# ==================== FAN ====================
|
||||
@_frozen_dataclass_decorator
|
||||
class FanInfo(EntityInfo):
|
||||
|
@ -868,6 +879,7 @@ COMPONENT_TYPE_TO_INFO: dict[str, type[EntityInfo]] = {
|
|||
"alarm_control_panel": AlarmControlPanelInfo,
|
||||
"text": TextInfo,
|
||||
"time": TimeInfo,
|
||||
"event": EventInfo,
|
||||
}
|
||||
|
||||
|
||||
|
@ -1228,6 +1240,7 @@ _TYPE_TO_NAME = {
|
|||
AlarmControlPanelInfo: "alarm_control_panel",
|
||||
TextInfo: "text_info",
|
||||
TimeInfo: "time",
|
||||
EventInfo: "event",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ from .api_pb2 import ( # type: ignore
|
|||
ClimateStateResponse,
|
||||
CoverStateResponse,
|
||||
DateStateResponse,
|
||||
EventResponse,
|
||||
FanStateResponse,
|
||||
LightStateResponse,
|
||||
ListEntitiesAlarmControlPanelResponse,
|
||||
|
@ -17,6 +18,7 @@ from .api_pb2 import ( # type: ignore
|
|||
ListEntitiesClimateResponse,
|
||||
ListEntitiesCoverResponse,
|
||||
ListEntitiesDateResponse,
|
||||
ListEntitiesEventResponse,
|
||||
ListEntitiesFanResponse,
|
||||
ListEntitiesLightResponse,
|
||||
ListEntitiesLockResponse,
|
||||
|
@ -56,6 +58,8 @@ from .model import (
|
|||
DateState,
|
||||
EntityInfo,
|
||||
EntityState,
|
||||
Event,
|
||||
EventInfo,
|
||||
FanInfo,
|
||||
FanState,
|
||||
LightInfo,
|
||||
|
@ -83,44 +87,46 @@ from .model import (
|
|||
)
|
||||
|
||||
SUBSCRIBE_STATES_RESPONSE_TYPES: dict[Any, type[EntityState]] = {
|
||||
AlarmControlPanelStateResponse: AlarmControlPanelEntityState,
|
||||
BinarySensorStateResponse: BinarySensorState,
|
||||
ClimateStateResponse: ClimateState,
|
||||
CoverStateResponse: CoverState,
|
||||
DateStateResponse: DateState,
|
||||
EventResponse: Event,
|
||||
FanStateResponse: FanState,
|
||||
LightStateResponse: LightState,
|
||||
LockStateResponse: LockEntityState,
|
||||
MediaPlayerStateResponse: MediaPlayerEntityState,
|
||||
NumberStateResponse: NumberState,
|
||||
DateStateResponse: DateState,
|
||||
SelectStateResponse: SelectState,
|
||||
SensorStateResponse: SensorState,
|
||||
SirenStateResponse: SirenState,
|
||||
SwitchStateResponse: SwitchState,
|
||||
TextStateResponse: TextState,
|
||||
TextSensorStateResponse: TextSensorState,
|
||||
ClimateStateResponse: ClimateState,
|
||||
LockStateResponse: LockEntityState,
|
||||
MediaPlayerStateResponse: MediaPlayerEntityState,
|
||||
AlarmControlPanelStateResponse: AlarmControlPanelEntityState,
|
||||
TextStateResponse: TextState,
|
||||
TimeStateResponse: TimeState,
|
||||
}
|
||||
|
||||
LIST_ENTITIES_SERVICES_RESPONSE_TYPES: dict[Any, type[EntityInfo] | None] = {
|
||||
ListEntitiesAlarmControlPanelResponse: AlarmControlPanelInfo,
|
||||
ListEntitiesBinarySensorResponse: BinarySensorInfo,
|
||||
ListEntitiesButtonResponse: ButtonInfo,
|
||||
ListEntitiesCameraResponse: CameraInfo,
|
||||
ListEntitiesClimateResponse: ClimateInfo,
|
||||
ListEntitiesCoverResponse: CoverInfo,
|
||||
ListEntitiesDateResponse: DateInfo,
|
||||
ListEntitiesEventResponse: EventInfo,
|
||||
ListEntitiesFanResponse: FanInfo,
|
||||
ListEntitiesLightResponse: LightInfo,
|
||||
ListEntitiesLockResponse: LockInfo,
|
||||
ListEntitiesMediaPlayerResponse: MediaPlayerInfo,
|
||||
ListEntitiesNumberResponse: NumberInfo,
|
||||
ListEntitiesDateResponse: DateInfo,
|
||||
ListEntitiesSelectResponse: SelectInfo,
|
||||
ListEntitiesSensorResponse: SensorInfo,
|
||||
ListEntitiesServicesResponse: None,
|
||||
ListEntitiesSirenResponse: SirenInfo,
|
||||
ListEntitiesSwitchResponse: SwitchInfo,
|
||||
ListEntitiesTextResponse: TextInfo,
|
||||
ListEntitiesTextSensorResponse: TextSensorInfo,
|
||||
ListEntitiesServicesResponse: None,
|
||||
ListEntitiesCameraResponse: CameraInfo,
|
||||
ListEntitiesClimateResponse: ClimateInfo,
|
||||
ListEntitiesLockResponse: LockInfo,
|
||||
ListEntitiesMediaPlayerResponse: MediaPlayerInfo,
|
||||
ListEntitiesAlarmControlPanelResponse: AlarmControlPanelInfo,
|
||||
ListEntitiesTimeResponse: TimeInfo,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue