diff --git a/homeassistant/components/govee_light_local/light.py b/homeassistant/components/govee_light_local/light.py index cb2e24fa8a6..c7799a7ffc4 100644 --- a/homeassistant/components/govee_light_local/light.py +++ b/homeassistant/components/govee_light_local/light.py @@ -5,7 +5,7 @@ from __future__ import annotations import logging from typing import Any -from govee_local_api import GoveeDevice, GoveeLightCapability +from govee_local_api import GoveeDevice, GoveeLightFeatures from homeassistant.components.light import ( ATTR_BRIGHTNESS, @@ -71,13 +71,13 @@ class GoveeLight(CoordinatorEntity[GoveeLocalApiCoordinator], LightEntity): capabilities = device.capabilities color_modes = {ColorMode.ONOFF} if capabilities: - if GoveeLightCapability.COLOR_RGB in capabilities: + if GoveeLightFeatures.COLOR_RGB & capabilities.features: color_modes.add(ColorMode.RGB) - if GoveeLightCapability.COLOR_KELVIN_TEMPERATURE in capabilities: + if GoveeLightFeatures.COLOR_KELVIN_TEMPERATURE & capabilities.features: color_modes.add(ColorMode.COLOR_TEMP) self._attr_max_color_temp_kelvin = 9000 self._attr_min_color_temp_kelvin = 2000 - if GoveeLightCapability.BRIGHTNESS in capabilities: + if GoveeLightFeatures.BRIGHTNESS & capabilities.features: color_modes.add(ColorMode.BRIGHTNESS) self._attr_supported_color_modes = filter_supported_color_modes(color_modes) diff --git a/homeassistant/components/govee_light_local/manifest.json b/homeassistant/components/govee_light_local/manifest.json index a94d4e58e9a..e813ab545df 100644 --- a/homeassistant/components/govee_light_local/manifest.json +++ b/homeassistant/components/govee_light_local/manifest.json @@ -6,5 +6,5 @@ "dependencies": ["network"], "documentation": "https://www.home-assistant.io/integrations/govee_light_local", "iot_class": "local_push", - "requirements": ["govee-local-api==1.5.3"] + "requirements": ["govee-local-api==2.0.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index 48fe3b24a16..608ba7b79f5 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1055,7 +1055,7 @@ gotailwind==0.3.0 govee-ble==0.42.1 # homeassistant.components.govee_light_local -govee-local-api==1.5.3 +govee-local-api==2.0.0 # homeassistant.components.remote_rpi_gpio gpiozero==1.6.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 400a1522bb8..a0bf2263de4 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -905,7 +905,7 @@ gotailwind==0.3.0 govee-ble==0.42.1 # homeassistant.components.govee_light_local -govee-local-api==1.5.3 +govee-local-api==2.0.0 # homeassistant.components.gpsd gps3==0.33.3 diff --git a/tests/components/govee_light_local/conftest.py b/tests/components/govee_light_local/conftest.py index 6a8ee99b764..61a6394bd6a 100644 --- a/tests/components/govee_light_local/conftest.py +++ b/tests/components/govee_light_local/conftest.py @@ -4,7 +4,8 @@ from asyncio import Event from collections.abc import Generator from unittest.mock import AsyncMock, MagicMock, patch -from govee_local_api import GoveeLightCapability +from govee_local_api import GoveeLightCapabilities +from govee_local_api.light_capabilities import COMMON_FEATURES import pytest from homeassistant.components.govee_light_local.coordinator import GoveeController @@ -34,8 +35,6 @@ def fixture_mock_setup_entry() -> Generator[AsyncMock]: yield mock_setup_entry -DEFAULT_CAPABILITEIS: set[GoveeLightCapability] = { - GoveeLightCapability.COLOR_RGB, - GoveeLightCapability.COLOR_KELVIN_TEMPERATURE, - GoveeLightCapability.BRIGHTNESS, -} +DEFAULT_CAPABILITIES: GoveeLightCapabilities = GoveeLightCapabilities( + features=COMMON_FEATURES, segments=[], scenes={} +) diff --git a/tests/components/govee_light_local/test_config_flow.py b/tests/components/govee_light_local/test_config_flow.py index 2e7144fae3a..103159f1a2b 100644 --- a/tests/components/govee_light_local/test_config_flow.py +++ b/tests/components/govee_light_local/test_config_flow.py @@ -10,7 +10,7 @@ from homeassistant.components.govee_light_local.const import DOMAIN from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType -from .conftest import DEFAULT_CAPABILITEIS +from .conftest import DEFAULT_CAPABILITIES def _get_devices(mock_govee_api: AsyncMock) -> list[GoveeDevice]: @@ -20,7 +20,7 @@ def _get_devices(mock_govee_api: AsyncMock) -> list[GoveeDevice]: ip="192.168.1.100", fingerprint="asdawdqwdqwd1", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ] diff --git a/tests/components/govee_light_local/test_light.py b/tests/components/govee_light_local/test_light.py index 4a1125643fa..24bdbba9e11 100644 --- a/tests/components/govee_light_local/test_light.py +++ b/tests/components/govee_light_local/test_light.py @@ -10,7 +10,7 @@ from homeassistant.components.light import ATTR_SUPPORTED_COLOR_MODES, ColorMode from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant -from .conftest import DEFAULT_CAPABILITEIS +from .conftest import DEFAULT_CAPABILITIES from tests.common import MockConfigEntry @@ -26,7 +26,7 @@ async def test_light_known_device( ip="192.168.1.100", fingerprint="asdawdqwdqwd", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ] @@ -96,7 +96,7 @@ async def test_light_remove(hass: HomeAssistant, mock_govee_api: AsyncMock) -> N ip="192.168.1.100", fingerprint="asdawdqwdqwd1", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ] @@ -152,7 +152,7 @@ async def test_light_setup_retry_eaddrinuse( ip="192.168.1.100", fingerprint="asdawdqwdqwd", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ] @@ -180,7 +180,7 @@ async def test_light_setup_error( ip="192.168.1.100", fingerprint="asdawdqwdqwd", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ] @@ -204,7 +204,7 @@ async def test_light_on_off(hass: HomeAssistant, mock_govee_api: MagicMock) -> N ip="192.168.1.100", fingerprint="asdawdqwdqwd", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ] @@ -260,7 +260,7 @@ async def test_light_brightness(hass: HomeAssistant, mock_govee_api: MagicMock) ip="192.168.1.100", fingerprint="asdawdqwdqwd", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ] @@ -335,7 +335,7 @@ async def test_light_color(hass: HomeAssistant, mock_govee_api: MagicMock) -> No ip="192.168.1.100", fingerprint="asdawdqwdqwd", sku="H615A", - capabilities=DEFAULT_CAPABILITEIS, + capabilities=DEFAULT_CAPABILITIES, ) ]