diff --git a/aiounifi/models/device.py b/aiounifi/models/device.py index b19a2bb9a..dcb2fb6d8 100644 --- a/aiounifi/models/device.py +++ b/aiounifi/models/device.py @@ -943,7 +943,10 @@ def led_override_color(self) -> str | None: @property def led_override_color_brightness(self) -> int | None: """LED override color brightness.""" - return self.raw.get("led_override_color_brightness") + if (value := self.raw.get("led_override_color_brightness")) is not None: + # UniFi API has been observed to return string values for this field. + return int(value) + return None @property def lldp_table(self) -> list[TypedDeviceLldpTable]: diff --git a/pyproject.toml b/pyproject.toml index 1251dcd0e..a288cda67 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "aiounifi" -version = "87" +version = "88" license = {text = "MIT"} description = "Python library for communicating with UniFi Network Controller API" readme = "README.md" diff --git a/tests/test_devices.py b/tests/test_devices.py index 071a9050d..f8f435be2 100644 --- a/tests/test_devices.py +++ b/tests/test_devices.py @@ -717,6 +717,27 @@ "wlan_overrides": [], }, ), + # UniFi API has been observed to return string values for led_override_color_brightness. + ( + [ + { + "mac": "00:11:22:33:44:55", + "model": "UP1", + "type": "uap", + "version": "1.0.0", + "led_override": "on", + "led_override_color": "#ff0000", + "led_override_color_brightness": "75", + } + ], + { + "mac": "00:11:22:33:44:55", + "model": "UP1", + "led_override": "on", + "led_override_color": "#ff0000", + "led_override_color_brightness": 75, + }, + ), ]