From 301ca88f419ddccc3f77a7ef0005609702c56b2f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 14 May 2025 22:27:25 -0500 Subject: [PATCH] Bump aioesphomeapi to 31.0.1 (#144939) --- .../components/esphome/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/esphome/test_light.py | 49 +++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/esphome/manifest.json b/homeassistant/components/esphome/manifest.json index d1fb3a49166..833fa47337f 100644 --- a/homeassistant/components/esphome/manifest.json +++ b/homeassistant/components/esphome/manifest.json @@ -17,7 +17,7 @@ "mqtt": ["esphome/discover/#"], "quality_scale": "platinum", "requirements": [ - "aioesphomeapi==31.0.0", + "aioesphomeapi==31.0.1", "esphome-dashboard-api==1.3.0", "bleak-esphome==2.15.1" ], diff --git a/requirements_all.txt b/requirements_all.txt index 9c1a484ef2e..9a5807d7b40 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -241,7 +241,7 @@ aioelectricitymaps==0.4.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==31.0.0 +aioesphomeapi==31.0.1 # homeassistant.components.flo aioflo==2021.11.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 7a417bb1ee8..7491190cb92 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -229,7 +229,7 @@ aioelectricitymaps==0.4.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==31.0.0 +aioesphomeapi==31.0.1 # homeassistant.components.flo aioflo==2021.11.0 diff --git a/tests/components/esphome/test_light.py b/tests/components/esphome/test_light.py index 0d2e8338c06..0cf3e10f11e 100644 --- a/tests/components/esphome/test_light.py +++ b/tests/components/esphome/test_light.py @@ -204,6 +204,55 @@ async def test_light_brightness( mock_client.light_command.reset_mock() +async def test_light_legacy_brightness( + hass: HomeAssistant, + mock_client: APIClient, + mock_generic_device_entry: MockGenericDeviceEntryType, +) -> None: + """Test a generic light entity that only supports legacy brightness.""" + mock_client.api_version = APIVersion(1, 7) + entity_info = [ + LightInfo( + object_id="mylight", + key=1, + name="my light", + unique_id="my_light", + min_mireds=153, + max_mireds=400, + supported_color_modes=[LightColorCapability.BRIGHTNESS, 2], + ) + ] + states = [ + LightState( + key=1, state=True, brightness=100, color_mode=ESPColorMode.LEGACY_BRIGHTNESS + ) + ] + user_service = [] + await mock_generic_device_entry( + mock_client=mock_client, + entity_info=entity_info, + user_service=user_service, + states=states, + ) + state = hass.states.get("light.test_mylight") + assert state is not None + assert state.state == STATE_ON + assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ + ColorMode.BRIGHTNESS, + ] + + await hass.services.async_call( + LIGHT_DOMAIN, + SERVICE_TURN_ON, + {ATTR_ENTITY_ID: "light.test_mylight"}, + blocking=True, + ) + mock_client.light_command.assert_has_calls( + [call(key=1, state=True, color_mode=LightColorCapability.BRIGHTNESS)] + ) + mock_client.light_command.reset_mock() + + async def test_light_brightness_on_off( hass: HomeAssistant, mock_client: APIClient,