mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-22 16:48:04 +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 ====================
|
||||
enum SensorStateClass {
|
||||
STATE_CLASS_NONE = 0;
|
||||
STATE_CLASS_MEASUREMENT = 1;
|
||||
}
|
||||
|
||||
message ListEntitiesSensorResponse {
|
||||
option (id) = 16;
|
||||
option (source) = SOURCE_SERVER;
|
||||
@ -424,6 +429,7 @@ message ListEntitiesSensorResponse {
|
||||
int32 accuracy_decimals = 7;
|
||||
bool force_update = 8;
|
||||
string device_class = 9;
|
||||
SensorStateClass state_class = 10;
|
||||
}
|
||||
message SensorStateResponse {
|
||||
option (id) = 25;
|
||||
|
File diff suppressed because one or more lines are too long
@ -148,6 +148,10 @@ class LightState(EntityState):
|
||||
|
||||
|
||||
# ==================== SENSOR ====================
|
||||
class SensorStateClass(enum.IntEnum):
|
||||
NONE = 0
|
||||
MEASUREMENT = 1
|
||||
|
||||
@attr.s
|
||||
class SensorInfo(EntityInfo):
|
||||
icon = attr.ib(type=str, default='')
|
||||
@ -155,6 +159,7 @@ class SensorInfo(EntityInfo):
|
||||
unit_of_measurement = attr.ib(type=str, default='')
|
||||
accuracy_decimals = attr.ib(type=int, default=0)
|
||||
force_update = attr.ib(type=bool, default=False)
|
||||
state_class = attr.ib(type=SensorStateClass, converter=SensorStateClass, default=SensorStateClass.NONE)
|
||||
|
||||
|
||||
@attr.s
|
||||
|
Loading…
Reference in New Issue
Block a user