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
|
- run: pytest -vv --cov=aioesphomeapi --cov-report=xml --tb=native tests
|
||||||
name: Run tests with pytest
|
name: Run tests with pytest
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v4
|
||||||
- run: |
|
- run: |
|
||||||
docker run \
|
docker run \
|
||||||
-v "$PWD":/aioesphomeapi \
|
-v "$PWD":/aioesphomeapi \
|
||||||
|
|
|
@ -1721,6 +1721,33 @@ message TimeCommandRequest {
|
||||||
uint32 second = 4;
|
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 ====================
|
// ==================== VALVE ====================
|
||||||
message ListEntitiesValveResponse {
|
message ListEntitiesValveResponse {
|
||||||
option (id) = 109;
|
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,
|
DeviceInfoResponse,
|
||||||
DisconnectRequest,
|
DisconnectRequest,
|
||||||
DisconnectResponse,
|
DisconnectResponse,
|
||||||
|
EventResponse,
|
||||||
ExecuteServiceRequest,
|
ExecuteServiceRequest,
|
||||||
FanCommandRequest,
|
FanCommandRequest,
|
||||||
FanStateResponse,
|
FanStateResponse,
|
||||||
|
@ -66,6 +67,7 @@ from .api_pb2 import ( # type: ignore
|
||||||
ListEntitiesDateResponse,
|
ListEntitiesDateResponse,
|
||||||
ListEntitiesDateTimeResponse,
|
ListEntitiesDateTimeResponse,
|
||||||
ListEntitiesDoneResponse,
|
ListEntitiesDoneResponse,
|
||||||
|
ListEntitiesEventResponse,
|
||||||
ListEntitiesFanResponse,
|
ListEntitiesFanResponse,
|
||||||
ListEntitiesLightResponse,
|
ListEntitiesLightResponse,
|
||||||
ListEntitiesLockResponse,
|
ListEntitiesLockResponse,
|
||||||
|
@ -374,6 +376,8 @@ MESSAGE_TYPE_TO_PROTO = {
|
||||||
104: TimeStateResponse,
|
104: TimeStateResponse,
|
||||||
105: TimeCommandRequest,
|
105: TimeCommandRequest,
|
||||||
106: VoiceAssistantAudio,
|
106: VoiceAssistantAudio,
|
||||||
|
107: ListEntitiesEventResponse,
|
||||||
|
108: EventResponse,
|
||||||
109: ListEntitiesValveResponse,
|
109: ListEntitiesValveResponse,
|
||||||
110: ValveStateResponse,
|
110: ValveStateResponse,
|
||||||
111: ValveCommandRequest,
|
111: ValveCommandRequest,
|
||||||
|
|
|
@ -262,6 +262,18 @@ class CoverState(EntityState):
|
||||||
return self.position == 0.0
|
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 ====================
|
# ==================== FAN ====================
|
||||||
@_frozen_dataclass_decorator
|
@_frozen_dataclass_decorator
|
||||||
class FanInfo(EntityInfo):
|
class FanInfo(EntityInfo):
|
||||||
|
@ -907,6 +919,7 @@ COMPONENT_TYPE_TO_INFO: dict[str, type[EntityInfo]] = {
|
||||||
"text": TextInfo,
|
"text": TextInfo,
|
||||||
"time": TimeInfo,
|
"time": TimeInfo,
|
||||||
"valve": ValveInfo,
|
"valve": ValveInfo,
|
||||||
|
"event": EventInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1269,6 +1282,7 @@ _TYPE_TO_NAME = {
|
||||||
TextInfo: "text_info",
|
TextInfo: "text_info",
|
||||||
TimeInfo: "time",
|
TimeInfo: "time",
|
||||||
ValveInfo: "valve",
|
ValveInfo: "valve",
|
||||||
|
EventInfo: "event",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ from .api_pb2 import ( # type: ignore
|
||||||
CoverStateResponse,
|
CoverStateResponse,
|
||||||
DateStateResponse,
|
DateStateResponse,
|
||||||
DateTimeStateResponse,
|
DateTimeStateResponse,
|
||||||
|
EventResponse,
|
||||||
FanStateResponse,
|
FanStateResponse,
|
||||||
LightStateResponse,
|
LightStateResponse,
|
||||||
ListEntitiesAlarmControlPanelResponse,
|
ListEntitiesAlarmControlPanelResponse,
|
||||||
|
@ -19,6 +20,7 @@ from .api_pb2 import ( # type: ignore
|
||||||
ListEntitiesCoverResponse,
|
ListEntitiesCoverResponse,
|
||||||
ListEntitiesDateResponse,
|
ListEntitiesDateResponse,
|
||||||
ListEntitiesDateTimeResponse,
|
ListEntitiesDateTimeResponse,
|
||||||
|
ListEntitiesEventResponse,
|
||||||
ListEntitiesFanResponse,
|
ListEntitiesFanResponse,
|
||||||
ListEntitiesLightResponse,
|
ListEntitiesLightResponse,
|
||||||
ListEntitiesLockResponse,
|
ListEntitiesLockResponse,
|
||||||
|
@ -62,6 +64,8 @@ from .model import (
|
||||||
DateTimeState,
|
DateTimeState,
|
||||||
EntityInfo,
|
EntityInfo,
|
||||||
EntityState,
|
EntityState,
|
||||||
|
Event,
|
||||||
|
EventInfo,
|
||||||
FanInfo,
|
FanInfo,
|
||||||
FanState,
|
FanState,
|
||||||
LightInfo,
|
LightInfo,
|
||||||
|
@ -91,48 +95,50 @@ from .model import (
|
||||||
)
|
)
|
||||||
|
|
||||||
SUBSCRIBE_STATES_RESPONSE_TYPES: dict[Any, type[EntityState]] = {
|
SUBSCRIBE_STATES_RESPONSE_TYPES: dict[Any, type[EntityState]] = {
|
||||||
|
AlarmControlPanelStateResponse: AlarmControlPanelEntityState,
|
||||||
BinarySensorStateResponse: BinarySensorState,
|
BinarySensorStateResponse: BinarySensorState,
|
||||||
|
ClimateStateResponse: ClimateState,
|
||||||
CoverStateResponse: CoverState,
|
CoverStateResponse: CoverState,
|
||||||
FanStateResponse: FanState,
|
|
||||||
LightStateResponse: LightState,
|
|
||||||
NumberStateResponse: NumberState,
|
|
||||||
DateStateResponse: DateState,
|
DateStateResponse: DateState,
|
||||||
DateTimeStateResponse: DateTimeState,
|
DateTimeStateResponse: DateTimeState,
|
||||||
|
EventResponse: Event,
|
||||||
|
FanStateResponse: FanState,
|
||||||
|
LightStateResponse: LightState,
|
||||||
|
LockStateResponse: LockEntityState,
|
||||||
|
MediaPlayerStateResponse: MediaPlayerEntityState,
|
||||||
|
NumberStateResponse: NumberState,
|
||||||
SelectStateResponse: SelectState,
|
SelectStateResponse: SelectState,
|
||||||
SensorStateResponse: SensorState,
|
SensorStateResponse: SensorState,
|
||||||
SirenStateResponse: SirenState,
|
SirenStateResponse: SirenState,
|
||||||
SwitchStateResponse: SwitchState,
|
SwitchStateResponse: SwitchState,
|
||||||
TextStateResponse: TextState,
|
|
||||||
TextSensorStateResponse: TextSensorState,
|
TextSensorStateResponse: TextSensorState,
|
||||||
ClimateStateResponse: ClimateState,
|
TextStateResponse: TextState,
|
||||||
LockStateResponse: LockEntityState,
|
|
||||||
MediaPlayerStateResponse: MediaPlayerEntityState,
|
|
||||||
AlarmControlPanelStateResponse: AlarmControlPanelEntityState,
|
|
||||||
TimeStateResponse: TimeState,
|
TimeStateResponse: TimeState,
|
||||||
ValveStateResponse: ValveState,
|
ValveStateResponse: ValveState,
|
||||||
}
|
}
|
||||||
|
|
||||||
LIST_ENTITIES_SERVICES_RESPONSE_TYPES: dict[Any, type[EntityInfo] | None] = {
|
LIST_ENTITIES_SERVICES_RESPONSE_TYPES: dict[Any, type[EntityInfo] | None] = {
|
||||||
|
ListEntitiesAlarmControlPanelResponse: AlarmControlPanelInfo,
|
||||||
ListEntitiesBinarySensorResponse: BinarySensorInfo,
|
ListEntitiesBinarySensorResponse: BinarySensorInfo,
|
||||||
ListEntitiesButtonResponse: ButtonInfo,
|
ListEntitiesButtonResponse: ButtonInfo,
|
||||||
|
ListEntitiesCameraResponse: CameraInfo,
|
||||||
|
ListEntitiesClimateResponse: ClimateInfo,
|
||||||
ListEntitiesCoverResponse: CoverInfo,
|
ListEntitiesCoverResponse: CoverInfo,
|
||||||
ListEntitiesFanResponse: FanInfo,
|
|
||||||
ListEntitiesLightResponse: LightInfo,
|
|
||||||
ListEntitiesNumberResponse: NumberInfo,
|
|
||||||
ListEntitiesDateResponse: DateInfo,
|
ListEntitiesDateResponse: DateInfo,
|
||||||
ListEntitiesDateTimeResponse: DateTimeInfo,
|
ListEntitiesDateTimeResponse: DateTimeInfo,
|
||||||
|
ListEntitiesEventResponse: EventInfo,
|
||||||
|
ListEntitiesFanResponse: FanInfo,
|
||||||
|
ListEntitiesLightResponse: LightInfo,
|
||||||
|
ListEntitiesLockResponse: LockInfo,
|
||||||
|
ListEntitiesMediaPlayerResponse: MediaPlayerInfo,
|
||||||
|
ListEntitiesNumberResponse: NumberInfo,
|
||||||
ListEntitiesSelectResponse: SelectInfo,
|
ListEntitiesSelectResponse: SelectInfo,
|
||||||
ListEntitiesSensorResponse: SensorInfo,
|
ListEntitiesSensorResponse: SensorInfo,
|
||||||
|
ListEntitiesServicesResponse: None,
|
||||||
ListEntitiesSirenResponse: SirenInfo,
|
ListEntitiesSirenResponse: SirenInfo,
|
||||||
ListEntitiesSwitchResponse: SwitchInfo,
|
ListEntitiesSwitchResponse: SwitchInfo,
|
||||||
ListEntitiesTextResponse: TextInfo,
|
ListEntitiesTextResponse: TextInfo,
|
||||||
ListEntitiesTextSensorResponse: TextSensorInfo,
|
ListEntitiesTextSensorResponse: TextSensorInfo,
|
||||||
ListEntitiesServicesResponse: None,
|
|
||||||
ListEntitiesCameraResponse: CameraInfo,
|
|
||||||
ListEntitiesClimateResponse: ClimateInfo,
|
|
||||||
ListEntitiesLockResponse: LockInfo,
|
|
||||||
ListEntitiesMediaPlayerResponse: MediaPlayerInfo,
|
|
||||||
ListEntitiesAlarmControlPanelResponse: AlarmControlPanelInfo,
|
|
||||||
ListEntitiesTimeResponse: TimeInfo,
|
ListEntitiesTimeResponse: TimeInfo,
|
||||||
ListEntitiesValveResponse: ValveInfo,
|
ListEntitiesValveResponse: ValveInfo,
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ black==24.4.0
|
||||||
flake8==7.0.0
|
flake8==7.0.0
|
||||||
isort==5.13.2
|
isort==5.13.2
|
||||||
mypy==1.9.0
|
mypy==1.9.0
|
||||||
types-protobuf==4.25.0.20240417
|
types-protobuf==5.26.0.20240422
|
||||||
pytest>=6.2.4,<9
|
pytest>=6.2.4,<9
|
||||||
pytest-asyncio==0.23.6
|
pytest-asyncio==0.23.6
|
||||||
mock>=4.0.3,<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()
|
long_description = readme_file.read()
|
||||||
|
|
||||||
|
|
||||||
VERSION = "24.2.0"
|
VERSION = "24.3.0"
|
||||||
PROJECT_NAME = "aioesphomeapi"
|
PROJECT_NAME = "aioesphomeapi"
|
||||||
PROJECT_PACKAGE_NAME = "aioesphomeapi"
|
PROJECT_PACKAGE_NAME = "aioesphomeapi"
|
||||||
PROJECT_LICENSE = "MIT"
|
PROJECT_LICENSE = "MIT"
|
||||||
|
|
|
@ -16,6 +16,7 @@ from aioesphomeapi.api_pb2 import (
|
||||||
DateStateResponse,
|
DateStateResponse,
|
||||||
DateTimeStateResponse,
|
DateTimeStateResponse,
|
||||||
DeviceInfoResponse,
|
DeviceInfoResponse,
|
||||||
|
EventResponse,
|
||||||
FanStateResponse,
|
FanStateResponse,
|
||||||
HomeassistantServiceMap,
|
HomeassistantServiceMap,
|
||||||
HomeassistantServiceResponse,
|
HomeassistantServiceResponse,
|
||||||
|
@ -27,6 +28,7 @@ from aioesphomeapi.api_pb2 import (
|
||||||
ListEntitiesCoverResponse,
|
ListEntitiesCoverResponse,
|
||||||
ListEntitiesDateResponse,
|
ListEntitiesDateResponse,
|
||||||
ListEntitiesDateTimeResponse,
|
ListEntitiesDateTimeResponse,
|
||||||
|
ListEntitiesEventResponse,
|
||||||
ListEntitiesFanResponse,
|
ListEntitiesFanResponse,
|
||||||
ListEntitiesLightResponse,
|
ListEntitiesLightResponse,
|
||||||
ListEntitiesLockResponse,
|
ListEntitiesLockResponse,
|
||||||
|
@ -82,6 +84,8 @@ from aioesphomeapi.model import (
|
||||||
DateTimeInfo,
|
DateTimeInfo,
|
||||||
DateTimeState,
|
DateTimeState,
|
||||||
DeviceInfo,
|
DeviceInfo,
|
||||||
|
Event,
|
||||||
|
EventInfo,
|
||||||
FanInfo,
|
FanInfo,
|
||||||
FanState,
|
FanState,
|
||||||
HomeassistantServiceCall,
|
HomeassistantServiceCall,
|
||||||
|
@ -280,6 +284,8 @@ def test_api_version_ord():
|
||||||
(TimeState, TimeStateResponse),
|
(TimeState, TimeStateResponse),
|
||||||
(DateTimeInfo, ListEntitiesDateTimeResponse),
|
(DateTimeInfo, ListEntitiesDateTimeResponse),
|
||||||
(DateTimeState, DateTimeStateResponse),
|
(DateTimeState, DateTimeStateResponse),
|
||||||
|
(EventInfo, ListEntitiesEventResponse),
|
||||||
|
(Event, EventResponse),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_basic_pb_conversions(model, pb):
|
def test_basic_pb_conversions(model, pb):
|
||||||
|
|
Loading…
Reference in New Issue