diff --git a/README.md b/README.md index 084953e8..79a8bebe 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ hs485d_port: default: 2000 ``` -#### Advanced +#### Advanced (optional) ```yaml program_scan_enabled: @@ -234,6 +234,14 @@ enable_system_notifications: A better option is to solve the communication problems in your environment. type: integer default: true +listen_on_all_ip: + required: true + description: + By default the XMLRPC server only listens to the ip address, that is used for the communication to the CCU, because, for security reasons, it's better to only listen on needed ports. + This works for most of the installations, but in rare cases, when double virtualization is used (Docker on Windows/Mac), this doesn't work. + In those cases it is necessary, that the XMLRPC server listens an all ('0.0.0.0') ip addresses. + type: integer + default: false un_ignore: (Only visible when reconfiguring the integration) required: false description: diff --git a/changelog.md b/changelog.md index 02f320af..60a6831f 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ - Raise exception on set_value, put_paramset - Remove command queue - Simplify entity imports +- Add option to config flow/advanced to listen on all ip addresses - Raise HomeAssistantError on service exception - Remove periodic master entity update diff --git a/custom_components/homematicip_local/config_flow.py b/custom_components/homematicip_local/config_flow.py index 52550265..cb024a3e 100644 --- a/custom_components/homematicip_local/config_flow.py +++ b/custom_components/homematicip_local/config_flow.py @@ -51,6 +51,7 @@ CONF_INSTANCE_NAME, CONF_INTERFACE, CONF_JSON_PORT, + CONF_LISTEN_ON_ALL_IP, CONF_PROGRAM_SCAN_ENABLED, CONF_SYS_SCAN_INTERVAL, CONF_SYSVAR_SCAN_ENABLED, @@ -58,6 +59,7 @@ CONF_UN_IGNORE, CONF_VERIFY_TLS, DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS, + DEFAULT_LISTEN_ON_ALL_IP, DEFAULT_PROGRAM_SCAN_ENABLED, DEFAULT_SYS_SCAN_INTERVAL, DEFAULT_SYSVAR_SCAN_ENABLED, @@ -233,6 +235,12 @@ def get_advanced_schema(data: ConfigType, all_un_ignore_parameters: list[str]) - CONF_ENABLE_SYSTEM_NOTIFICATIONS, DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS ), ): BOOLEAN_SELECTOR, + vol.Required( + CONF_LISTEN_ON_ALL_IP, + default=data.get(CONF_ADVANCED_CONFIG, {}).get( + CONF_LISTEN_ON_ALL_IP, DEFAULT_LISTEN_ON_ALL_IP + ), + ): BOOLEAN_SELECTOR, vol.Optional( CONF_UN_IGNORE, default=existing_parameters, @@ -532,6 +540,7 @@ def _update_advanced_input(data: ConfigType, advanced_input: ConfigType) -> None data[CONF_ADVANCED_CONFIG][CONF_ENABLE_SYSTEM_NOTIFICATIONS] = advanced_input[ CONF_ENABLE_SYSTEM_NOTIFICATIONS ] + data[CONF_ADVANCED_CONFIG][CONF_LISTEN_ON_ALL_IP] = advanced_input[CONF_LISTEN_ON_ALL_IP] if advanced_input.get(CONF_UN_IGNORE): data[CONF_ADVANCED_CONFIG][CONF_UN_IGNORE] = advanced_input[CONF_UN_IGNORE] diff --git a/custom_components/homematicip_local/const.py b/custom_components/homematicip_local/const.py index 1dc5bb87..06cd1bd7 100644 --- a/custom_components/homematicip_local/const.py +++ b/custom_components/homematicip_local/const.py @@ -17,6 +17,7 @@ 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_LISTEN_ON_ALL_IP: Final = False DEFAULT_PROGRAM_SCAN_ENABLED: Final = True DEFAULT_SYSVAR_SCAN_ENABLED: Final = True DEFAULT_SYS_SCAN_INTERVAL: Final = 30 @@ -28,6 +29,7 @@ CONF_ADVANCED_CONFIG: Final = "advanced_config" CONF_CALLBACK_HOST: Final = "callback_host" +CONF_LISTEN_ON_ALL_IP: Final = "listen_on_all_ip" CONF_CALLBACK_PORT: Final = "callback_port" CONF_ENABLE_SYSTEM_NOTIFICATIONS: Final = "enable_system_notifications" CONF_EVENT_TYPE: Final = "event_type" diff --git a/custom_components/homematicip_local/control_unit.py b/custom_components/homematicip_local/control_unit.py index a7e2e889..a9604304 100644 --- a/custom_components/homematicip_local/control_unit.py +++ b/custom_components/homematicip_local/control_unit.py @@ -61,6 +61,7 @@ CONF_INSTANCE_NAME, CONF_INTERFACE, CONF_JSON_PORT, + CONF_LISTEN_ON_ALL_IP, CONF_PROGRAM_SCAN_ENABLED, CONF_SYS_SCAN_INTERVAL, CONF_SYSVAR_SCAN_ENABLED, @@ -72,6 +73,7 @@ DEFAULT_DEVICE_FIRMWARE_DELIVERING_CHECK_INTERVAL, DEFAULT_DEVICE_FIRMWARE_UPDATING_CHECK_INTERVAL, DEFAULT_ENABLE_SYSTEM_NOTIFICATIONS, + DEFAULT_LISTEN_ON_ALL_IP, DEFAULT_PROGRAM_SCAN_ENABLED, DEFAULT_SYS_SCAN_INTERVAL, DEFAULT_SYSVAR_SCAN_ENABLED, @@ -195,6 +197,7 @@ def _create_central(self) -> CentralUnit: else None, central_id=central_id, client_session=aiohttp_client.async_get_clientsession(self._hass), + listen_ip_addr=IP_ANY_V4 if self._config.listen_on_all_ip else None, default_callback_port=self._default_callback_port, host=self._config.host, interface_configs=interface_configs, @@ -603,6 +606,10 @@ def __init__( self.sys_scan_interval: Final = advanced_config.get( CONF_SYS_SCAN_INTERVAL, DEFAULT_SYS_SCAN_INTERVAL ) + + self.listen_on_all_ip = advanced_config.get( + CONF_LISTEN_ON_ALL_IP, DEFAULT_LISTEN_ON_ALL_IP + ) self.un_ignore: Final = advanced_config.get(CONF_UN_IGNORE, DEFAULT_UN_IGNORE) def check_config(self) -> None: diff --git a/custom_components/homematicip_local/strings.json b/custom_components/homematicip_local/strings.json index d66c3470..38555dce 100644 --- a/custom_components/homematicip_local/strings.json +++ b/custom_components/homematicip_local/strings.json @@ -12,6 +12,7 @@ "advanced": { "data": { "enable_system_notifications": "Enable system notifications", + "listen_on_all_ip": "listen on all ip", "program_scan_enabled": "enable program scan", "sysvar_scan_enabled": "enable system variable scan", "sysvar_scan_interval": "Sysvar/Program scan interval" @@ -582,6 +583,7 @@ "advanced": { "data": { "enable_system_notifications": "Enable system notifications", + "listen_on_all_ip": "listen on all ip", "program_scan_enabled": "enable program scan", "sysvar_scan_enabled": "enable system variable scan", "sysvar_scan_interval": "Sysvar/Program scan interval", diff --git a/custom_components/homematicip_local/translations/de.json b/custom_components/homematicip_local/translations/de.json index 1ab01220..3323d767 100644 --- a/custom_components/homematicip_local/translations/de.json +++ b/custom_components/homematicip_local/translations/de.json @@ -12,6 +12,7 @@ "advanced": { "data": { "enable_system_notifications": "Systembenachrichtigungen aktivieren", + "listen_on_all_ip": "Auf allen IP Adressen lauschen", "program_scan_enabled": "Programm Scan aktivieren", "sysvar_scan_enabled": "Systemvariablen Scan aktivieren", "sysvar_scan_interval": "Sysvar/Program Scan Interval" @@ -586,6 +587,7 @@ "advanced": { "data": { "enable_system_notifications": "Systembenachrichtigungen aktivieren", + "listen_on_all_ip": "Auf allen IP Adressen lauschen", "program_scan_enabled": "Programm Scan aktivieren", "sysvar_scan_enabled": "Systemvariablen Scan aktivieren", "sysvar_scan_interval": "Sysvar/Program Scan Interval", diff --git a/custom_components/homematicip_local/translations/en.json b/custom_components/homematicip_local/translations/en.json index d66c3470..38555dce 100644 --- a/custom_components/homematicip_local/translations/en.json +++ b/custom_components/homematicip_local/translations/en.json @@ -12,6 +12,7 @@ "advanced": { "data": { "enable_system_notifications": "Enable system notifications", + "listen_on_all_ip": "listen on all ip", "program_scan_enabled": "enable program scan", "sysvar_scan_enabled": "enable system variable scan", "sysvar_scan_interval": "Sysvar/Program scan interval" @@ -582,6 +583,7 @@ "advanced": { "data": { "enable_system_notifications": "Enable system notifications", + "listen_on_all_ip": "listen on all ip", "program_scan_enabled": "enable program scan", "sysvar_scan_enabled": "enable system variable scan", "sysvar_scan_interval": "Sysvar/Program scan interval",