diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cd1dda31..f4a970b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.6.0 + rev: v0.6.1 hooks: - id: ruff args: diff --git a/changelog.md b/changelog.md index f86d6c84..1706751d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Version 1.65.0 (2024-08-16) -- Bump hahomematic to 2024.8.4 +- Bump hahomematic to 2024.8.5 - Add CED for ELV-SH-WUA / HmIP-WUA - Refactor get_parameters for unignore_candidates - Make load only relevant paramset descriptions configurable diff --git a/custom_components/homematicip_local/config_flow.py b/custom_components/homematicip_local/config_flow.py index fae5f633..46603638 100644 --- a/custom_components/homematicip_local/config_flow.py +++ b/custom_components/homematicip_local/config_flow.py @@ -7,13 +7,7 @@ from typing import Any, Final, cast from urllib.parse import urlparse -from hahomematic.const import ( - DEFAULT_TLS, - InterfaceName, - Operations, - ParamsetKey, - SystemInformation, -) +from hahomematic.const import DEFAULT_TLS, InterfaceName, SystemInformation from hahomematic.exceptions import AuthFailure, BaseHomematicException import voluptuous as vol from voluptuous.schema_builder import UNDEFINED, Schema @@ -80,7 +74,6 @@ CONF_BIDCOS_WIRED_ENABLED: Final = "bidcos_wired_enabled" CONF_BIDCOS_WIRED_PORT: Final = "bidcos_wired_port" - IF_BIDCOS_RF_PORT: Final = 2001 IF_BIDCOS_RF_TLS_PORT: Final = 42001 IF_BIDCOS_WIRED_PORT: Final = 2000 @@ -141,28 +134,6 @@ def get_domain_schema(data: ConfigType) -> Schema: ) -def get_un_ignore_schema(data: ConfigType, all_un_ignore_parameters: list[str]) -> Schema: - """Return the un_ignore schema.""" - existing_parameters: list[str] = [ - p for p in data.get(CONF_UN_IGNORE, []) if p in all_un_ignore_parameters - ] - return vol.Schema( - { - vol.Required( - CONF_UN_IGNORE, - default=existing_parameters, - ): SelectSelector( - config=SelectSelectorConfig( - mode=SelectSelectorMode.DROPDOWN, - multiple=True, - sort=True, - options=all_un_ignore_parameters, - ) - ), - } - ) - - def get_options_schema(data: ConfigType) -> Schema: """Return the options schema.""" options_schema = get_domain_schema(data=data) @@ -226,6 +197,28 @@ def get_interface_schema(use_tls: bool, data: ConfigType, from_config_flow: bool return interface_schema +def get_un_ignore_schema(data: ConfigType, all_un_ignore_parameters: list[str]) -> Schema: + """Return the un_ignore schema.""" + existing_parameters: list[str] = [ + p for p in data.get(CONF_UN_IGNORE, []) if p in all_un_ignore_parameters + ] + return vol.Schema( + { + vol.Required( + CONF_UN_IGNORE, + default=existing_parameters, + ): SelectSelector( + config=SelectSelectorConfig( + mode=SelectSelectorMode.DROPDOWN, + multiple=True, + sort=False, + options=all_un_ignore_parameters, + ) + ), + } + ) + + async def _async_validate_config_and_get_system_information( hass: HomeAssistant, data: ConfigType ) -> SystemInformation | None: @@ -385,7 +378,10 @@ async def async_step_un_ignore( return self.async_show_form( step_id="un_ignore", data_schema=get_un_ignore_schema( - data=self.data, all_un_ignore_parameters=self._get_un_ignore_parameters() + data=self.data, + all_un_ignore_parameters=self._control_unit.central.get_un_ignore_candidates( + include_master=False + ), ), ) _update_un_ignore_input(data=self.data, un_ignore_input=un_ignore_input) @@ -424,39 +420,6 @@ async def _validate_and_finish_options_flow(self) -> ConfigFlowResult: description_placeholders=description_placeholders, ) - def _get_un_ignore_parameters(self) -> list[str]: - """Return all un_ignore parameters.""" - return list( - # 1. request simple parameter list for values parameters - # 2. request full_format parameter list with channel wildcard for values parameters - # 3. request full_format parameter list for values parameters - # 4. request full_format parameter list for master parameters - self._control_unit.central.get_parameters( - paramset_key=ParamsetKey.VALUES, - operations=(Operations.READ, Operations.EVENT), - un_ignore_candidates_only=True, - ) - + self._control_unit.central.get_parameters( - paramset_key=ParamsetKey.VALUES, - operations=(Operations.READ, Operations.EVENT), - full_format=True, - un_ignore_candidates_only=True, - use_channel_wildcard=True, - ) - + self._control_unit.central.get_parameters( - paramset_key=ParamsetKey.VALUES, - operations=(Operations.READ, Operations.EVENT), - full_format=True, - un_ignore_candidates_only=True, - ) - + self._control_unit.central.get_parameters( - paramset_key=ParamsetKey.MASTER, - operations=(Operations.READ,), - full_format=True, - un_ignore_candidates_only=True, - ) - ) - def _get_ccu_data(data: ConfigType, user_input: ConfigType) -> ConfigType: return { diff --git a/custom_components/homematicip_local/control_unit.py b/custom_components/homematicip_local/control_unit.py index 73d5674a..fd9b61cb 100644 --- a/custom_components/homematicip_local/control_unit.py +++ b/custom_components/homematicip_local/control_unit.py @@ -199,6 +199,7 @@ def _create_central(self) -> CentralUnit: interface_configs=interface_configs, start_direct=self._start_direct, un_ignore_list=self._config_data.get(CONF_UN_IGNORE), + load_all_paramset_descriptions=False, ).create_central(extended_validation=False) diff --git a/custom_components/homematicip_local/manifest.json b/custom_components/homematicip_local/manifest.json index 198f313f..33f0a585 100644 --- a/custom_components/homematicip_local/manifest.json +++ b/custom_components/homematicip_local/manifest.json @@ -10,7 +10,7 @@ "iot_class": "local_push", "issue_tracker": "https://github.com/danielperna84/hahomematic/issues", "loggers": ["hahomematic"], - "requirements": ["hahomematic==2024.8.4"], + "requirements": ["hahomematic==2024.8.5"], "ssdp": [ { "manufacturer": "EQ3", diff --git a/requirements_test.txt b/requirements_test.txt index 88b803f7..4b20577d 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,11 +1,11 @@ -r requirements_test_pre_commit.txt async-upnp-client==0.40.0 -hahomematic==2024.8.4 -homeassistant==2024.8.1 +hahomematic==2024.8.5 +homeassistant==2024.8.2 mypy==1.11.1 mypy-dev==1.11.0a9 pre-commit==3.8.0 pydevccu==0.1.8 pylint==3.2.6 -pytest-homeassistant-custom-component==0.13.153 +pytest-homeassistant-custom-component==0.13.154 diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index a31f1455..736817e5 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -1,4 +1,4 @@ bandit==1.7.9 codespell==2.3.0 -ruff==0.6.0 +ruff==0.6.1 yamllint==1.35.1