Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
FROM mcr.microsoft.com/devcontainers/python:1-3.13
FROM mcr.microsoft.com/vscode/devcontainers/base:debian

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Uninstall pre-installed formatting and linting tools
# They would conflict with our pinned versions
RUN \
pipx uninstall pydocstyle \
&& pipx uninstall pycodestyle \
&& pipx uninstall mypy \
&& pipx uninstall pylint

RUN \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& apt-get update \
Expand All @@ -32,21 +24,18 @@ RUN \
libxml2 \
git \
cmake \
autoconf \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Add go2rtc binary
COPY --from=ghcr.io/alexxit/go2rtc:latest /usr/local/bin/go2rtc /bin/go2rtc

# Install uv
RUN pip3 install uv

WORKDIR /usr/src

# Setup hass-release
RUN git clone --depth 1 https://github.com/home-assistant/hass-release \
&& uv pip install --system -e hass-release/ \
&& chown -R vscode /usr/src/hass-release/data
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

RUN uv python install 3.13.2

USER vscode
ENV VIRTUAL_ENV="/home/vscode/.local/ha-venv"
Expand All @@ -55,6 +44,10 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"

WORKDIR /tmp

# Setup hass-release
RUN git clone --depth 1 https://github.com/home-assistant/hass-release ~/hass-release \
&& uv pip install -e ~/hass-release/

# Install Python dependencies from requirements
COPY requirements.txt ./
COPY homeassistant/package_constraints.txt homeassistant/package_constraints.txt
Expand All @@ -65,4 +58,4 @@ RUN uv pip install -r requirements_test.txt
WORKDIR /workspaces

# Set the default shell to bash instead of sh
ENV SHELL /bin/bash
ENV SHELL=/bin/bash
4 changes: 3 additions & 1 deletion homeassistant/components/alexa_devices/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any

from aioamazondevices.api import AmazonEchoApi
from aioamazondevices.exceptions import CannotAuthenticate, CannotConnect
from aioamazondevices.exceptions import CannotAuthenticate, CannotConnect, WrongCountry
import voluptuous as vol

