Use new device class in ambient_station (#83322)

* Use new device class in ambient_station

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py

* Update homeassistant/components/ambient_station/sensor.py
This commit is contained in:
epenet 2022-12-05 22:02:04 +01:00 committed by GitHub
parent 2c4f9ca037
commit f1ce8a9004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,10 +18,10 @@ from homeassistant.const import (
IRRADIATION_WATTS_PER_SQUARE_METER, IRRADIATION_WATTS_PER_SQUARE_METER,
LIGHT_LUX, LIGHT_LUX,
PERCENTAGE, PERCENTAGE,
PRECIPITATION_INCHES, UnitOfPrecipitationDepth,
PRESSURE_INHG, UnitOfPressure,
SPEED_MILES_PER_HOUR, UnitOfSpeed,
TEMP_FAHRENHEIT, UnitOfTemperature,
UnitOfVolumetricFlux, UnitOfVolumetricFlux,
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
@ -114,8 +114,8 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_24HOURRAININ, key=TYPE_24HOURRAININ,
name="24 hr rain", name="24 hr rain",
icon="mdi:water", native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
native_unit_of_measurement=PRECIPITATION_INCHES, device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
SensorEntityDescription( SensorEntityDescription(
@ -145,14 +145,14 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_BAROMABSIN, key=TYPE_BAROMABSIN,
name="Abs pressure", name="Abs pressure",
native_unit_of_measurement=PRESSURE_INHG, native_unit_of_measurement=UnitOfPressure.INHG,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_BAROMRELIN, key=TYPE_BAROMRELIN,
name="Rel pressure", name="Rel pressure",
native_unit_of_measurement=PRESSURE_INHG, native_unit_of_measurement=UnitOfPressure.INHG,
device_class=SensorDeviceClass.PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
@ -166,28 +166,28 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_DAILYRAININ, key=TYPE_DAILYRAININ,
name="Daily rain", name="Daily rain",
icon="mdi:water", native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
native_unit_of_measurement=PRECIPITATION_INCHES, device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_DEWPOINT, key=TYPE_DEWPOINT,
name="Dew point", name="Dew point",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_EVENTRAININ, key=TYPE_EVENTRAININ,
name="Event rain", name="Event rain",
icon="mdi:water", native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
native_unit_of_measurement=PRECIPITATION_INCHES, device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_FEELSLIKE, key=TYPE_FEELSLIKE,
name="Feels like", name="Feels like",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
@ -306,16 +306,15 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_MAXDAILYGUST, key=TYPE_MAXDAILYGUST,
name="Max gust", name="Max gust",
icon="mdi:weather-windy", native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR,
native_unit_of_measurement=SPEED_MILES_PER_HOUR, device_class=SensorDeviceClass.WIND_SPEED,
device_class=SensorDeviceClass.SPEED,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_MONTHLYRAININ, key=TYPE_MONTHLYRAININ,
name="Monthly rain", name="Monthly rain",
icon="mdi:water", native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
native_unit_of_measurement=PRECIPITATION_INCHES, device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
@ -417,70 +416,70 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP10F, key=TYPE_SOILTEMP10F,
name="Soil temp 10", name="Soil temp 10",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP1F, key=TYPE_SOILTEMP1F,
name="Soil temp 1", name="Soil temp 1",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP2F, key=TYPE_SOILTEMP2F,
name="Soil temp 2", name="Soil temp 2",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP3F, key=TYPE_SOILTEMP3F,
name="Soil temp 3", name="Soil temp 3",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP4F, key=TYPE_SOILTEMP4F,
name="Soil temp 4", name="Soil temp 4",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP5F, key=TYPE_SOILTEMP5F,
name="Soil temp 5", name="Soil temp 5",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP6F, key=TYPE_SOILTEMP6F,
name="Soil temp 6", name="Soil temp 6",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP7F, key=TYPE_SOILTEMP7F,
name="Soil temp 7", name="Soil temp 7",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP8F, key=TYPE_SOILTEMP8F,
name="Soil temp 8", name="Soil temp 8",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_SOILTEMP9F, key=TYPE_SOILTEMP9F,
name="Soil temp 9", name="Soil temp 9",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
@ -501,92 +500,92 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP10F, key=TYPE_TEMP10F,
name="Temp 10", name="Temp 10",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP1F, key=TYPE_TEMP1F,
name="Temp 1", name="Temp 1",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP2F, key=TYPE_TEMP2F,
name="Temp 2", name="Temp 2",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP3F, key=TYPE_TEMP3F,
name="Temp 3", name="Temp 3",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP4F, key=TYPE_TEMP4F,
name="Temp 4", name="Temp 4",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP5F, key=TYPE_TEMP5F,
name="Temp 5", name="Temp 5",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP6F, key=TYPE_TEMP6F,
name="Temp 6", name="Temp 6",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP7F, key=TYPE_TEMP7F,
name="Temp 7", name="Temp 7",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP8F, key=TYPE_TEMP8F,
name="Temp 8", name="Temp 8",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMP9F, key=TYPE_TEMP9F,
name="Temp 9", name="Temp 9",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMPF, key=TYPE_TEMPF,
name="Temp", name="Temp",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TEMPINF, key=TYPE_TEMPINF,
name="Inside temp", name="Inside temp",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_TOTALRAININ, key=TYPE_TOTALRAININ,
name="Lifetime rain", name="Lifetime rain",
icon="mdi:water", native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
native_unit_of_measurement=PRECIPITATION_INCHES, device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
@ -599,8 +598,8 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_WEEKLYRAININ, key=TYPE_WEEKLYRAININ,
name="Weekly rain", name="Weekly rain",
icon="mdi:water", native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
native_unit_of_measurement=PRECIPITATION_INCHES, device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
@ -630,38 +629,34 @@ SENSOR_DESCRIPTIONS = (
SensorEntityDescription( SensorEntityDescription(
key=TYPE_WINDGUSTMPH, key=TYPE_WINDGUSTMPH,
name="Wind gust", name="Wind gust",
icon="mdi:weather-windy", native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR,
native_unit_of_measurement=SPEED_MILES_PER_HOUR, device_class=SensorDeviceClass.WIND_SPEED,
device_class=SensorDeviceClass.SPEED,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_WINDSPDMPH_AVG10M, key=TYPE_WINDSPDMPH_AVG10M,
name="Wind avg 10m", name="Wind avg 10m",
icon="mdi:weather-windy", native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR,
native_unit_of_measurement=SPEED_MILES_PER_HOUR, device_class=SensorDeviceClass.WIND_SPEED,
device_class=SensorDeviceClass.SPEED,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_WINDSPDMPH_AVG2M, key=TYPE_WINDSPDMPH_AVG2M,
name="Wind avg 2m", name="Wind avg 2m",
icon="mdi:weather-windy", native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR,
native_unit_of_measurement=SPEED_MILES_PER_HOUR, device_class=SensorDeviceClass.WIND_SPEED,
device_class=SensorDeviceClass.SPEED,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_WINDSPEEDMPH, key=TYPE_WINDSPEEDMPH,
name="Wind speed", name="Wind speed",
icon="mdi:weather-windy", native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR,
native_unit_of_measurement=SPEED_MILES_PER_HOUR, device_class=SensorDeviceClass.WIND_SPEED,
device_class=SensorDeviceClass.SPEED,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_YEARLYRAININ, key=TYPE_YEARLYRAININ,
name="Yearly rain", name="Yearly rain",
icon="mdi:water", native_unit_of_measurement=UnitOfPrecipitationDepth.INCHES,
native_unit_of_measurement=PRECIPITATION_INCHES, device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
) )