Skip to content

Commit

Permalink
Resolve HA warnings on device class/units
Browse files Browse the repository at this point in the history
  • Loading branch information
natekspencer committed Feb 17, 2023
1 parent f1dfeef commit 4fa4975
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions custom_components/smartweatherudp/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
CONF_MONITORED_CONDITIONS,
CONF_NAME,
DEGREE,
ELECTRIC_POTENTIAL_VOLT,
IRRADIATION_WATTS_PER_SQUARE_METER,
LIGHT_LUX,
PERCENTAGE,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
UV_INDEX,
UnitOfElectricPotential,
UnitOfIrradiance,
UnitOfLength,
UnitOfPrecipitationDepth,
UnitOfPressure,
Expand Down Expand Up @@ -177,7 +177,6 @@ def __post_init__(self) -> None:
key="air_density",
name="Air Density",
native_unit_of_measurement=CONCENTRATION_KILOGRAMS_PER_CUBIC_METER,
device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS,
state_class=SensorStateClass.MEASUREMENT,
conversion_fn=lambda attr: attr.to(CONCENTRATION_POUNDS_PER_CUBIC_FOOT),
decimals=5,
Expand All @@ -189,7 +188,7 @@ def __post_init__(self) -> None:
WeatherFlowSensorEntityDescription(
key="battery",
name="Battery Voltage",
native_unit_of_measurement=ELECTRIC_POTENTIAL_VOLT,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
Expand Down Expand Up @@ -269,8 +268,8 @@ def __post_init__(self) -> None:
WeatherFlowSensorEntityDescription(
key="solar_radiation",
name="Solar Radiation",
native_unit_of_measurement=IRRADIATION_WATTS_PER_SQUARE_METER,
device_class=SensorDeviceClass.ILLUMINANCE,
native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER,
device_class=SensorDeviceClass.IRRADIANCE,
state_class=SensorStateClass.MEASUREMENT,
),
WeatherFlowSensorEntityDescription(
Expand All @@ -285,7 +284,6 @@ def __post_init__(self) -> None:
key="uv",
name="UV",
native_unit_of_measurement=UV_INDEX,
device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
),
WeatherFlowSensorEntityDescription(
Expand Down

0 comments on commit 4fa4975

Please sign in to comment.