mirror of
https://github.com/esphome/esphome.git
synced 2025-09-17 02:32:20 +01:00
Add state_class total (#3608)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -109,6 +109,7 @@ STATE_CLASSES = {
|
||||
"": StateClasses.STATE_CLASS_NONE,
|
||||
"measurement": StateClasses.STATE_CLASS_MEASUREMENT,
|
||||
"total_increasing": StateClasses.STATE_CLASS_TOTAL_INCREASING,
|
||||
"total": StateClasses.STATE_CLASS_TOTAL,
|
||||
}
|
||||
validate_state_class = cv.enum(STATE_CLASSES, lower=True, space="_")
|
||||
|
||||
|
@@ -12,6 +12,8 @@ std::string state_class_to_string(StateClass state_class) {
|
||||
return "measurement";
|
||||
case STATE_CLASS_TOTAL_INCREASING:
|
||||
return "total_increasing";
|
||||
case STATE_CLASS_TOTAL:
|
||||
return "total";
|
||||
case STATE_CLASS_NONE:
|
||||
default:
|
||||
return "";
|
||||
|
@@ -36,6 +36,7 @@ enum StateClass : uint8_t {
|
||||
STATE_CLASS_NONE = 0,
|
||||
STATE_CLASS_MEASUREMENT = 1,
|
||||
STATE_CLASS_TOTAL_INCREASING = 2,
|
||||
STATE_CLASS_TOTAL = 3,
|
||||
};
|
||||
|
||||
std::string state_class_to_string(StateClass state_class);
|
||||
|
Reference in New Issue
Block a user