mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-11-12 10:33:57 +01:00
Add support for Sensor state class (#33)
This commit is contained in:
parent
23ac74da4d
commit
a6a25d88b7
@ -409,6 +409,11 @@ message LightCommandRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ==================== SENSOR ====================
|
// ==================== SENSOR ====================
|
||||||
|
enum SensorStateClass {
|
||||||
|
STATE_CLASS_NONE = 0;
|
||||||
|
STATE_CLASS_MEASUREMENT = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message ListEntitiesSensorResponse {
|
message ListEntitiesSensorResponse {
|
||||||
option (id) = 16;
|
option (id) = 16;
|
||||||
option (source) = SOURCE_SERVER;
|
option (source) = SOURCE_SERVER;
|
||||||
@ -424,6 +429,7 @@ message ListEntitiesSensorResponse {
|
|||||||
int32 accuracy_decimals = 7;
|
int32 accuracy_decimals = 7;
|
||||||
bool force_update = 8;
|
bool force_update = 8;
|
||||||
string device_class = 9;
|
string device_class = 9;
|
||||||
|
SensorStateClass state_class = 10;
|
||||||
}
|
}
|
||||||
message SensorStateResponse {
|
message SensorStateResponse {
|
||||||
option (id) = 25;
|
option (id) = 25;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -148,6 +148,10 @@ class LightState(EntityState):
|
|||||||
|
|
||||||
|
|
||||||
# ==================== SENSOR ====================
|
# ==================== SENSOR ====================
|
||||||
|
class SensorStateClass(enum.IntEnum):
|
||||||
|
NONE = 0
|
||||||
|
MEASUREMENT = 1
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
class SensorInfo(EntityInfo):
|
class SensorInfo(EntityInfo):
|
||||||
icon = attr.ib(type=str, default='')
|
icon = attr.ib(type=str, default='')
|
||||||
@ -155,6 +159,7 @@ class SensorInfo(EntityInfo):
|
|||||||
unit_of_measurement = attr.ib(type=str, default='')
|
unit_of_measurement = attr.ib(type=str, default='')
|
||||||
accuracy_decimals = attr.ib(type=int, default=0)
|
accuracy_decimals = attr.ib(type=int, default=0)
|
||||||
force_update = attr.ib(type=bool, default=False)
|
force_update = attr.ib(type=bool, default=False)
|
||||||
|
state_class = attr.ib(type=SensorStateClass, converter=SensorStateClass, default=SensorStateClass.NONE)
|
||||||
|
|
||||||
|
|
||||||
@attr.s
|
@attr.s
|
||||||
|
Loading…
Reference in New Issue
Block a user