Add 'icon' field to Binary Sensor, Climate, Cover, Fan, and Light (#106)

* Added light icon to API

* Added icon property to Binary Sensor, Climate, Cover, and Fan entities
This commit is contained in:
Paul Monigatti 2021-10-10 21:41:37 +13:00 committed by GitHub
parent b3d5d376fb
commit c46d1c3822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 166 additions and 130 deletions

View File

@ -216,6 +216,7 @@ message ListEntitiesBinarySensorResponse {
string device_class = 5;
bool is_status_binary_sensor = 6;
bool disabled_by_default = 7;
string icon = 8;
}
message BinarySensorStateResponse {
option (id) = 21;
@ -246,6 +247,7 @@ message ListEntitiesCoverResponse {
bool supports_tilt = 7;
string device_class = 8;
bool disabled_by_default = 9;
string icon = 10;
}
enum LegacyCoverState {
@ -314,6 +316,7 @@ message ListEntitiesFanResponse {
bool supports_direction = 7;
int32 supported_speed_levels = 8;
bool disabled_by_default = 9;
string icon = 10;
}
enum FanSpeed {
FAN_SPEED_LOW = 0;
@ -377,6 +380,7 @@ message ListEntitiesLightResponse {
float max_mireds = 10;
repeated string effects = 11;
bool disabled_by_default = 13;
string icon = 14;
}
message LightStateResponse {
option (id) = 24;
@ -778,6 +782,7 @@ message ListEntitiesClimateResponse {
repeated ClimatePreset supported_presets = 16;
repeated string supported_custom_presets = 17;
bool disabled_by_default = 18;
string icon = 19;
}
message ClimateStateResponse {
option (id) = 47;

File diff suppressed because one or more lines are too long

View File

@ -113,6 +113,7 @@ class EntityInfo(APIModelBase):
name: str = ""
unique_id: str = ""
disabled_by_default: bool = False
icon: str = ""
@dataclass(frozen=True)
@ -316,7 +317,6 @@ class LastResetType(APIIntEnum):
@dataclass(frozen=True)
class SensorInfo(EntityInfo):
icon: str = ""
device_class: str = ""
unit_of_measurement: str = ""
accuracy_decimals: int = 0
@ -338,7 +338,6 @@ class SensorState(EntityState):
# ==================== SWITCH ====================
@dataclass(frozen=True)
class SwitchInfo(EntityInfo):
icon: str = ""
assumed_state: bool = False
@ -350,7 +349,7 @@ class SwitchState(EntityState):
# ==================== TEXT SENSOR ====================
@dataclass(frozen=True)
class TextSensorInfo(EntityInfo):
icon: str = ""
pass
@dataclass(frozen=True)
@ -506,7 +505,6 @@ class ClimateState(EntityState):
# ==================== NUMBER ====================
@dataclass(frozen=True)
class NumberInfo(EntityInfo):
icon: str = ""
min_value: float = 0.0
max_value: float = 0.0
step: float = converter_field(
@ -525,7 +523,6 @@ class NumberState(EntityState):
# ==================== SELECT ====================
@dataclass(frozen=True)
class SelectInfo(EntityInfo):
icon: str = ""
options: List[str] = converter_field(default_factory=list, converter=list)
@ -538,7 +535,6 @@ class SelectState(EntityState):
# ==================== SIREN ====================
@dataclass(frozen=True)
class SirenInfo(EntityInfo):
icon: str = ""
tones: List[str] = converter_field(default_factory=list, converter=list)
supports_volume: bool = False
supports_duration: bool = False