diff --git a/custom_components/pirateweather/sensor.py b/custom_components/pirateweather/sensor.py index 0320a0a..9728e39 100644 --- a/custom_components/pirateweather/sensor.py +++ b/custom_components/pirateweather/sensor.py @@ -161,6 +161,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): "precip_intensity": PirateWeatherSensorEntityDescription( key="precip_intensity", name="Precip Intensity", + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, us_unit=UnitOfPrecipitationDepth.INCHES, ca_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, @@ -173,6 +174,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): "precip_probability": PirateWeatherSensorEntityDescription( key="precip_probability", name="Precip Probability", + state_class=SensorStateClass.MEASUREMENT, si_unit=PERCENTAGE, us_unit=PERCENTAGE, ca_unit=PERCENTAGE, @@ -186,6 +188,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="precip_accumulation", name="Precip Accumulation", device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfLength.CENTIMETERS, us_unit=UnitOfLength.INCHES, ca_unit=UnitOfLength.CENTIMETERS, @@ -199,6 +202,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="liquid_accumulation", name="Liquid Accumulation", device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfLength.CENTIMETERS, us_unit=UnitOfLength.INCHES, ca_unit=UnitOfLength.CENTIMETERS, @@ -212,6 +216,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="snow_accumulation", name="Snow Accumulation", device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfLength.CENTIMETERS, us_unit=UnitOfLength.INCHES, ca_unit=UnitOfLength.CENTIMETERS, @@ -225,6 +230,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="ice_accumulation", name="Ice Accumulation", device_class=SensorDeviceClass.PRECIPITATION, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfLength.CENTIMETERS, us_unit=UnitOfLength.INCHES, ca_unit=UnitOfLength.CENTIMETERS, @@ -277,6 +283,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="wind_speed", name="Wind Speed", device_class=SensorDeviceClass.WIND_SPEED, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfSpeed.METERS_PER_SECOND, us_unit=UnitOfSpeed.MILES_PER_HOUR, ca_unit=UnitOfSpeed.KILOMETERS_PER_HOUR, @@ -289,6 +296,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): "wind_bearing": PirateWeatherSensorEntityDescription( key="wind_bearing", name="Wind Bearing", + state_class=SensorStateClass.MEASUREMENT, si_unit=DEGREE, us_unit=DEGREE, ca_unit=DEGREE, @@ -302,6 +310,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="wind_gust", name="Wind Gust", device_class=SensorDeviceClass.WIND_SPEED, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfSpeed.METERS_PER_SECOND, us_unit=UnitOfSpeed.MILES_PER_HOUR, ca_unit=UnitOfSpeed.KILOMETERS_PER_HOUR, @@ -314,6 +323,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): "cloud_cover": PirateWeatherSensorEntityDescription( key="cloud_cover", name="Cloud Coverage", + state_class=SensorStateClass.MEASUREMENT, si_unit=PERCENTAGE, us_unit=PERCENTAGE, ca_unit=PERCENTAGE, @@ -352,6 +362,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): "visibility": PirateWeatherSensorEntityDescription( key="visibility", name="Visibility", + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfLength.KILOMETERS, us_unit=UnitOfLength.MILES, ca_unit=UnitOfLength.KILOMETERS, @@ -393,6 +404,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="smoke", name="Smoke", device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, si_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, us_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, ca_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, @@ -406,6 +418,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="smoke_max", name="Smoke Max", device_class=SensorDeviceClass.PM25, + state_class=SensorStateClass.MEASUREMENT, si_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, us_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, ca_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, @@ -419,6 +432,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="apparent_temperature_max", name="Daily High Apparent Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -431,6 +445,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="apparent_temperature_high", name="Daytime High Apparent Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -443,6 +458,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="apparent_temperature_min", name="Daily Low Apparent Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -455,6 +471,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="apparent_temperature_low", name="Overnight Low Apparent Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -467,6 +484,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="temperature_max", name="Daily High Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -479,6 +497,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="temperature_high", name="Daytime High Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -491,6 +510,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="temperature_min", name="Daily Low Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -503,6 +523,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="temperature_low", name="Overnight Low Temperature", device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfTemperature.CELSIUS, us_unit=UnitOfTemperature.FAHRENHEIT, ca_unit=UnitOfTemperature.CELSIUS, @@ -514,6 +535,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): "precip_intensity_max": PirateWeatherSensorEntityDescription( key="precip_intensity_max", name="Daily Max Precip Intensity", + state_class=SensorStateClass.MEASUREMENT, si_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, us_unit=UnitOfPrecipitationDepth.INCHES, ca_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, @@ -526,6 +548,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): "uv_index": PirateWeatherSensorEntityDescription( key="uv_index", name="UV Index", + state_class=SensorStateClass.MEASUREMENT, si_unit=UV_INDEX, us_unit=UV_INDEX, ca_unit=UV_INDEX,