mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 01:07:10 +00:00
Use total increasing for ecowitt precipitation and lightning count (#90099)
This commit is contained in:
parent
8d6a711cac
commit
8b25fd8563
@ -125,7 +125,7 @@ ECOWITT_SENSORS_MAPPING: Final = {
|
|||||||
EcoWittSensorTypes.LIGHTNING_COUNT: SensorEntityDescription(
|
EcoWittSensorTypes.LIGHTNING_COUNT: SensorEntityDescription(
|
||||||
key="LIGHTNING_COUNT",
|
key="LIGHTNING_COUNT",
|
||||||
native_unit_of_measurement="strikes",
|
native_unit_of_measurement="strikes",
|
||||||
state_class=SensorStateClass.TOTAL,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
EcoWittSensorTypes.TEMPERATURE_C: SensorEntityDescription(
|
EcoWittSensorTypes.TEMPERATURE_C: SensorEntityDescription(
|
||||||
key="TEMPERATURE_C",
|
key="TEMPERATURE_C",
|
||||||
@ -143,13 +143,13 @@ ECOWITT_SENSORS_MAPPING: Final = {
|
|||||||
key="RAIN_COUNT_MM",
|
key="RAIN_COUNT_MM",
|
||||||
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
|
||||||
device_class=SensorDeviceClass.PRECIPITATION,
|
device_class=SensorDeviceClass.PRECIPITATION,
|
||||||
state_class=SensorStateClass.TOTAL,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
EcoWittSensorTypes.RAIN_COUNT_INCHES: SensorEntityDescription(
|
EcoWittSensorTypes.RAIN_COUNT_INCHES: SensorEntityDescription(
|
||||||
key="RAIN_COUNT_INCHES",
|
key="RAIN_COUNT_INCHES",
|
||||||
native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
|
native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
|
||||||
device_class=SensorDeviceClass.PRECIPITATION,
|
device_class=SensorDeviceClass.PRECIPITATION,
|
||||||
state_class=SensorStateClass.TOTAL,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
EcoWittSensorTypes.RAIN_RATE_MM: SensorEntityDescription(
|
EcoWittSensorTypes.RAIN_RATE_MM: SensorEntityDescription(
|
||||||
key="RAIN_RATE_MM",
|
key="RAIN_RATE_MM",
|
||||||
@ -230,6 +230,13 @@ async def async_setup_entry(
|
|||||||
name=sensor.name,
|
name=sensor.name,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Hourly rain doesn't reset to fixed hours, it must be measurement state classes
|
||||||
|
if sensor.key in ("hrain_piezomm", "hrain_piezo"):
|
||||||
|
description = dataclasses.replace(
|
||||||
|
description,
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
)
|
||||||
|
|
||||||
async_add_entities([EcowittSensorEntity(sensor, description)])
|
async_add_entities([EcowittSensorEntity(sensor, description)])
|
||||||
|
|
||||||
ecowitt.new_sensor_cb.append(_new_sensor)
|
ecowitt.new_sensor_cb.append(_new_sensor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user