Add EntityCategory (#130)

This commit is contained in:
Jesse Hills 2021-10-27 11:45:09 +13:00 committed by GitHub
parent 47781c04e1
commit 6bda4e4797
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 284 additions and 124 deletions

View File

@ -202,6 +202,14 @@ message SubscribeStatesRequest {
// Empty
}
// ==================== COMMON =====================
enum EntityCategory {
ENTITY_CATEGORY_NONE = 0;
ENTITY_CATEGORY_CONFIG = 1;
ENTITY_CATEGORY_DIAGNOSTIC = 2;
}
// ==================== BINARY SENSOR ====================
message ListEntitiesBinarySensorResponse {
option (id) = 12;
@ -217,6 +225,7 @@ message ListEntitiesBinarySensorResponse {
bool is_status_binary_sensor = 6;
bool disabled_by_default = 7;
string icon = 8;
EntityCategory entity_category = 9;
}
message BinarySensorStateResponse {
option (id) = 21;
@ -248,6 +257,7 @@ message ListEntitiesCoverResponse {
string device_class = 8;
bool disabled_by_default = 9;
string icon = 10;
EntityCategory entity_category = 11;
}
enum LegacyCoverState {
@ -317,6 +327,7 @@ message ListEntitiesFanResponse {
int32 supported_speed_levels = 8;
bool disabled_by_default = 9;
string icon = 10;
EntityCategory entity_category = 11;
}
enum FanSpeed {
FAN_SPEED_LOW = 0;
@ -381,6 +392,7 @@ message ListEntitiesLightResponse {
repeated string effects = 11;
bool disabled_by_default = 13;
string icon = 14;
EntityCategory entity_category = 15;
}
message LightStateResponse {
option (id) = 24;
@ -468,6 +480,7 @@ message ListEntitiesSensorResponse {
SensorStateClass state_class = 10;
SensorLastResetType last_reset_type = 11;
bool disabled_by_default = 12;
EntityCategory entity_category = 13;
}
message SensorStateResponse {
option (id) = 25;
@ -496,6 +509,7 @@ message ListEntitiesSwitchResponse {
string icon = 5;
bool assumed_state = 6;
bool disabled_by_default = 7;
EntityCategory entity_category = 8;
}
message SwitchStateResponse {
option (id) = 26;
@ -529,6 +543,7 @@ message ListEntitiesTextSensorResponse {
string icon = 5;
bool disabled_by_default = 6;
EntityCategory entity_category = 7;
}
message TextSensorStateResponse {
option (id) = 27;
@ -690,6 +705,7 @@ message ListEntitiesCameraResponse {
string unique_id = 4;
bool disabled_by_default = 5;
string icon = 6;
EntityCategory entity_category = 7;
}
message CameraImageResponse {
@ -784,6 +800,7 @@ message ListEntitiesClimateResponse {
repeated string supported_custom_presets = 17;
bool disabled_by_default = 18;
string icon = 19;
EntityCategory entity_category = 20;
}
message ClimateStateResponse {
option (id) = 47;
@ -852,6 +869,7 @@ message ListEntitiesNumberResponse {
float max_value = 7;
float step = 8;
bool disabled_by_default = 9;
EntityCategory entity_category = 10;
}
message NumberStateResponse {
option (id) = 50;
@ -889,6 +907,7 @@ message ListEntitiesSelectResponse {
string icon = 5;
repeated string options = 6;
bool disabled_by_default = 7;
EntityCategory entity_category = 8;
}
message SelectStateResponse {
option (id) = 53;
@ -928,6 +947,7 @@ message ListEntitiesSirenResponse {
repeated string tones = 7;
bool supports_duration = 8;
bool supports_volume = 9;
EntityCategory entity_category = 10;
}
message SirenStateResponse {
option (id) = 56;

File diff suppressed because one or more lines are too long

View File

@ -106,6 +106,12 @@ class DeviceInfo(APIModelBase):
project_version: str = ""
class EntityCategory(APIIntEnum):
NONE = 0
CONFIG = 1
DIAGNOSTIC = 2
@dataclass(frozen=True)
class EntityInfo(APIModelBase):
object_id: str = ""
@ -114,6 +120,9 @@ class EntityInfo(APIModelBase):
unique_id: str = ""
disabled_by_default: bool = False
icon: str = ""
entity_category: Optional[EntityCategory] = converter_field(
default=EntityCategory.NONE, converter=EntityCategory.convert
)
@dataclass(frozen=True)