diff --git a/homeassistant/components/awair/sensor.py b/homeassistant/components/awair/sensor.py index dc48e0f92c3..f42a46999fb 100644 --- a/homeassistant/components/awair/sensor.py +++ b/homeassistant/components/awair/sensor.py @@ -1,7 +1,7 @@ """Support for Awair sensors.""" from __future__ import annotations -from typing import cast +from typing import Any, cast from python_awair.air_data import AirData from python_awair.devices import AwairBaseDevice, AwairLocalDevice @@ -156,7 +156,7 @@ class AwairSensor(CoordinatorEntity[AwairDataUpdateCoordinator], SensorEntity): return round(state, 2) @property - def extra_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict[str, Any]: """Return the Awair Index alongside state attributes. The Awair Index is a subjective score ranging from 0-4 (inclusive) that @@ -178,7 +178,7 @@ class AwairSensor(CoordinatorEntity[AwairDataUpdateCoordinator], SensorEntity): https://docs.developer.getawair.com/?version=latest#awair-score-and-index """ sensor_type = self.entity_description.key - attrs: dict = {} + attrs: dict[str, Any] = {} if not self._air_data: return attrs if sensor_type in self._air_data.indices: diff --git a/homeassistant/components/emonitor/sensor.py b/homeassistant/components/emonitor/sensor.py index d5e677abcc9..dc7159001d8 100644 --- a/homeassistant/components/emonitor/sensor.py +++ b/homeassistant/components/emonitor/sensor.py @@ -123,6 +123,6 @@ class EmonitorPowerSensor(CoordinatorEntity, SensorEntity): return self._paired_attr(self.entity_description.key) @property - def extra_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict[str, int]: """Return the device specific state attributes.""" return {"channel": self.channel_number} diff --git a/homeassistant/components/entur_public_transport/sensor.py b/homeassistant/components/entur_public_transport/sensor.py index f5a954b16d4..e109c25d340 100644 --- a/homeassistant/components/entur_public_transport/sensor.py +++ b/homeassistant/components/entur_public_transport/sensor.py @@ -183,7 +183,7 @@ class EnturPublicTransportSensor(SensorEntity): return self._state @property - def extra_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict[str, str]: """Return the state attributes.""" self._attributes[ATTR_STOP_ID] = self._stop return self._attributes diff --git a/homeassistant/components/fints/sensor.py b/homeassistant/components/fints/sensor.py index 6ef0467f7b6..479e59d9cdf 100644 --- a/homeassistant/components/fints/sensor.py +++ b/homeassistant/components/fints/sensor.py @@ -272,7 +272,7 @@ class FinTsHoldingsAccount(SensorEntity): self._attr_native_value = sum(h.total_value for h in self._holdings) @property - def extra_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict[str, Any]: """Additional attributes of the sensor. Lists each holding of the account with the current value. diff --git a/homeassistant/components/gtfs/sensor.py b/homeassistant/components/gtfs/sensor.py index 6cf1a6d4604..77e1d0f7d33 100644 --- a/homeassistant/components/gtfs/sensor.py +++ b/homeassistant/components/gtfs/sensor.py @@ -568,7 +568,7 @@ class GTFSDepartureSensor(SensorEntity): return self._available @property - def extra_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict[str, Any]: """Return the state attributes.""" return self._attributes diff --git a/homeassistant/components/nsw_fuel_station/sensor.py b/homeassistant/components/nsw_fuel_station/sensor.py index 6ebbccc4466..7106b487786 100644 --- a/homeassistant/components/nsw_fuel_station/sensor.py +++ b/homeassistant/components/nsw_fuel_station/sensor.py @@ -117,7 +117,7 @@ class StationPriceSensor( return prices.get((self._station_id, self._fuel_type)) @property - def extra_state_attributes(self) -> dict: + def extra_state_attributes(self) -> dict[str, int | str]: """Return the state attributes of the device.""" return { ATTR_STATION_ID: self._station_id, diff --git a/homeassistant/components/statistics/sensor.py b/homeassistant/components/statistics/sensor.py index 9a87129e5d1..078eb59fe72 100644 --- a/homeassistant/components/statistics/sensor.py +++ b/homeassistant/components/statistics/sensor.py @@ -7,7 +7,7 @@ import contextlib from datetime import datetime, timedelta import logging import statistics -from typing import Any, Literal, cast +from typing import Any, cast import voluptuous as vol @@ -410,7 +410,7 @@ class StatisticsSensor(SensorEntity): return None @property - def state_class(self) -> Literal[SensorStateClass.MEASUREMENT] | None: + def state_class(self) -> SensorStateClass | None: """Return the state class of this entity.""" if self._state_characteristic in STATS_NOT_A_NUMBER: return None diff --git a/homeassistant/components/waze_travel_time/sensor.py b/homeassistant/components/waze_travel_time/sensor.py index f69f9a019fc..ecbf3e9e12a 100644 --- a/homeassistant/components/waze_travel_time/sensor.py +++ b/homeassistant/components/waze_travel_time/sensor.py @@ -3,6 +3,7 @@ from __future__ import annotations from datetime import timedelta import logging +from typing import Any from WazeRouteCalculator import WazeRouteCalculator, WRCError @@ -112,7 +113,7 @@ class WazeTravelTime(SensorEntity): return None @property - def extra_state_attributes(self) -> dict | None: + def extra_state_attributes(self) -> dict[str, Any] | None: """Return the state attributes of the last update.""" if self._waze_data.duration is None: return None