diff --git a/homeassistant/components/fritz/switch.py b/homeassistant/components/fritz/switch.py index 8af5b8ba529..ce89cfc736d 100644 --- a/homeassistant/components/fritz/switch.py +++ b/homeassistant/components/fritz/switch.py @@ -331,7 +331,7 @@ class FritzBoxBaseSwitch(FritzBoxBaseEntity, SwitchEntity): self._name = f"{self._friendly_name} {self._description}" self._unique_id = f"{self._avm_wrapper.unique_id}-{slugify(self._description)}" - self._attributes: dict[str, str] = {} + self._attributes: dict[str, str | None] = {} self._is_available = True @property @@ -355,7 +355,7 @@ class FritzBoxBaseSwitch(FritzBoxBaseEntity, SwitchEntity): return self._is_available @property - def extra_state_attributes(self) -> dict[str, str]: + def extra_state_attributes(self) -> dict[str, str | None]: """Return device attributes.""" return self._attributes diff --git a/homeassistant/components/geniushub/sensor.py b/homeassistant/components/geniushub/sensor.py index 998bd6f1edb..f5cd8625e8b 100644 --- a/homeassistant/components/geniushub/sensor.py +++ b/homeassistant/components/geniushub/sensor.py @@ -85,7 +85,7 @@ class GeniusBattery(GeniusDevice, SensorEntity): return icon @property - def native_value(self) -> str: + def native_value(self) -> int: """Return the state of the sensor.""" level = self._device.data["state"][self._state_attr] return level if level != 255 else 0 diff --git a/homeassistant/components/heos/media_player.py b/homeassistant/components/heos/media_player.py index 820bcb2fb2b..858ebd225b7 100644 --- a/homeassistant/components/heos/media_player.py +++ b/homeassistant/components/heos/media_player.py @@ -377,7 +377,7 @@ class HeosMediaPlayer(MediaPlayerEntity): return self._media_position_updated_at @property - def media_image_url(self) -> str: + def media_image_url(self) -> str | None: """Image url of current playing media.""" # May be an empty string, if so, return None image_url = self._player.now_playing_media.image_url diff --git a/homeassistant/components/keenetic_ndms2/device_tracker.py b/homeassistant/components/keenetic_ndms2/device_tracker.py index e15c96d8353..34c5cb502c6 100644 --- a/homeassistant/components/keenetic_ndms2/device_tracker.py +++ b/homeassistant/components/keenetic_ndms2/device_tracker.py @@ -119,7 +119,7 @@ class KeeneticTracker(ScannerEntity): return f"{self._device.mac}_{self._router.config_entry.entry_id}" @property - def ip_address(self) -> str: + def ip_address(self) -> str | None: """Return the primary ip address of the device.""" return self._device.ip if self.is_connected else None diff --git a/homeassistant/components/knx/config_flow.py b/homeassistant/components/knx/config_flow.py index 22c4a647e80..c526a1e25f6 100644 --- a/homeassistant/components/knx/config_flow.py +++ b/homeassistant/components/knx/config_flow.py @@ -332,6 +332,7 @@ class KNXCommonFlow(ABC, ConfigEntryBaseFlow): self.initial_data.get(CONF_KNX_CONNECTION_TYPE) in CONF_KNX_TUNNELING_TYPE_LABELS ) + ip_address: str | None if ( # initial attempt on ConfigFlow or coming from automatic / routing (isinstance(self, ConfigFlow) or not _reconfiguring_existing_tunnel) and not user_input diff --git a/homeassistant/components/lovelace/dashboard.py b/homeassistant/components/lovelace/dashboard.py index db6db2fa7ef..411bbae9153 100644 --- a/homeassistant/components/lovelace/dashboard.py +++ b/homeassistant/components/lovelace/dashboard.py @@ -56,7 +56,7 @@ class LovelaceConfig(ABC): self.config = None @property - def url_path(self) -> str: + def url_path(self) -> str | None: """Return url path.""" return self.config[CONF_URL_PATH] if self.config else None diff --git a/homeassistant/components/modbus/sensor.py b/homeassistant/components/modbus/sensor.py index 6c6e1ef1830..dbc464e98a9 100644 --- a/homeassistant/components/modbus/sensor.py +++ b/homeassistant/components/modbus/sensor.py @@ -74,7 +74,7 @@ class ModbusRegisterSensor(BaseStructPlatform, RestoreSensor, SensorEntity): super().__init__(hass, hub, entry) if slave_count: self._count = self._count * (slave_count + 1) - self._coordinator: DataUpdateCoordinator[list[int] | None] | None = None + self._coordinator: DataUpdateCoordinator[list[float] | None] | None = None self._attr_native_unit_of_measurement = entry.get(CONF_UNIT_OF_MEASUREMENT) self._attr_state_class = entry.get(CONF_STATE_CLASS) self._attr_device_class = entry.get(CONF_DEVICE_CLASS) @@ -142,7 +142,7 @@ class ModbusRegisterSensor(BaseStructPlatform, RestoreSensor, SensorEntity): class SlaveSensor( - CoordinatorEntity[DataUpdateCoordinator[list[int] | None]], + CoordinatorEntity[DataUpdateCoordinator[list[float] | None]], RestoreSensor, SensorEntity, ): @@ -150,7 +150,7 @@ class SlaveSensor( def __init__( self, - coordinator: DataUpdateCoordinator[list[int] | None], + coordinator: DataUpdateCoordinator[list[float] | None], idx: int, entry: dict[str, Any], ) -> None: diff --git a/homeassistant/components/zwave_me/light.py b/homeassistant/components/zwave_me/light.py index b1065d45160..2289fe7b115 100644 --- a/homeassistant/components/zwave_me/light.py +++ b/homeassistant/components/zwave_me/light.py @@ -84,9 +84,8 @@ class ZWaveMeRGB(ZWaveMeEntity, LightEntity): self.device.id, f"exact?level={round(brightness / 2.55)}" ) return - cmd = "exact?red={}&green={}&blue={}".format( - *color if any(color) else 255, 255, 255 - ) + cmd = "exact?red={}&green={}&blue={}" + cmd = cmd.format(*color) if any(color) else cmd.format(*(255, 255, 255)) self.controller.zwave_api.send_command(self.device.id, cmd) @property