Skip to content

Commit

Permalink
Bump hahomematic to 2024.9.10 (#725)
Browse files Browse the repository at this point in the history
* Bump hahomematic to 2024.9.10

* Bump hahomematic to 2024.9.10
  • Loading branch information
SukramJ authored Sep 24, 2024
1 parent aec70b2 commit 60bfc90
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 131 deletions.
30 changes: 7 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,6 @@ json_port:
required: false
description: Port used the access the JSON-RPC API.
type: integer
sysvar_scan_enabled:
required: true
description: Enable system variable/program scanning.
type: boolean
default: true
sysvar_scan_interval:
required: true
description:
Interval in seconds between system variable/program scans. The minimum value is 5.
Intervals of less than 15s are not recommended, and put a lot of strain on slow backend systems in particular.
Instead, a higher interval with an on-demand call from the `homematicip_local.fetch_system_variables` service is recommended.
type: integer
default: 30
enable_system_notifications:
required: true
description:
Control if system notification should be displayed. Affects CALLBACK and PINGPONG notifications.
It's not recommended to disable this option, because this would hide problems on your system.
A better option is to solve the communication problems in your environment.
type: integer
default: true
```
#### Interface
Expand Down Expand Up @@ -229,9 +208,14 @@ hs485d_port:
#### Advanced
```yaml
program_scan_enabled:
required: true
description: Enable program scanning.
type: boolean
default: true
sysvar_scan_enabled:
required: true
description: Enable system variable/program scanning.
description: Enable system program scanning.
type: boolean
default: true
sysvar_scan_interval:
Expand All @@ -250,7 +234,7 @@ enable_system_notifications:
A better option is to solve the communication problems in your environment.
type: integer
default: true
un_ignore:
un_ignore: (Only visible when reconfiguring the integration)
required: false
description:
Add additional datapoints/parameters to your instance. See Unignore device parameters
Expand Down
12 changes: 10 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
- Use service get_link_paramset to read direct connections

## What's Changed
- Bump hahomematic to 2024.9.9
- Bump hahomematic to 2024.9.10
- Add bind_collector to all relevant methods with option to disable it
- Add check for link paramsets
- Add getLinkPeers XmlRPC method
- Add missing PayloadMixin
- Add name to channel
- Add paramset_key to entity_key
- Adjust payload and path
- Avoid permanent cache save on remove device
- Catch bind address errors of xml rpc server
- Check rx_mode
- Do not create update entities that are not updatable (manually remove obsolete update entities)
- Ensure only one load/save of cache file at time
Expand All @@ -23,16 +25,22 @@
- Mark only level as relevant entity for DALI
- Only try device update refresh if device is updatable
- Refactor device/entity to extract channel
- Refactor get_events, get_new_entities
- Refactor update entity
- Remove unnecessary checks
- Rename value_property to state_property
- Replace device_type by model
- Separate enable/disable sysvar and program scan
- Shorten names
- Small definition fix for DALI
- Switch typing of paramset_key from str to ParamsetKey
- Use channel instead of channel_addresses
- Use TypedDict for device_description
- Use TypedDict for parameter_data
- Use channel instead of channel_addresses
- Use paramset_description from channel
- Use validator for local schema
- Add advanced options to config flow
- Add option to enable/disable program scan to advanced options
- Add services get_link_peers, get_link_paramset, put_link_paramset
- Improve german descriptions by @baxxy13
- Use domain alias
Expand Down
20 changes: 13 additions & 7 deletions custom_components/homematicip_local/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
from .const import (
CONF_ADVANCED_CONFIG,
CONF_ENABLE_SYSTEM_NOTIFICATIONS,
CONF_PROGRAM_SCAN_ENABLED,
CONF_SYS_SCAN_INTERVAL,
CONF_SYSVAR_SCAN_ENABLED,
CONF_SYSVAR_SCAN_INTERVAL,
CONF_UN_IGNORE,
DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS,
DEFAULT_SYS_SCAN_INTERVAL,
DEFAULT_SYSVAR_SCAN_ENABLED,
DEFAULT_SYSVAR_SCAN_INTERVAL,
DEFAULT_UN_IGNORE,
DOMAIN,
HMIP_LOCAL_MIN_VERSION,
Expand Down Expand Up @@ -169,17 +170,15 @@ def update_entity_unique_id(entity_entry: er.RegistryEntry) -> dict[str, str] |
CONF_SYSVAR_SCAN_ENABLED: data.get(
CONF_SYSVAR_SCAN_ENABLED, DEFAULT_SYSVAR_SCAN_ENABLED
),
CONF_SYSVAR_SCAN_INTERVAL: data.get(
CONF_SYSVAR_SCAN_INTERVAL, DEFAULT_SYSVAR_SCAN_INTERVAL
),
CONF_SYS_SCAN_INTERVAL: data.get(CONF_SYS_SCAN_INTERVAL, DEFAULT_SYS_SCAN_INTERVAL),
CONF_ENABLE_SYSTEM_NOTIFICATIONS: data.get(
CONF_ENABLE_SYSTEM_NOTIFICATIONS, DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS
),
CONF_UN_IGNORE: data.get(CONF_UN_IGNORE, DEFAULT_UN_IGNORE),
}
default_advanced_config = {
CONF_SYSVAR_SCAN_ENABLED: DEFAULT_SYSVAR_SCAN_ENABLED,
CONF_SYSVAR_SCAN_INTERVAL: DEFAULT_SYSVAR_SCAN_INTERVAL,
CONF_SYS_SCAN_INTERVAL: DEFAULT_SYS_SCAN_INTERVAL,
CONF_ENABLE_SYSTEM_NOTIFICATIONS: DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS,
CONF_UN_IGNORE: DEFAULT_UN_IGNORE,
}
Expand All @@ -192,7 +191,7 @@ def del_param(name: str) -> None:
del data[name]

del_param(name=CONF_SYSVAR_SCAN_ENABLED)
del_param(name=CONF_SYSVAR_SCAN_INTERVAL)
del_param(name=CONF_SYS_SCAN_INTERVAL)
del_param(name=CONF_ENABLE_SYSTEM_NOTIFICATIONS)
del_param(name=CONF_UN_IGNORE)

Expand All @@ -206,5 +205,12 @@ def del_param(name: str) -> None:
instance_name=entry.data["instance_name"], storage_folder=get_storage_folder(hass=hass)
)
hass.config_entries.async_update_entry(entry, version=6, data=data)
if entry.version == 6:
data = dict(entry.data)
if data.get(CONF_ADVANCED_CONFIG):
data[CONF_ADVANCED_CONFIG][CONF_PROGRAM_SCAN_ENABLED] = data[CONF_ADVANCED_CONFIG][
CONF_SYSVAR_SCAN_ENABLED
]
hass.config_entries.async_update_entry(entry, version=7, data=data)
_LOGGER.info("Migration to version %s successful", entry.version)
return True
74 changes: 54 additions & 20 deletions custom_components/homematicip_local/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@
CONF_INSTANCE_NAME,
CONF_INTERFACE,
CONF_JSON_PORT,
CONF_PROGRAM_SCAN_ENABLED,
CONF_SYS_SCAN_INTERVAL,
CONF_SYSVAR_SCAN_ENABLED,
CONF_SYSVAR_SCAN_INTERVAL,
CONF_TLS,
CONF_UN_IGNORE,
CONF_VERIFY_TLS,
DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS,
DEFAULT_PROGRAM_SCAN_ENABLED,
DEFAULT_SYS_SCAN_INTERVAL,
DEFAULT_SYSVAR_SCAN_ENABLED,
DEFAULT_SYSVAR_SCAN_INTERVAL,
DEFAULT_UN_IGNORE,
DOMAIN,
)
Expand Down Expand Up @@ -205,18 +207,24 @@ def get_advanced_schema(data: ConfigType, all_un_ignore_parameters: list[str]) -
for p in data.get(CONF_ADVANCED_CONFIG, {}).get(CONF_UN_IGNORE, DEFAULT_UN_IGNORE)
if p in all_un_ignore_parameters
]
return vol.Schema(
advanced_schema = vol.Schema(
{
vol.Required(
CONF_PROGRAM_SCAN_ENABLED,
default=data.get(CONF_ADVANCED_CONFIG, {}).get(
CONF_PROGRAM_SCAN_ENABLED, DEFAULT_PROGRAM_SCAN_ENABLED
),
): BOOLEAN_SELECTOR,
vol.Required(
CONF_SYSVAR_SCAN_ENABLED,
default=data.get(CONF_ADVANCED_CONFIG, {}).get(
CONF_SYSVAR_SCAN_ENABLED, DEFAULT_SYSVAR_SCAN_ENABLED
),
): BOOLEAN_SELECTOR,
vol.Required(
CONF_SYSVAR_SCAN_INTERVAL,
CONF_SYS_SCAN_INTERVAL,
default=data.get(CONF_ADVANCED_CONFIG, {}).get(
CONF_SYSVAR_SCAN_INTERVAL, DEFAULT_SYSVAR_SCAN_INTERVAL
CONF_SYS_SCAN_INTERVAL, DEFAULT_SYS_SCAN_INTERVAL
),
): SCAN_INTERVAL_SELECTOR,
vol.Required(
Expand All @@ -225,7 +233,7 @@ def get_advanced_schema(data: ConfigType, all_un_ignore_parameters: list[str]) -
CONF_ENABLE_SYSTEM_NOTIFICATIONS, DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS
),
): BOOLEAN_SELECTOR,
vol.Required(
vol.Optional(
CONF_UN_IGNORE,
default=existing_parameters,
): SelectSelector(
Expand All @@ -238,6 +246,9 @@ def get_advanced_schema(data: ConfigType, all_un_ignore_parameters: list[str]) -
),
}
)
if not all_un_ignore_parameters:
del advanced_schema.schema[CONF_UN_IGNORE]
return advanced_schema


async def _async_validate_config_and_get_system_information(
Expand All @@ -253,7 +264,7 @@ async def _async_validate_config_and_get_system_information(
class DomainConfigFlow(ConfigFlow, domain=DOMAIN):
"""Handle the instance flow for Homematic(IP) Local."""

VERSION = 6
VERSION = 7
CONNECTION_CLASS = CONN_CLASS_LOCAL_PUSH

def __init__(self) -> None:
Expand All @@ -279,17 +290,38 @@ async def async_step_interface(
self,
interface_input: ConfigType | None = None,
) -> ConfigFlowResult:
"""Handle the initial step."""
if interface_input is None:
_LOGGER.debug("ConfigFlow.step_interface, no user input")
"""Handle the interface step."""
if interface_input is not None:
_update_interface_input(data=self.data, interface_input=interface_input)
if interface_input.get(CONF_ADVANCED_CONFIG):
return await self.async_step_advanced()
return await self._validate_and_finish_config_flow()

_LOGGER.debug("ConfigFlow.step_interface, no user input")
return self.async_show_form(
step_id="interface",
data_schema=get_interface_schema(
use_tls=self.data[CONF_TLS],
data=self.data,
from_config_flow=False,
),
)

async def async_step_advanced(
self,
advanced_input: ConfigType | None = None,
) -> ConfigFlowResult:
"""Handle the advanced step."""
if advanced_input is None:
_LOGGER.debug("ConfigFlow.step_advanced, no user input")
return self.async_show_form(
step_id="interface",
data_schema=get_interface_schema(
use_tls=self.data[CONF_TLS], data=self.data, from_config_flow=True
step_id="advanced",
data_schema=get_advanced_schema(
data=self.data,
all_un_ignore_parameters=[],
),
)

_update_interface_input(data=self.data, interface_input=interface_input)
_update_advanced_input(data=self.data, advanced_input=advanced_input)
return await self._validate_and_finish_config_flow()

async def _validate_and_finish_config_flow(self) -> ConfigFlowResult:
Expand Down Expand Up @@ -372,7 +404,7 @@ async def async_step_interface(
self,
interface_input: ConfigType | None = None,
) -> ConfigFlowResult:
"""Handle the initial step."""
"""Handle the interface step."""
if interface_input is not None:
_update_interface_input(data=self.data, interface_input=interface_input)
if interface_input.get(CONF_ADVANCED_CONFIG):
Expand Down Expand Up @@ -490,16 +522,18 @@ def _update_interface_input(data: ConfigType, interface_input: ConfigType) -> No
def _update_advanced_input(data: ConfigType, advanced_input: ConfigType) -> None:
if advanced_input is not None:
data[CONF_ADVANCED_CONFIG] = {}
data[CONF_ADVANCED_CONFIG][CONF_PROGRAM_SCAN_ENABLED] = advanced_input[
CONF_PROGRAM_SCAN_ENABLED
]
data[CONF_ADVANCED_CONFIG][CONF_SYSVAR_SCAN_ENABLED] = advanced_input[
CONF_SYSVAR_SCAN_ENABLED
]
data[CONF_ADVANCED_CONFIG][CONF_SYSVAR_SCAN_INTERVAL] = advanced_input[
CONF_SYSVAR_SCAN_INTERVAL
]
data[CONF_ADVANCED_CONFIG][CONF_SYS_SCAN_INTERVAL] = advanced_input[CONF_SYS_SCAN_INTERVAL]
data[CONF_ADVANCED_CONFIG][CONF_ENABLE_SYSTEM_NOTIFICATIONS] = advanced_input[
CONF_ENABLE_SYSTEM_NOTIFICATIONS
]
data[CONF_ADVANCED_CONFIG][CONF_UN_IGNORE] = advanced_input[CONF_UN_IGNORE]
if advanced_input.get(CONF_UN_IGNORE):
data[CONF_ADVANCED_CONFIG][CONF_UN_IGNORE] = advanced_input[CONF_UN_IGNORE]


def _get_instance_name(friendly_name: Any | None) -> str | None:
Expand Down
8 changes: 5 additions & 3 deletions custom_components/homematicip_local/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
from homeassistant.const import Platform

DOMAIN: Final = "homematicip_local"
HMIP_LOCAL_MIN_VERSION: Final = "2024.6.0dev0"
HMIP_LOCAL_MIN_VERSION: Final = "2024.9.0dev0"

DEFAULT_DEVICE_FIRMWARE_CHECK_ENABLED: Final = True
DEFAULT_DEVICE_FIRMWARE_CHECK_INTERVAL: Final = 21600 # 6h
DEFAULT_DEVICE_FIRMWARE_DELIVERING_CHECK_INTERVAL: Final = 3600 # 1h
DEFAULT_DEVICE_FIRMWARE_UPDATING_CHECK_INTERVAL: Final = 300 # 5m
DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS: Final = True
DEFAULT_PROGRAM_SCAN_ENABLED: Final = True
DEFAULT_SYSVAR_SCAN_ENABLED: Final = True
DEFAULT_SYSVAR_SCAN_INTERVAL: Final = 30
DEFAULT_SYS_SCAN_INTERVAL: Final = 30
DEFAULT_UN_IGNORE: Final[list[str]] = []
MASTER_SCAN_INTERVAL: Final = 3600 # 1h

Expand All @@ -36,8 +37,9 @@
CONF_INTERFACE_ID: Final = "interface_id"
CONF_JSON_PORT: Final = "json_port"
CONF_SUBTYPE: Final = "subtype"
CONF_PROGRAM_SCAN_ENABLED: Final = "program_scan_enabled"
CONF_SYSVAR_SCAN_ENABLED: Final = "sysvar_scan_enabled"
CONF_SYSVAR_SCAN_INTERVAL: Final = "sysvar_scan_interval"
CONF_SYS_SCAN_INTERVAL: Final = "sysvar_scan_interval"
CONF_TLS: Final = "tls"
CONF_UN_IGNORE: Final = "un_ignore"
CONF_VERIFY_TLS: Final = "verify_tls"
Expand Down
Loading

0 comments on commit 60bfc90

Please sign in to comment.