from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
Expand Down Expand Up @@ -57,6 +57,8 @@ async def async_step_user(
errors["base"] = "cannot_connect"
except CannotAuthenticate:
errors["base"] = "invalid_auth"
except WrongCountry:
errors["base"] = "wrong_country"
else:
await self.async_set_unique_id(data["customer_info"]["user_id"])
self._abort_if_unique_id_configured()
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/alexa_devices/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"loggers": ["aioamazondevices"],
"quality_scale": "bronze",
"requirements": ["aioamazondevices==3.1.22"]
"requirements": ["aioamazondevices==3.2.1"]
}
1 change: 1 addition & 0 deletions homeassistant/components/alexa_devices/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"error": {
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]",
"wrong_country": "Wrong country selected. Please select the country where your Amazon account is registered.",
"unknown": "[%key:common::config_flow::error::unknown%]"
}
},
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/bluetooth/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"bleak-retry-connector==3.9.0",
"bluetooth-adapters==0.21.4",
"bluetooth-auto-recovery==1.5.2",
"bluetooth-data-tools==1.28.1",
"bluetooth-data-tools==1.28.2",
"dbus-fast==2.43.0",
"habluetooth==3.49.0"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,14 @@ async def google_generative_ai_config_option_schema(
api_models = [api_model async for api_model in api_models_pager]
models = [
SelectOptionDict(
label=api_model.display_name,
label=api_model.name.lstrip("models/"),
value=api_model.name,
)
for api_model in sorted(api_models, key=lambda x: x.display_name or "")
for api_model in sorted(
api_models, key=lambda x: x.name.lstrip("models/") or ""
)
if (
api_model.display_name
and api_model.name
api_model.name
and ("tts" in api_model.name) == (subentry_type == "tts")
and "vision" not in api_model.name
and api_model.supported_actions
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/ld2410_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"documentation": "https://www.home-assistant.io/integrations/ld2410_ble",
"integration_type": "device",
"iot_class": "local_push",
"requirements": ["bluetooth-data-tools==1.28.1", "ld2410-ble==0.1.1"]
"requirements": ["bluetooth-data-tools==1.28.2", "ld2410-ble==0.1.1"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/led_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/led_ble",
"iot_class": "local_polling",
"requirements": ["bluetooth-data-tools==1.28.1", "led-ble==1.1.7"]
"requirements": ["bluetooth-data-tools==1.28.2", "led-ble==1.1.7"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/matter/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"dependencies": ["websocket_api"],
"documentation": "https://www.home-assistant.io/integrations/matter",
"iot_class": "local_push",
"requirements": ["python-matter-server==7.0.0"],
"requirements": ["python-matter-server==8.0.0"],
"zeroconf": ["_matter._tcp.local.", "_matterc._udp.local."]
}
2 changes: 1 addition & 1 deletion homeassistant/components/playstation_network/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"unit_of_measurement": "[%key:component::playstation_network::entity::sensor::earned_trophies_platinum::unit_of_measurement%]"
},
"online_id": {
"name": "Online-ID"
"name": "Online ID"
},
"last_online": {
"name": "Last online"
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/private_ble_device/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/private_ble_device",
"iot_class": "local_push",
"requirements": ["bluetooth-data-tools==1.28.1"]
"requirements": ["bluetooth-data-tools==1.28.2"]
}
2 changes: 1 addition & 1 deletion homeassistant/components/thermopro/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/thermopro",
"iot_class": "local_push",
"requirements": ["thermopro-ble==0.13.0"]
"requirements": ["thermopro-ble==0.13.1"]
}
2 changes: 1 addition & 1 deletion homeassistant/package_constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bleak-retry-connector==3.9.0
bleak==0.22.3
bluetooth-adapters==0.21.4
bluetooth-auto-recovery==1.5.2
bluetooth-data-tools==1.28.1
bluetooth-data-tools==1.28.2
cached-ipaddress==0.10.0
certifi>=2021.5.30
ciso8601==2.3.2
Expand Down
8 changes: 4 additions & 4 deletions requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/components/alexa_devices/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from unittest.mock import AsyncMock

from aioamazondevices.exceptions import CannotAuthenticate, CannotConnect
from aioamazondevices.exceptions import CannotAuthenticate, CannotConnect, WrongCountry
import pytest

from homeassistant.components.alexa_devices.const import CONF_LOGIN_DATA, DOMAIN
Expand Down Expand Up @@ -57,6 +57,7 @@ async def test_full_flow(
[
(CannotConnect, "cannot_connect"),
(CannotAuthenticate, "invalid_auth"),
(WrongCountry, "wrong_country"),
],
)
async def test_flow_errors(
Expand Down
15 changes: 14 additions & 1 deletion tests/components/eheimdigital/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from unittest.mock import MagicMock

from eheimdigital.types import EheimDeviceType
from eheimdigital.types import EheimDeviceType, EheimDigitalClientError

from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.helpers import device_registry as dr
from homeassistant.setup import async_setup_component
Expand Down Expand Up @@ -54,3 +55,15 @@ async def test_remove_device(
device_entry.id, mock_config_entry.entry_id
)
assert response["success"]


async def test_entry_setup_error(
hass: HomeAssistant,
eheimdigital_hub_mock: MagicMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test errors on setting up the config entry."""

eheimdigital_hub_mock.return_value.connect.side_effect = EheimDigitalClientError()
await init_integration(hass, mock_config_entry)
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY
50 changes: 41 additions & 9 deletions tests/components/eheimdigital/test_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from aiohttp import ClientError
from eheimdigital.classic_led_ctrl import EheimDigitalClassicLEDControl
from eheimdigital.types import EheimDeviceType
from eheimdigital.types import EheimDeviceType, EheimDigitalClientError
from freezegun.api import FrozenDateTimeFactory
import pytest
from syrupy.assertion import SnapshotAssertion
Expand All @@ -24,6 +24,7 @@
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import entity_registry as er
from homeassistant.util.color import value_to_brightness

Expand Down Expand Up @@ -114,20 +115,34 @@ async def test_dynamic_new_devices(
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)


@pytest.mark.usefixtures("eheimdigital_hub_mock")
async def test_turn_off(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
eheimdigital_hub_mock: MagicMock,
classic_led_ctrl_mock: EheimDigitalClassicLEDControl,
) -> None:
"""Test turning off the light."""
await init_integration(hass, mock_config_entry)

await mock_config_entry.runtime_data._async_device_found(
await eheimdigital_hub_mock.call_args.kwargs["device_found_callback"](
"00:00:00:00:00:01", EheimDeviceType.VERSION_EHEIM_CLASSIC_LED_CTRL_PLUS_E
)
await hass.async_block_till_done()

classic_led_ctrl_mock.hub.send_packet.side_effect = EheimDigitalClientError

with pytest.raises(HomeAssistantError) as exc_info:
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_OFF,
{ATTR_ENTITY_ID: "light.mock_classicledcontrol_e_channel_1"},
blocking=True,
)

assert exc_info.value.translation_key == "communication_error"

classic_led_ctrl_mock.hub.send_packet.side_effect = None

await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_OFF,
Expand All @@ -140,9 +155,9 @@ async def test_turn_off(
for call in classic_led_ctrl_mock.hub.mock_calls
if call[0] == "send_packet"
]
assert len(calls) == 2
assert calls[0][1][0].get("title") == "MAN_MODE"
assert calls[1][1][0]["currentValues"][1] == 0
assert len(calls) == 3
assert calls[1][1][0].get("title") == "MAN_MODE"
assert calls[2][1][0]["currentValues"][1] == 0


@pytest.mark.parametrize(
Expand All @@ -169,6 +184,23 @@ async def test_turn_on_brightness(
)
await hass.async_block_till_done()

classic_led_ctrl_mock.hub.send_packet.side_effect = EheimDigitalClientError

with pytest.raises(HomeAssistantError) as exc_info:
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_ON,
{
ATTR_ENTITY_ID: "light.mock_classicledcontrol_e_channel_1",
ATTR_BRIGHTNESS: dim_input,
},
blocking=True,
)

assert exc_info.value.translation_key == "communication_error"

classic_led_ctrl_mock.hub.send_packet.side_effect = None

await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_ON,
Expand All @@ -184,9 +216,9 @@ async def test_turn_on_brightness(
for call in classic_led_ctrl_mock.hub.mock_calls
if call[0] == "send_packet"
]
assert len(calls) == 2
assert calls[0][1][0].get("title") == "MAN_MODE"
assert calls[1][1][0]["currentValues"][1] == expected_dim_value
assert len(calls) == 3
assert calls[1][1][0].get("title") == "MAN_MODE"
assert calls[2][1][0]["currentValues"][1] == expected_dim_value


async def test_turn_on_effect(
Expand Down
Loading
Loading