Add missing_state property

This commit is contained in:
Otto Winter 2019-11-12 14:55:35 +01:00
parent a30e6c2f8c
commit 91b2e0ceb4
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
3 changed files with 125 additions and 92 deletions

View File

@ -216,6 +216,9 @@ message BinarySensorStateResponse {
fixed32 key = 1;
bool state = 2;
// If the binary sensor does not have a valid state yet.
// Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller
bool missing_state = 3;
}
// ==================== COVER ====================
@ -416,6 +419,9 @@ message SensorStateResponse {
fixed32 key = 1;
float state = 2;
// If the sensor does not have a valid state yet.
// Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller
bool missing_state = 3;
}
// ==================== SWITCH ====================
@ -472,6 +478,9 @@ message TextSensorStateResponse {
fixed32 key = 1;
string state = 2;
// If the text sensor does not have a valid state yet.
// Equivalent to `!obj->has_state()` - inverse logic to make state packets smaller
bool missing_state = 3;
}
// ==================== SUBSCRIBE LOGS ====================

File diff suppressed because one or more lines are too long

View File

@ -50,6 +50,7 @@ class BinarySensorInfo(EntityInfo):
@attr.s
class BinarySensorState(EntityState):
state = attr.ib(type=bool, default=False)
missing_state = attr.ib(type=bool, default=False)
# ==================== COVER ====================
@ -149,6 +150,7 @@ class SensorInfo(EntityInfo):
@attr.s
class SensorState(EntityState):
state = attr.ib(type=float, default=0.0)
missing_state = attr.ib(type=bool, default=False)
# ==================== SWITCH ====================
@ -172,6 +174,7 @@ class TextSensorInfo(EntityInfo):
@attr.s
class TextSensorState(EntityState):
state = attr.ib(type=str, default='')
missing_state = attr.ib(type=bool, default=False)
# ==================== CAMERA ====================