Compare commits
7 Commits
01e84c8b59
...
ebfdedff9d
Author | SHA1 | Date |
---|---|---|
dependabot[bot] | ebfdedff9d | |
dependabot[bot] | ab390acf93 | |
github-actions[bot] | 1c4d7a60bb | |
David Friedland | f1538a7ed0 | |
github-actions[bot] | e88f1468cb | |
Jesse Hills | 397c64f3e3 | |
dependabot[bot] | 88a8191545 |
|
@ -89,7 +89,7 @@ jobs:
|
|||
- run: pytest -vv --cov=aioesphomeapi --cov-report=xml --tb=native tests
|
||||
name: Run tests with pytest
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
- run: |
|
||||
docker run \
|
||||
-v "$PWD":/aioesphomeapi \
|
||||
|
|
|
@ -1721,6 +1721,33 @@ message TimeCommandRequest {
|
|||
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;
|
||||
}
|
||||
|
||||
// ==================== VALVE ====================
|
||||
message ListEntitiesValveResponse {
|
||||
option (id) = 109;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -46,6 +46,7 @@ from .api_pb2 import ( # type: ignore
|
|||
DeviceInfoResponse,
|
||||
DisconnectRequest,
|
||||
DisconnectResponse,
|
||||
EventResponse,
|
||||
ExecuteServiceRequest,
|
||||
FanCommandRequest,
|
||||
FanStateResponse,
|
||||
|
@ -66,6 +67,7 @@ from .api_pb2 import ( # type: ignore
|
|||
ListEntitiesDateResponse,
|
||||
ListEntitiesDateTimeResponse,
|
||||
ListEntitiesDoneResponse,
|
||||
ListEntitiesEventResponse,
|
||||
ListEntitiesFanResponse,
|
||||
ListEntitiesLightResponse,
|
||||
ListEntitiesLockResponse,
|
||||
|
@ -374,6 +376,8 @@ MESSAGE_TYPE_TO_PROTO = {
|
|||
104: TimeStateResponse,
|
||||
105: TimeCommandRequest,
|
||||
106: VoiceAssistantAudio,
|
||||
107: ListEntitiesEventResponse,
|
||||
108: EventResponse,
|
||||
109: ListEntitiesValveResponse,
|
||||
110: ValveStateResponse,
|
||||
111: ValveCommandRequest,
|
||||
|
|
|
@ -262,6 +262,18 @@ class CoverState(EntityState):
|
|||
return self.position == 0.0
|
||||
|
||||
|
||||
# ==================== EVENT ==================
|
||||
@_frozen_dataclass_decorator
|
||||
class EventInfo(EntityInfo):
|
||||
device_class: str = ""
|
||||
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):
|
||||
|
@ -907,6 +919,7 @@ COMPONENT_TYPE_TO_INFO: dict[str, type[EntityInfo]] = {
|
|||
"text": TextInfo,
|
||||
"time": TimeInfo,
|
||||
"valve": ValveInfo,
|
||||
"event": EventInfo,
|
||||
}
|
||||
|
||||
|
||||
|
@ -1269,6 +1282,7 @@ _TYPE_TO_NAME = {
|
|||
TextInfo: "text_info",
|
||||
TimeInfo: "time",
|
||||
ValveInfo: "valve",
|
||||
EventInfo: "event",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ from .api_pb2 import ( # type: ignore
|
|||
CoverStateResponse,
|
||||
DateStateResponse,
|
||||
DateTimeStateResponse,
|
||||
EventResponse,
|
||||
FanStateResponse,
|
||||
LightStateResponse,
|
||||
ListEntitiesAlarmControlPanelResponse,
|
||||
|
@ -19,6 +20,7 @@ from .api_pb2 import ( # type: ignore
|
|||
ListEntitiesCoverResponse,
|
||||
ListEntitiesDateResponse,
|
||||
ListEntitiesDateTimeResponse,
|
||||
ListEntitiesEventResponse,
|
||||
ListEntitiesFanResponse,
|
||||
ListEntitiesLightResponse,
|
||||
ListEntitiesLockResponse,
|
||||
|
@ -62,6 +64,8 @@ from .model import (
|
|||
DateTimeState,
|
||||
EntityInfo,
|
||||
EntityState,
|
||||
Event,
|
||||
EventInfo,
|
||||
FanInfo,
|
||||
FanState,
|
||||
LightInfo,
|
||||
|
@ -91,48 +95,50 @@ from .model import (
|
|||
)
|
||||
|
||||
SUBSCRIBE_STATES_RESPONSE_TYPES: dict[Any, type[EntityState]] = {
|
||||
AlarmControlPanelStateResponse: AlarmControlPanelEntityState,
|
||||
BinarySensorStateResponse: BinarySensorState,
|
||||
ClimateStateResponse: ClimateState,
|
||||
CoverStateResponse: CoverState,
|
||||
FanStateResponse: FanState,
|
||||
LightStateResponse: LightState,
|
||||
NumberStateResponse: NumberState,
|
||||
DateStateResponse: DateState,
|
||||
DateTimeStateResponse: DateTimeState,
|
||||
EventResponse: Event,
|
||||
FanStateResponse: FanState,
|
||||
LightStateResponse: LightState,
|
||||
LockStateResponse: LockEntityState,
|
||||
MediaPlayerStateResponse: MediaPlayerEntityState,
|
||||
NumberStateResponse: NumberState,
|
||||
SelectStateResponse: SelectState,
|
||||
SensorStateResponse: SensorState,
|
||||
SirenStateResponse: SirenState,
|
||||
SwitchStateResponse: SwitchState,
|
||||
TextStateResponse: TextState,
|
||||
TextSensorStateResponse: TextSensorState,
|
||||
ClimateStateResponse: ClimateState,
|
||||
LockStateResponse: LockEntityState,
|
||||
MediaPlayerStateResponse: MediaPlayerEntityState,
|
||||
AlarmControlPanelStateResponse: AlarmControlPanelEntityState,
|
||||
TextStateResponse: TextState,
|
||||
TimeStateResponse: TimeState,
|
||||
ValveStateResponse: ValveState,
|
||||
}
|
||||
|
||||
LIST_ENTITIES_SERVICES_RESPONSE_TYPES: dict[Any, type[EntityInfo] | None] = {
|
||||
ListEntitiesAlarmControlPanelResponse: AlarmControlPanelInfo,
|
||||
ListEntitiesBinarySensorResponse: BinarySensorInfo,
|
||||
ListEntitiesButtonResponse: ButtonInfo,
|
||||
ListEntitiesCameraResponse: CameraInfo,
|
||||
ListEntitiesClimateResponse: ClimateInfo,
|
||||
ListEntitiesCoverResponse: CoverInfo,
|
||||
ListEntitiesFanResponse: FanInfo,
|
||||
ListEntitiesLightResponse: LightInfo,
|
||||
ListEntitiesNumberResponse: NumberInfo,
|
||||
ListEntitiesDateResponse: DateInfo,
|
||||
ListEntitiesDateTimeResponse: DateTimeInfo,
|
||||
ListEntitiesEventResponse: EventInfo,
|
||||
ListEntitiesFanResponse: FanInfo,
|
||||
ListEntitiesLightResponse: LightInfo,
|
||||
ListEntitiesLockResponse: LockInfo,
|
||||
ListEntitiesMediaPlayerResponse: MediaPlayerInfo,
|
||||
ListEntitiesNumberResponse: NumberInfo,
|
||||
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,
|
||||
ListEntitiesValveResponse: ValveInfo,
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ black==24.4.0
|
|||
flake8==7.0.0
|
||||
isort==5.13.2
|
||||
mypy==1.9.0
|
||||
types-protobuf==4.25.0.20240417
|
||||
types-protobuf==5.26.0.20240422
|
||||
pytest>=6.2.4,<9
|
||||
pytest-asyncio==0.23.6
|
||||
mock>=4.0.3,<6
|
||||
|
|
2
setup.py
2
setup.py
|
@ -11,7 +11,7 @@ with open(os.path.join(here, "README.rst"), encoding="utf-8") as readme_file:
|
|||
long_description = readme_file.read()
|
||||
|
||||
|
||||
VERSION = "24.2.0"
|
||||
VERSION = "24.3.0"
|
||||
PROJECT_NAME = "aioesphomeapi"
|
||||
PROJECT_PACKAGE_NAME = "aioesphomeapi"
|
||||
PROJECT_LICENSE = "MIT"
|
||||
|
|
|
@ -16,6 +16,7 @@ from aioesphomeapi.api_pb2 import (
|
|||
DateStateResponse,
|
||||
DateTimeStateResponse,
|
||||
DeviceInfoResponse,
|
||||
EventResponse,
|
||||
FanStateResponse,
|
||||
HomeassistantServiceMap,
|
||||
HomeassistantServiceResponse,
|
||||
|
@ -27,6 +28,7 @@ from aioesphomeapi.api_pb2 import (
|
|||
ListEntitiesCoverResponse,
|
||||
ListEntitiesDateResponse,
|
||||
ListEntitiesDateTimeResponse,
|
||||
ListEntitiesEventResponse,
|
||||
ListEntitiesFanResponse,
|
||||
ListEntitiesLightResponse,
|
||||
ListEntitiesLockResponse,
|
||||
|
@ -82,6 +84,8 @@ from aioesphomeapi.model import (
|
|||
DateTimeInfo,
|
||||
DateTimeState,
|
||||
DeviceInfo,
|
||||
Event,
|
||||
EventInfo,
|
||||
FanInfo,
|
||||
FanState,
|
||||
HomeassistantServiceCall,
|
||||
|
@ -280,6 +284,8 @@ def test_api_version_ord():
|
|||
(TimeState, TimeStateResponse),
|
||||
(DateTimeInfo, ListEntitiesDateTimeResponse),
|
||||
(DateTimeState, DateTimeStateResponse),
|
||||
(EventInfo, ListEntitiesEventResponse),
|
||||
(Event, EventResponse),
|
||||
],
|
||||
)
|
||||
def test_basic_pb_conversions(model, pb):
|
||||
|
|
Loading…
Reference in New Issue