diff --git a/homeassistant/components/wled/light.py b/homeassistant/components/wled/light.py index 20960ad0bb7..d9240e75efb 100644 --- a/homeassistant/components/wled/light.py +++ b/homeassistant/components/wled/light.py @@ -124,7 +124,7 @@ class WLEDMasterLight(WLEDEntity, LightEntity): # WLED uses 100ms per unit, so 10 = 1 second. data[ATTR_TRANSITION] = round(kwargs[ATTR_TRANSITION] * 10) - await self.coordinator.wled.master(**data) + await self.coordinator.wled.master(**data) # type: ignore[arg-type] @wled_exception_handler async def async_turn_on(self, **kwargs: Any) -> None: @@ -138,7 +138,7 @@ class WLEDMasterLight(WLEDEntity, LightEntity): if ATTR_BRIGHTNESS in kwargs: data[ATTR_BRIGHTNESS] = kwargs[ATTR_BRIGHTNESS] - await self.coordinator.wled.master(**data) + await self.coordinator.wled.master(**data) # type: ignore[arg-type] async def async_effect( self, @@ -195,11 +195,11 @@ class WLEDSegmentLight(WLEDEntity, LightEntity): @property def extra_state_attributes(self) -> dict[str, Any] | None: """Return the state attributes of the entity.""" - playlist = self.coordinator.data.state.playlist + playlist: int | None = self.coordinator.data.state.playlist if playlist == -1: playlist = None - preset = self.coordinator.data.state.preset + preset: int | None = self.coordinator.data.state.preset if preset == -1: preset = None @@ -287,11 +287,11 @@ class WLEDSegmentLight(WLEDEntity, LightEntity): # If there is a single segment, control via the master if len(self.coordinator.data.state.segments) == 1: - await self.coordinator.wled.master(**data) + await self.coordinator.wled.master(**data) # type: ignore[arg-type] return data[ATTR_SEGMENT_ID] = self._segment - await self.coordinator.wled.segment(**data) + await self.coordinator.wled.segment(**data) # type: ignore[arg-type] @wled_exception_handler async def async_turn_on(self, **kwargs: Any) -> None: @@ -389,7 +389,7 @@ class WLEDSegmentLight(WLEDEntity, LightEntity): if speed is not None: data[ATTR_SPEED] = speed - await self.coordinator.wled.segment(**data) + await self.coordinator.wled.segment(**data) # type: ignore[arg-type] @wled_exception_handler async def async_preset( diff --git a/homeassistant/components/wled/manifest.json b/homeassistant/components/wled/manifest.json index b0768897076..b5ac91a1bf8 100644 --- a/homeassistant/components/wled/manifest.json +++ b/homeassistant/components/wled/manifest.json @@ -3,7 +3,7 @@ "name": "WLED", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/wled", - "requirements": ["wled==0.4.4"], + "requirements": ["wled==0.5.0"], "zeroconf": ["_wled._tcp.local."], "codeowners": ["@frenck"], "quality_scale": "platinum", diff --git a/homeassistant/components/wled/sensor.py b/homeassistant/components/wled/sensor.py index 73c012f25c7..f6b9b0d973a 100644 --- a/homeassistant/components/wled/sensor.py +++ b/homeassistant/components/wled/sensor.py @@ -121,8 +121,10 @@ class WLEDWifiSignalSensor(WLEDEntity, SensorEntity): self._attr_unique_id = f"{coordinator.data.info.mac_address}_wifi_signal" @property - def state(self) -> int: + def state(self) -> int | None: """Return the state of the sensor.""" + if not self.coordinator.data.info.wifi: + return None return self.coordinator.data.info.wifi.signal @@ -140,8 +142,10 @@ class WLEDWifiRSSISensor(WLEDEntity, SensorEntity): self._attr_unique_id = f"{coordinator.data.info.mac_address}_wifi_rssi" @property - def state(self) -> int: + def state(self) -> int | None: """Return the state of the sensor.""" + if not self.coordinator.data.info.wifi: + return None return self.coordinator.data.info.wifi.rssi @@ -158,8 +162,10 @@ class WLEDWifiChannelSensor(WLEDEntity, SensorEntity): self._attr_unique_id = f"{coordinator.data.info.mac_address}_wifi_channel" @property - def state(self) -> int: + def state(self) -> int | None: """Return the state of the sensor.""" + if not self.coordinator.data.info.wifi: + return None return self.coordinator.data.info.wifi.channel @@ -176,6 +182,8 @@ class WLEDWifiBSSIDSensor(WLEDEntity, SensorEntity): self._attr_unique_id = f"{coordinator.data.info.mac_address}_wifi_bssid" @property - def state(self) -> str: + def state(self) -> str | None: """Return the state of the sensor.""" + if not self.coordinator.data.info.wifi: + return None return self.coordinator.data.info.wifi.bssid diff --git a/requirements_all.txt b/requirements_all.txt index 509c4133b82..6b554284c87 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2359,7 +2359,7 @@ wirelesstagpy==0.4.1 withings-api==2.3.2 # homeassistant.components.wled -wled==0.4.4 +wled==0.5.0 # homeassistant.components.wolflink wolf_smartset==0.1.8 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 3ec4558d80d..eaf2cf98fb0 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1274,7 +1274,7 @@ wiffi==1.0.1 withings-api==2.3.2 # homeassistant.components.wled -wled==0.4.4 +wled==0.5.0 # homeassistant.components.wolflink wolf_smartset==0.1.8