Fix HA error related to incorrect state class (#5605)

This commit is contained in:
H. Árkosi Róbert 2023-10-27 09:39:23 +02:00 committed by GitHub
parent c83cb30935
commit 563e15e8a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ from esphome.const import (
ICON_THERMOMETER, ICON_THERMOMETER,
ICON_TIMER, ICON_TIMER,
STATE_CLASS_MEASUREMENT, STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
UNIT_CELSIUS, UNIT_CELSIUS,
UNIT_HOUR, UNIT_HOUR,
UNIT_MINUTE, UNIT_MINUTE,
@ -128,7 +129,7 @@ CONFIG_SCHEMA = cv.typed_schema(
icon=ICON_RADIATOR, icon=ICON_RADIATOR,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
cv.Optional(CONF_TIME): sensor.sensor_schema( cv.Optional(CONF_TIME): sensor.sensor_schema(
unit_of_measurement=UNIT_MINUTE, unit_of_measurement=UNIT_MINUTE,
@ -209,7 +210,7 @@ CONFIG_SCHEMA = cv.typed_schema(
icon=ICON_RADIATOR, icon=ICON_RADIATOR,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
cv.Optional(CONF_TIME): sensor.sensor_schema( cv.Optional(CONF_TIME): sensor.sensor_schema(
unit_of_measurement=UNIT_MINUTE, unit_of_measurement=UNIT_MINUTE,
@ -290,7 +291,7 @@ CONFIG_SCHEMA = cv.typed_schema(
icon=ICON_RADIATOR, icon=ICON_RADIATOR,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
cv.Optional(CONF_TIME): sensor.sensor_schema( cv.Optional(CONF_TIME): sensor.sensor_schema(
unit_of_measurement=UNIT_MINUTE, unit_of_measurement=UNIT_MINUTE,
@ -353,7 +354,7 @@ CONFIG_SCHEMA = cv.typed_schema(
icon=ICON_RADIATOR, icon=ICON_RADIATOR,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
cv.Optional(CONF_VERSION): sensor.sensor_schema( cv.Optional(CONF_VERSION): sensor.sensor_schema(
accuracy_decimals=2, accuracy_decimals=2,
@ -433,7 +434,7 @@ CONFIG_SCHEMA = cv.typed_schema(
icon=ICON_RADIATOR, icon=ICON_RADIATOR,
accuracy_decimals=0, accuracy_decimals=0,
device_class=DEVICE_CLASS_ENERGY, device_class=DEVICE_CLASS_ENERGY,
state_class=STATE_CLASS_MEASUREMENT, state_class=STATE_CLASS_TOTAL_INCREASING,
), ),
cv.Optional(CONF_TIME): sensor.sensor_schema( cv.Optional(CONF_TIME): sensor.sensor_schema(
unit_of_measurement=UNIT_MINUTE, unit_of_measurement=UNIT_MINUTE,