diff --git a/homeassistant/components/environment_canada/weather.py b/homeassistant/components/environment_canada/weather.py index a5acb224bd0..c7d04e4c03d 100644 --- a/homeassistant/components/environment_canada/weather.py +++ b/homeassistant/components/environment_canada/weather.py @@ -123,7 +123,7 @@ class ECWeatherEntity( self._attr_device_info = coordinator.device_info @property - def native_temperature(self): + def native_temperature(self) -> float | None: """Return the temperature.""" if ( temperature := self.ec_data.conditions.get("temperature", {}).get("value") @@ -138,42 +138,42 @@ class ECWeatherEntity( return None @property - def humidity(self): + def humidity(self) -> float | None: """Return the humidity.""" if self.ec_data.conditions.get("humidity", {}).get("value"): return float(self.ec_data.conditions["humidity"]["value"]) return None @property - def native_wind_speed(self): + def native_wind_speed(self) -> float | None: """Return the wind speed.""" if self.ec_data.conditions.get("wind_speed", {}).get("value"): return float(self.ec_data.conditions["wind_speed"]["value"]) return None @property - def wind_bearing(self): + def wind_bearing(self) -> float | None: """Return the wind bearing.""" if self.ec_data.conditions.get("wind_bearing", {}).get("value"): return float(self.ec_data.conditions["wind_bearing"]["value"]) return None @property - def native_pressure(self): + def native_pressure(self) -> float | None: """Return the pressure.""" if self.ec_data.conditions.get("pressure", {}).get("value"): return float(self.ec_data.conditions["pressure"]["value"]) return None @property - def native_visibility(self): + def native_visibility(self) -> float | None: """Return the visibility.""" if self.ec_data.conditions.get("visibility", {}).get("value"): return float(self.ec_data.conditions["visibility"]["value"]) return None @property - def condition(self): + def condition(self) -> str | None: """Return the weather condition.""" icon_code = None @@ -186,7 +186,7 @@ class ECWeatherEntity( if icon_code: return icon_code_to_condition(int(icon_code)) - return "" + return None @callback def _async_forecast_daily(self) -> list[Forecast] | None: @@ -261,7 +261,7 @@ def get_forecast(ec_data, hourly) -> list[Forecast] | None: return forecast_array -def icon_code_to_condition(icon_code): +def icon_code_to_condition(icon_code: int) -> str | None: """Return the condition corresponding to an icon code.""" for condition, codes in ICON_CONDITION_MAP.items(): if icon_code in codes: