diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 818aa8132082bd..36902d13356bc2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,11 +24,11 @@ jobs: uses: actions/checkout@v4.2.2 - name: Initialize CodeQL - uses: github/codeql-action/init@v3.28.18 + uses: github/codeql-action/init@v3.28.19 with: languages: python - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3.28.18 + uses: github/codeql-action/analyze@v3.28.19 with: category: "/language:python" diff --git a/homeassistant/components/eddystone_temperature/__init__.py b/homeassistant/components/eddystone_temperature/__init__.py index 2d6f92498bd79c..af37eb629b5e86 100644 --- a/homeassistant/components/eddystone_temperature/__init__.py +++ b/homeassistant/components/eddystone_temperature/__init__.py @@ -1 +1,6 @@ """The eddystone_temperature component.""" + +DOMAIN = "eddystone_temperature" +CONF_BEACONS = "beacons" +CONF_INSTANCE = "instance" +CONF_NAMESPACE = "namespace" diff --git a/homeassistant/components/eddystone_temperature/sensor.py b/homeassistant/components/eddystone_temperature/sensor.py index 1047c52e1115c3..7b8e726cf4528f 100644 --- a/homeassistant/components/eddystone_temperature/sensor.py +++ b/homeassistant/components/eddystone_temperature/sensor.py @@ -23,17 +23,18 @@ STATE_UNKNOWN, UnitOfTemperature, ) -from homeassistant.core import Event, HomeAssistant +from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, Event, HomeAssistant from homeassistant.helpers import config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.issue_registry import IssueSeverity, create_issue from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType +from . import CONF_BEACONS, CONF_INSTANCE, CONF_NAMESPACE, DOMAIN + _LOGGER = logging.getLogger(__name__) -CONF_BEACONS = "beacons" CONF_BT_DEVICE_ID = "bt_device_id" -CONF_INSTANCE = "instance" -CONF_NAMESPACE = "namespace" + BEACON_SCHEMA = vol.Schema( { @@ -58,6 +59,21 @@ def setup_platform( discovery_info: DiscoveryInfoType | None = None, ) -> None: """Validate configuration, create devices and start monitoring thread.""" + create_issue( + hass, + HOMEASSISTANT_DOMAIN, + f"deprecated_system_packages_yaml_integration_{DOMAIN}", + breaks_in_ha_version="2025.12.0", + is_fixable=False, + issue_domain=DOMAIN, + severity=IssueSeverity.WARNING, + translation_key="deprecated_system_packages_yaml_integration", + translation_placeholders={ + "domain": DOMAIN, + "integration_title": "Eddystone", + }, + ) + bt_device_id: int = config[CONF_BT_DEVICE_ID] beacons: dict[str, dict[str, str]] = config[CONF_BEACONS] diff --git a/homeassistant/components/esphome/manifest.json b/homeassistant/components/esphome/manifest.json index d0bed1fdb4eff3..eea0ed060f9587 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.1.0", + "aioesphomeapi==32.0.0", "esphome-dashboard-api==1.3.0", "bleak-esphome==2.16.0" ], diff --git a/homeassistant/components/modbus/manifest.json b/homeassistant/components/modbus/manifest.json index 120175c65c2374..555026b4bda5d2 100644 --- a/homeassistant/components/modbus/manifest.json +++ b/homeassistant/components/modbus/manifest.json @@ -5,5 +5,5 @@ "documentation": "https://www.home-assistant.io/integrations/modbus", "iot_class": "local_polling", "loggers": ["pymodbus"], - "requirements": ["pymodbus==3.8.3"] + "requirements": ["pymodbus==3.9.2"] } diff --git a/homeassistant/components/ollama/__init__.py b/homeassistant/components/ollama/__init__.py index 6983db73cf496b..c828ee0af9f764 100644 --- a/homeassistant/components/ollama/__init__.py +++ b/homeassistant/components/ollama/__init__.py @@ -21,6 +21,7 @@ CONF_MODEL, CONF_NUM_CTX, CONF_PROMPT, + CONF_THINK, DEFAULT_TIMEOUT, DOMAIN, ) @@ -33,6 +34,7 @@ "CONF_MODEL", "CONF_NUM_CTX", "CONF_PROMPT", + "CONF_THINK", "CONF_URL", "DOMAIN", ] diff --git a/homeassistant/components/ollama/config_flow.py b/homeassistant/components/ollama/config_flow.py index d7f874c261c9f9..b94a0fc621d76f 100644 --- a/homeassistant/components/ollama/config_flow.py +++ b/homeassistant/components/ollama/config_flow.py @@ -22,6 +22,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers import llm from homeassistant.helpers.selector import ( + BooleanSelector, NumberSelector, NumberSelectorConfig, NumberSelectorMode, @@ -41,10 +42,12 @@ CONF_MODEL, CONF_NUM_CTX, CONF_PROMPT, + CONF_THINK, DEFAULT_KEEP_ALIVE, DEFAULT_MAX_HISTORY, DEFAULT_MODEL, DEFAULT_NUM_CTX, + DEFAULT_THINK, DEFAULT_TIMEOUT, DOMAIN, MAX_NUM_CTX, @@ -280,6 +283,12 @@ def ollama_config_option_schema( min=-1, max=sys.maxsize, step=1, mode=NumberSelectorMode.BOX ) ), + vol.Optional( + CONF_THINK, + description={ + "suggested_value": options.get("think", DEFAULT_THINK), + }, + ): BooleanSelector(), } diff --git a/homeassistant/components/ollama/const.py b/homeassistant/components/ollama/const.py index 857f0bff34a2a5..ebace6404b2a45 100644 --- a/homeassistant/components/ollama/const.py +++ b/homeassistant/components/ollama/const.py @@ -4,6 +4,7 @@ CONF_MODEL = "model" CONF_PROMPT = "prompt" +CONF_THINK = "think" CONF_KEEP_ALIVE = "keep_alive" DEFAULT_KEEP_ALIVE = -1 # seconds. -1 = indefinite, 0 = never @@ -15,6 +16,7 @@ DEFAULT_NUM_CTX = 8192 MIN_NUM_CTX = 2048 MAX_NUM_CTX = 131072 +DEFAULT_THINK = False CONF_MAX_HISTORY = "max_history" DEFAULT_MAX_HISTORY = 20 diff --git a/homeassistant/components/ollama/conversation.py b/homeassistant/components/ollama/conversation.py index 6c507030ad300d..928d556508161d 100644 --- a/homeassistant/components/ollama/conversation.py +++ b/homeassistant/components/ollama/conversation.py @@ -24,6 +24,7 @@ CONF_MODEL, CONF_NUM_CTX, CONF_PROMPT, + CONF_THINK, DEFAULT_KEEP_ALIVE, DEFAULT_MAX_HISTORY, DEFAULT_NUM_CTX, @@ -256,6 +257,7 @@ async def _async_handle_message( # keep_alive requires specifying unit. In this case, seconds keep_alive=f"{settings.get(CONF_KEEP_ALIVE, DEFAULT_KEEP_ALIVE)}s", options={CONF_NUM_CTX: settings.get(CONF_NUM_CTX, DEFAULT_NUM_CTX)}, + think=settings.get(CONF_THINK), ) except (ollama.RequestError, ollama.ResponseError) as err: _LOGGER.error("Unexpected error talking to Ollama server: %s", err) diff --git a/homeassistant/components/ollama/strings.json b/homeassistant/components/ollama/strings.json index 248cac34f115b5..c60b0ef7ebdaae 100644 --- a/homeassistant/components/ollama/strings.json +++ b/homeassistant/components/ollama/strings.json @@ -30,12 +30,14 @@ "llm_hass_api": "[%key:common::config_flow::data::llm_hass_api%]", "max_history": "Max history messages", "num_ctx": "Context window size", - "keep_alive": "Keep alive" + "keep_alive": "Keep alive", + "think": "Think before responding" }, "data_description": { "prompt": "Instruct how the LLM should respond. This can be a template.", "keep_alive": "Duration in seconds for Ollama to keep model in memory. -1 = indefinite, 0 = never.", - "num_ctx": "Maximum number of text tokens the model can process. Lower to reduce Ollama RAM, or increase for a large number of exposed entities." + "num_ctx": "Maximum number of text tokens the model can process. Lower to reduce Ollama RAM, or increase for a large number of exposed entities.", + "think": "If enabled, the LLM will think before responding. This can improve response quality but may increase latency." } } } diff --git a/homeassistant/components/vera/manifest.json b/homeassistant/components/vera/manifest.json index 211162bcbdc30c..bc4724c1638e0a 100644 --- a/homeassistant/components/vera/manifest.json +++ b/homeassistant/components/vera/manifest.json @@ -6,5 +6,5 @@ "documentation": "https://www.home-assistant.io/integrations/vera", "iot_class": "local_polling", "loggers": ["pyvera"], - "requirements": ["pyvera==0.3.15"] + "requirements": ["pyvera==0.3.16"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 4d4eafe6e825d4..ce47bcee5d9a37 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -145,7 +145,7 @@ iso4217!=1.10.20220401 # protobuf must be in package constraints for the wheel # builder to build binary wheels -protobuf==6.30.2 +protobuf==6.31.1 # faust-cchardet: Ensure we have a version we can build wheels # 2.1.18 is the first version that works with our wheel builder diff --git a/pyproject.toml b/pyproject.toml index 6291ef5193aa9f..f0d0a71c9b1e93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -492,6 +492,7 @@ asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" filterwarnings = [ "error::sqlalchemy.exc.SAWarning", + "error:usefixtures\\(\\) in .* without arguments has no effect:UserWarning", # pytest # -- HomeAssistant - aiohttp # Overwrite web.Application to pass a custom default argument to _make_request diff --git a/requirements_all.txt b/requirements_all.txt index ae13af603f30ad..b64dbc542bfc62 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -244,7 +244,7 @@ aioelectricitymaps==0.4.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==31.1.0 +aioesphomeapi==32.0.0 # homeassistant.components.flo aioflo==2021.11.0 @@ -2147,7 +2147,7 @@ pymitv==1.4.3 pymochad==0.2.0 # homeassistant.components.modbus -pymodbus==3.8.3 +pymodbus==3.9.2 # homeassistant.components.monoprice pymonoprice==0.4 @@ -2556,7 +2556,7 @@ pyuptimerobot==22.2.0 # pyuserinput==0.1.11 # homeassistant.components.vera -pyvera==0.3.15 +pyvera==0.3.16 # homeassistant.components.versasense pyversasense==0.0.6 diff --git a/requirements_test.txt b/requirements_test.txt index c0494d93705141..dca3b8f9675b39 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -30,7 +30,7 @@ pytest-timeout==2.4.0 pytest-unordered==0.6.1 pytest-picked==0.5.1 pytest-xdist==3.7.0 -pytest==8.3.5 +pytest==8.4.0 requests-mock==1.12.1 respx==0.22.0 syrupy==4.9.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c03f584e7d1ef4..9e1e499f61e2f8 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -232,7 +232,7 @@ aioelectricitymaps==0.4.0 aioemonitor==1.0.5 # homeassistant.components.esphome -aioesphomeapi==31.1.0 +aioesphomeapi==32.0.0 # homeassistant.components.flo aioflo==2021.11.0 @@ -533,6 +533,9 @@ babel==2.15.0 # homeassistant.components.homekit base36==0.1.1 +# homeassistant.components.eddystone_temperature +# beacontools[scan]==2.1.0 + # homeassistant.components.scrape beautifulsoup4==4.13.3 @@ -1780,7 +1783,7 @@ pymiele==0.5.2 pymochad==0.2.0 # homeassistant.components.modbus -pymodbus==3.8.3 +pymodbus==3.9.2 # homeassistant.components.monoprice pymonoprice==0.4 @@ -2111,7 +2114,7 @@ pyuptimerobot==22.2.0 # pyuserinput==0.1.11 # homeassistant.components.vera -pyvera==0.3.15 +pyvera==0.3.16 # homeassistant.components.vesync pyvesync==2.1.18 diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index f4c2ee8da6a36f..ac717b97185ba0 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -170,7 +170,7 @@ # protobuf must be in package constraints for the wheel # builder to build binary wheels -protobuf==6.30.2 +protobuf==6.31.1 # faust-cchardet: Ensure we have a version we can build wheels # 2.1.18 is the first version that works with our wheel builder diff --git a/script/licenses.py b/script/licenses.py index c3b9399d6b8a27..3330d99b4a5fe8 100644 --- a/script/licenses.py +++ b/script/licenses.py @@ -201,7 +201,6 @@ def from_dict(cls, data: PackageMetadata) -> PackageDefinition: "pymitv", # MIT "pybbox", # https://github.com/HydrelioxGitHub/pybbox/pull/5 "pysabnzbd", # https://github.com/jeradM/pysabnzbd/pull/6 - "pyvera", # https://github.com/maximvelichko/pyvera/pull/164 "sharp_aquos_rc", # https://github.com/jmoore987/sharp_aquos_rc/pull/14 "tapsaff", # https://github.com/bazwilliams/python-taps-aff/pull/5 } diff --git a/tests/components/backup/test_manager.py b/tests/components/backup/test_manager.py index 59c1bf24b212c5..f641ce75867a52 100644 --- a/tests/components/backup/test_manager.py +++ b/tests/components/backup/test_manager.py @@ -1866,7 +1866,7 @@ async def _mock_step(hass: HomeAssistant) -> None: BackupManagerExceptionGroup, ( "Multiple errors when creating backup: Error during pre-backup: Boom, " - "Error during post-backup: Test exception (2 sub-exceptions)" + "Error during post-backup: Test exception" ), ), ( @@ -1874,7 +1874,7 @@ async def _mock_step(hass: HomeAssistant) -> None: BackupManagerExceptionGroup, ( "Multiple errors when creating backup: Error during pre-backup: Boom, " - "Error during post-backup: Test exception (2 sub-exceptions)" + "Error during post-backup: Test exception" ), ), ], diff --git a/tests/components/eddystone_temperature/__init__.py b/tests/components/eddystone_temperature/__init__.py new file mode 100644 index 00000000000000..af67530c946c0e --- /dev/null +++ b/tests/components/eddystone_temperature/__init__.py @@ -0,0 +1 @@ +"""Tests for eddystone temperature.""" diff --git a/tests/components/eddystone_temperature/test_sensor.py b/tests/components/eddystone_temperature/test_sensor.py new file mode 100644 index 00000000000000..056681fdb90599 --- /dev/null +++ b/tests/components/eddystone_temperature/test_sensor.py @@ -0,0 +1,45 @@ +"""Tests for eddystone temperature.""" + +from unittest.mock import Mock, patch + +from homeassistant.components.eddystone_temperature import ( + CONF_BEACONS, + CONF_INSTANCE, + CONF_NAMESPACE, + DOMAIN, +) +from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN +from homeassistant.const import CONF_PLATFORM +from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant +from homeassistant.helpers import issue_registry as ir +from homeassistant.setup import async_setup_component + + +@patch.dict("sys.modules", beacontools=Mock()) +async def test_repair_issue_is_created( + hass: HomeAssistant, + issue_registry: ir.IssueRegistry, +) -> None: + """Test repair issue is created.""" + assert await async_setup_component( + hass, + PLATFORM_DOMAIN, + { + PLATFORM_DOMAIN: [ + { + CONF_PLATFORM: DOMAIN, + CONF_BEACONS: { + "living_room": { + CONF_NAMESPACE: "112233445566778899AA", + CONF_INSTANCE: "000000000001", + } + }, + } + ], + }, + ) + await hass.async_block_till_done() + assert ( + HOMEASSISTANT_DOMAIN, + f"deprecated_system_packages_yaml_integration_{DOMAIN}", + ) in issue_registry.issues diff --git a/tests/components/ollama/test_config_flow.py b/tests/components/ollama/test_config_flow.py index 7755f2208b43d6..34282f25e90491 100644 --- a/tests/components/ollama/test_config_flow.py +++ b/tests/components/ollama/test_config_flow.py @@ -168,6 +168,7 @@ async def test_options( ollama.CONF_PROMPT: "test prompt", ollama.CONF_MAX_HISTORY: 100, ollama.CONF_NUM_CTX: 32768, + ollama.CONF_THINK: True, }, ) await hass.async_block_till_done() @@ -176,6 +177,7 @@ async def test_options( ollama.CONF_PROMPT: "test prompt", ollama.CONF_MAX_HISTORY: 100, ollama.CONF_NUM_CTX: 32768, + ollama.CONF_THINK: True, } diff --git a/tests/components/ollama/test_conversation.py b/tests/components/ollama/test_conversation.py index c718aab1e81073..8e54018a14d496 100644 --- a/tests/components/ollama/test_conversation.py +++ b/tests/components/ollama/test_conversation.py @@ -650,3 +650,47 @@ async def test_options( assert mock_chat.call_count == 1 args = mock_chat.call_args.kwargs assert args.get("options") == expected_options + + +@pytest.mark.parametrize( + "think", + [False, True], + ids=["no_think", "think"], +) +async def test_reasoning_filter( + hass: HomeAssistant, + mock_config_entry: MockConfigEntry, + mock_init_component, + think: bool, +) -> None: + """Test that think option is passed correctly to client.""" + + agent_id = mock_config_entry.entry_id + entry = MockConfigEntry() + entry.add_to_hass(hass) + + hass.config_entries.async_update_entry( + mock_config_entry, + options={ + ollama.CONF_THINK: think, + }, + ) + + with patch( + "ollama.AsyncClient.chat", + return_value=stream_generator( + {"message": {"role": "assistant", "content": "test response"}} + ), + ) as mock_chat: + await conversation.async_converse( + hass, + "test message", + None, + Context(), + agent_id=agent_id, + ) + + # Assert called with the expected think value + for call in mock_chat.call_args_list: + kwargs = call.kwargs + assert kwargs.get("think") == think diff --git a/tests/components/workday/test_config_flow.py b/tests/components/workday/test_config_flow.py index c05da654f96822..2c0e9aa1123b8b 100644 --- a/tests/components/workday/test_config_flow.py +++ b/tests/components/workday/test_config_flow.py @@ -28,9 +28,8 @@ from . import init_integration -pytestmark = pytest.mark.usefixtures("mock_setup_entry") - +@pytest.mark.usefixtures("mock_setup_entry") async def test_form(hass: HomeAssistant) -> None: """Test we get the forms.""" @@ -74,6 +73,7 @@ async def test_form(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_province_no_alias(hass: HomeAssistant) -> None: """Test we get the forms.""" @@ -115,6 +115,7 @@ async def test_form_province_no_alias(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_no_country(hass: HomeAssistant) -> None: """Test we get the forms correctly without a country.""" @@ -154,6 +155,7 @@ async def test_form_no_country(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_no_subdivision(hass: HomeAssistant) -> None: """Test we get the forms correctly without subdivision.""" @@ -196,6 +198,7 @@ async def test_form_no_subdivision(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form(hass: HomeAssistant) -> None: """Test we get the form in options.""" @@ -242,6 +245,7 @@ async def test_options_form(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_incorrect_dates(hass: HomeAssistant) -> None: """Test errors in setup entry.""" @@ -314,6 +318,7 @@ async def test_form_incorrect_dates(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form_incorrect_dates(hass: HomeAssistant) -> None: """Test errors in options.""" @@ -390,6 +395,7 @@ async def test_options_form_incorrect_dates(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form_abort_duplicate(hass: HomeAssistant) -> None: """Test errors in options for duplicates.""" @@ -443,6 +449,7 @@ async def test_options_form_abort_duplicate(hass: HomeAssistant) -> None: assert result2["errors"] == {"base": "already_configured"} +@pytest.mark.usefixtures("mock_setup_entry") async def test_form_incorrect_date_range(hass: HomeAssistant) -> None: """Test errors in setup entry.""" @@ -515,6 +522,7 @@ async def test_form_incorrect_date_range(hass: HomeAssistant) -> None: } +@pytest.mark.usefixtures("mock_setup_entry") async def test_options_form_incorrect_date_ranges(hass: HomeAssistant) -> None: """Test errors in options.""" @@ -591,9 +599,6 @@ async def test_options_form_incorrect_date_ranges(hass: HomeAssistant) -> None: } -pytestmark = pytest.mark.usefixtures() - - @pytest.mark.parametrize( ("language", "holiday"), [ diff --git a/tests/test_test_fixtures.py b/tests/test_test_fixtures.py index 0bada601a3bfbb..e220b1f4574317 100644 --- a/tests/test_test_fixtures.py +++ b/tests/test_test_fixtures.py @@ -5,6 +5,7 @@ import pathlib import socket +from _pytest.compat import get_real_func from aiohttp import web import pytest import pytest_socket @@ -100,7 +101,7 @@ async def test_evict_faked_translations(hass: HomeAssistant, translations_once) # The evict_faked_translations fixture has module scope, so we set it up and # tear it down manually - real_func = evict_faked_translations.__pytest_wrapped__.obj + real_func = get_real_func(evict_faked_translations) gen: Generator = real_func(translations_once) # Set up the evict_faked_translations fixture