Skip to content

Commit

Permalink
Remove Deprecated Constants
Browse files Browse the repository at this point in the history
  • Loading branch information
cloneofghosts authored Jan 9, 2024
1 parent d3ecc38 commit f6b9e50
Showing 1 changed file with 102 additions and 109 deletions.
211 changes: 102 additions & 109 deletions custom_components/pirateweather/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,13 @@
CONF_NAME,
CONF_SCAN_INTERVAL,
DEGREE,
LENGTH_CENTIMETERS,
LENGTH_INCHES,
LENGTH_KILOMETERS,
LENGTH_MILES,
LENGTH_MILLIMETERS,
PERCENTAGE,
PRECIPITATION_INCHES,
PRECIPITATION_MILLIMETERS_PER_HOUR,
PRESSURE_MBAR,
SPEED_KILOMETERS_PER_HOUR,
SPEED_METERS_PER_SECOND,
SPEED_MILES_PER_HOUR,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
UnitOfPressure,
UnitOfSpeed,
UnitOfTemperature,
UnitOfLength,
UnitOfVolumetricFlux,
UnitOfPrecipitationDepth,
UV_INDEX,
)

Expand Down Expand Up @@ -134,7 +127,7 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
forecast_mode: list[str] = field(default_factory=list)


# Sensor Types
# Sensor Types
SENSOR_TYPES: dict[str, PirateWeatherSensorEntityDescription] = {
"summary": PirateWeatherSensorEntityDescription(
key="summary",
Expand Down Expand Up @@ -164,11 +157,11 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
"nearest_storm_distance": PirateWeatherSensorEntityDescription(
key="nearest_storm_distance",
name="Nearest Storm Distance",
si_unit=LENGTH_KILOMETERS,
us_unit=LENGTH_MILES,
ca_unit=LENGTH_KILOMETERS,
uk_unit=LENGTH_KILOMETERS,
uk2_unit=LENGTH_MILES,
si_unit=UnitOfLength.KILOMETERS,
us_unit=UnitOfLength.MILES,
ca_unit=UnitOfLength.KILOMETERS,
uk_unit=UnitOfLength.KILOMETERS,
uk2_unit=UnitOfLength.MILES,
icon="mdi:weather-lightning",
forecast_mode=["currently"],
),
Expand All @@ -192,11 +185,11 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
"precip_intensity": PirateWeatherSensorEntityDescription(
key="precip_intensity",
name="Precip Intensity",
si_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
us_unit=PRECIPITATION_INCHES,
ca_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
uk_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
uk2_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
si_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
us_unit=UnitOfPrecipitationDepth.INCHES,
ca_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
uk_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
uk2_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
icon="mdi:weather-rainy",
forecast_mode=["currently", "minutely", "hourly", "daily"],
),
Expand All @@ -215,11 +208,11 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
key="precip_accumulation",
name="Precip Accumulation",
device_class=SensorDeviceClass.PRECIPITATION,
si_unit=LENGTH_CENTIMETERS,
us_unit=LENGTH_INCHES,
ca_unit=LENGTH_CENTIMETERS,
uk_unit=LENGTH_CENTIMETERS,
uk2_unit=LENGTH_CENTIMETERS,
si_unit=UnitOfLength.CENTIMETERS,
us_unit=UnitOfLength.INCHES,
ca_unit=UnitOfLength.CENTIMETERS,
uk_unit=UnitOfLength.CENTIMETERS,
uk2_unit=UnitOfLength.CENTIMETERS,
icon="mdi:weather-snowy",
forecast_mode=["hourly", "daily"],
),
Expand All @@ -228,46 +221,46 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
name="Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["currently", "hourly"],
),
"apparent_temperature": PirateWeatherSensorEntityDescription(
key="apparent_temperature",
name="Apparent Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["currently", "hourly"],
),
"dew_point": PirateWeatherSensorEntityDescription(
key="dew_point",
name="Dew Point",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["currently", "hourly", "daily"],
),
"wind_speed": PirateWeatherSensorEntityDescription(
key="wind_speed",
name="Wind Speed",
device_class=SensorDeviceClass.WIND_SPEED,
si_unit=SPEED_METERS_PER_SECOND,
us_unit=SPEED_MILES_PER_HOUR,
ca_unit=SPEED_KILOMETERS_PER_HOUR,
uk_unit=SPEED_MILES_PER_HOUR,
uk2_unit=SPEED_MILES_PER_HOUR,
si_unit=UnitOfSpeed.METERS_PER_SECOND,
us_unit=UnitOfSpeed.MILES_PER_HOUR,
ca_unit=UnitOfSpeed.KILOMETERS_PER_HOUR,
uk_unit=UnitOfSpeed.MILES_PER_HOUR,
uk2_unit=UnitOfSpeed.MILES_PER_HOUR,
icon="mdi:weather-windy",
forecast_mode=["currently", "hourly", "daily"],
),
Expand All @@ -286,11 +279,11 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
key="wind_gust",
name="Wind Gust",
device_class=SensorDeviceClass.WIND_SPEED,
si_unit=SPEED_METERS_PER_SECOND,
us_unit=SPEED_MILES_PER_HOUR,
ca_unit=SPEED_KILOMETERS_PER_HOUR,
uk_unit=SPEED_MILES_PER_HOUR,
uk2_unit=SPEED_MILES_PER_HOUR,
si_unit=UnitOfSpeed.METERS_PER_SECOND,
us_unit=UnitOfSpeed.MILES_PER_HOUR,
ca_unit=UnitOfSpeed.KILOMETERS_PER_HOUR,
uk_unit=UnitOfSpeed.MILES_PER_HOUR,
uk2_unit=UnitOfSpeed.MILES_PER_HOUR,
icon="mdi:weather-windy-variant",
forecast_mode=["currently", "hourly", "daily"],
),
Expand Down Expand Up @@ -322,21 +315,21 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
name="Pressure",
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
si_unit=PRESSURE_MBAR,
us_unit=PRESSURE_MBAR,
ca_unit=PRESSURE_MBAR,
uk_unit=PRESSURE_MBAR,
uk2_unit=PRESSURE_MBAR,
si_unit=UnitOfPressure.MBAR,
us_unit=UnitOfPressure.MBAR,
ca_unit=UnitOfPressure.MBAR,
uk_unit=UnitOfPressure.MBAR,
uk2_unit=UnitOfPressure.MBAR,
forecast_mode=["currently", "hourly", "daily"],
),
"visibility": PirateWeatherSensorEntityDescription(
key="visibility",
name="Visibility",
si_unit=LENGTH_KILOMETERS,
us_unit=LENGTH_MILES,
ca_unit=LENGTH_KILOMETERS,
uk_unit=LENGTH_KILOMETERS,
uk2_unit=LENGTH_MILES,
si_unit=UnitOfLength.KILOMETERS,
us_unit=UnitOfLength.MILES,
ca_unit=UnitOfLength.KILOMETERS,
uk_unit=UnitOfLength.KILOMETERS,
uk2_unit=UnitOfLength.MILES,
icon="mdi:eye",
forecast_mode=["currently", "hourly", "daily"],
),
Expand All @@ -355,98 +348,98 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription):
key="apparent_temperature_max",
name="Daily High Apparent Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"apparent_temperature_high": PirateWeatherSensorEntityDescription(
key="apparent_temperature_high",
name="Daytime High Apparent Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"apparent_temperature_min": PirateWeatherSensorEntityDescription(
key="apparent_temperature_min",
name="Daily Low Apparent Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"apparent_temperature_low": PirateWeatherSensorEntityDescription(
key="apparent_temperature_low",
name="Overnight Low Apparent Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"temperature_max": PirateWeatherSensorEntityDescription(
key="temperature_max",
name="Daily High Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"temperature_high": PirateWeatherSensorEntityDescription(
key="temperature_high",
name="Daytime High Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"temperature_min": PirateWeatherSensorEntityDescription(
key="temperature_min",
name="Daily Low Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"temperature_low": PirateWeatherSensorEntityDescription(
key="temperature_low",
name="Overnight Low Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
si_unit=TEMP_CELSIUS,
us_unit=TEMP_FAHRENHEIT,
ca_unit=TEMP_CELSIUS,
uk_unit=TEMP_CELSIUS,
uk2_unit=TEMP_CELSIUS,
si_unit=UnitOfTemperature.CELSIUS,
us_unit=UnitOfTemperature.FAHRENHEIT,
ca_unit=UnitOfTemperature.CELSIUS,
uk_unit=UnitOfTemperature.CELSIUS,
uk2_unit=UnitOfTemperature.CELSIUS,
forecast_mode=["daily"],
),
"precip_intensity_max": PirateWeatherSensorEntityDescription(
key="precip_intensity_max",
name="Daily Max Precip Intensity",
si_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
us_unit=PRECIPITATION_INCHES,
ca_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
uk_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
uk2_unit=PRECIPITATION_MILLIMETERS_PER_HOUR,
si_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
us_unit=UnitOfPrecipitationDepth.INCHES,
ca_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
uk_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
uk2_unit=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
icon="mdi:thermometer",
forecast_mode=["daily"],
),
Expand Down

0 comments on commit f6b9e50

Please sign in to comment.