From 762fcdee9de3028b79b69d9e888a9c9a21154e39 Mon Sep 17 00:00:00 2001 From: AAPohl Date: Wed, 6 Mar 2024 20:07:37 +0100 Subject: [PATCH 1/6] added new parameters for fixed proxy port --- homematic/plugin.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/homematic/plugin.yaml b/homematic/plugin.yaml index 8ef12e24b..7faf46806 100755 --- a/homematic/plugin.yaml +++ b/homematic/plugin.yaml @@ -32,6 +32,22 @@ parameters: de: 'IP Adresse bzw. Hostname der HomeMatic CCU2 Zentrale' en: 'ip address or hostname of the HomeMatic CCU2 gateway' + proxyPort: + type: int + default: 0 + valid_min: 0 + description: + de: 'Port Nummer für eingehende Nachrichten von der HomeMatric CCU2 Zentrale' + en: 'port number for incoming messages from the HomeMatric CCU2 gateway' + + proxyPort_hmip: + type: int + default: 0 + valid_min: 0 + description: + de: 'Port Nummer für eingehende Nachrichten von der HomeMatric CCU2 Zentrale für HomeMaticIP Geräte' + en: 'port number for incoming messages from the HomeMatric CCU2 gateway for HomeMaticIP Devices' + # port: # type: int # default: 2001 From 9cb7ed3b82f7c60f08d1d63d19b7fe6c32d2a06d Mon Sep 17 00:00:00 2001 From: AAPohl Date: Wed, 6 Mar 2024 20:28:22 +0100 Subject: [PATCH 2/6] applied proxy ports --- homematic/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homematic/__init__.py b/homematic/__init__.py index ed87c9f6f..22dfc9ff8 100755 --- a/homematic/__init__.py +++ b/homematic/__init__.py @@ -74,6 +74,8 @@ def __init__(self, sh, *args, **kwargs): self.host = self.get_parameter_value('host') # self.port = self.get_parameter_value('port') # self.port_hmip = self.get_parameter_value('port_hmip') + self.proxyPort = self.get_parameter_value('proxyPort') + self.proxyPort_hmip = self.get_parameter_value('proxyPort_hmip') self.port = 2001 self.port_hmip = 2010 @@ -85,8 +87,7 @@ def __init__(self, sh, *args, **kwargs): try: self.hm = HMConnection(interface_id="myserver", autostart=False, eventcallback=self.eventcallback, systemcallback=self.systemcallback, - remotes={self.hm_id:{"ip": self.host, "port": self.port}}) -# remotes={self.hm_id:{"ip": self.host, "port": self.port}, self.hmip_id:{"ip": self.host, "port": self.port_hmip}}) + remotes={self.hm_id:{"ip": self.host, "port": self.port}}, localport=proxyPort, local=_hm.LOCAL) except: self.logger.error("Unable to create HomeMatic object") self._init_complete = False @@ -102,7 +103,7 @@ def __init__(self, sh, *args, **kwargs): try: self.hmip = HMConnection(interface_id="myserver_ip", autostart=False, eventcallback=self.eventcallback, systemcallback=self.systemcallback, - remotes={self.hmip_id:{"ip": self.host, "port": self.port_hmip}}) + remotes={self.hmip_id:{"ip": self.host, "port": self.port_hmip}}, localport=proxyPort_hmip, local=_hm.LOCAL) except: self.logger.error("Unable to create HomeMaticIP object") # self._init_complete = False From 9a4d7ef3aa3f37a2184609ea5bd8e980c809876a Mon Sep 17 00:00:00 2001 From: AAPohl Date: Wed, 6 Mar 2024 20:43:03 +0100 Subject: [PATCH 3/6] parameters for callback added --- homematic/plugin.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/homematic/plugin.yaml b/homematic/plugin.yaml index 7faf46806..fd005eba2 100755 --- a/homematic/plugin.yaml +++ b/homematic/plugin.yaml @@ -48,6 +48,35 @@ parameters: de: 'Port Nummer für eingehende Nachrichten von der HomeMatric CCU2 Zentrale für HomeMaticIP Geräte' en: 'port number for incoming messages from the HomeMatric CCU2 gateway for HomeMaticIP Devices' + customCallbackHost: + type: bool + mandatory: False + description: + de: 'Legt fest, ob Callbacks umgeleitet werden soll (z.B. Docker Host), default FALSE' + en: 'determine if callbacks must be reditected (e.g. Docker Host), default FALSE' + + callbackHost: + type: ip + default: '127.0.0.1' + description: + de: 'IP Adresse bzw. Hostname, an die die HomeMatric CCU2 Zentrale Nachrichten senden soll (z.B. Docker Host)' + en: 'ip address or hostname, to which the HomeMatric CCU2 gateway has to send messages (e.g. Docker Host)' + + callbackPort: + type: int + default: 30000 + valid_min: 0 + description: + de: 'Port Nummer, an die die HomeMatric CCU2 Zentrale Nachrichten senden soll (z.B. Docker Host)' + en: 'port number, to which the HomeMatric CCU2 gateway has to send messages (e.g. Docker Host)' + + callbackPort_hmip: + type: int + default: 30001 + valid_min: 0 + description: + de: 'Port Nummer, an die die HomeMatric CCU2 Zentrale Nachrichten senden soll (z.B. Docker Host) für HomeMaticIP Geräte' + en: 'port number, to which the HomeMatric CCU2 gateway has to send messages for HomeMaticIP Devices (e.g. Docker Host)' # port: # type: int # default: 2001 From 195dd7a3b98a822bf83c5c4a188634397824f1f8 Mon Sep 17 00:00:00 2001 From: AAPohl Date: Wed, 6 Mar 2024 20:49:54 +0100 Subject: [PATCH 4/6] apply callback parameters --- homematic/__init__.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/homematic/__init__.py b/homematic/__init__.py index 22dfc9ff8..dc304df25 100755 --- a/homematic/__init__.py +++ b/homematic/__init__.py @@ -76,6 +76,11 @@ def __init__(self, sh, *args, **kwargs): # self.port_hmip = self.get_parameter_value('port_hmip') self.proxyPort = self.get_parameter_value('proxyPort') self.proxyPort_hmip = self.get_parameter_value('proxyPort_hmip') + self.customCallbackHost = self.get_parameter_value('customCallbackHost') + self.callbackHost = self.get_parameter_value('callbackHost') + self.callbackPort = self.get_parameter_value('callbackPort') + self.callbackPort_hmip = self.get_parameter_value('callbackPort_hmip') + self.port = 2001 self.port_hmip = 2010 @@ -85,9 +90,12 @@ def __init__(self, sh, *args, **kwargs): self.hm_id += '_' + self.get_instance_name() # create HomeMatic object try: - self.hm = HMConnection(interface_id="myserver", autostart=False, + remotes={self.hm_id:{"ip": self.host, "port": self.port}} + if(self.customCallbackHost) + remotes={self.hm_id:{"ip": self.host, "port": self.port, "callbackip": self.callbackHost, "callbackport": self.callbackPort}} + self.hm = HMConnection(interface_id="myserver", autostart=False, eventcallback=self.eventcallback, systemcallback=self.systemcallback, - remotes={self.hm_id:{"ip": self.host, "port": self.port}}, localport=proxyPort, local=_hm.LOCAL) + remote=remotes, localport=proxyPort, local=_hm.LOCAL) except: self.logger.error("Unable to create HomeMatic object") self._init_complete = False @@ -101,9 +109,12 @@ def __init__(self, sh, *args, **kwargs): self.hmip_id += '_' + self.get_instance_name() # create HomeMaticIP object try: + remotes={self.hmip_id:{"ip": self.host, "port": self.port_hmip}} + if(self.customCallbackHost) + remotes={self.hmip_id:{"ip": self.host, "port": self.port_hmip, "callbackip": self.callbackHost, "callbackport": self.callbackPort_hmip}} self.hmip = HMConnection(interface_id="myserver_ip", autostart=False, eventcallback=self.eventcallback, systemcallback=self.systemcallback, - remotes={self.hmip_id:{"ip": self.host, "port": self.port_hmip}}, localport=proxyPort_hmip, local=_hm.LOCAL) + remotes=remotes, localport=proxyPort_hmip, local=_hm.LOCAL) except: self.logger.error("Unable to create HomeMaticIP object") # self._init_complete = False From 9ce4b8fd72747052d570ad2ab2a2e12b9bb78d3e Mon Sep 17 00:00:00 2001 From: AAPohl Date: Wed, 6 Mar 2024 21:45:30 +0100 Subject: [PATCH 5/6] syntax fixes --- homematic/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homematic/__init__.py b/homematic/__init__.py index dc304df25..a17f16833 100755 --- a/homematic/__init__.py +++ b/homematic/__init__.py @@ -91,13 +91,13 @@ def __init__(self, sh, *args, **kwargs): # create HomeMatic object try: remotes={self.hm_id:{"ip": self.host, "port": self.port}} - if(self.customCallbackHost) + if(self.customCallbackHost): remotes={self.hm_id:{"ip": self.host, "port": self.port, "callbackip": self.callbackHost, "callbackport": self.callbackPort}} self.hm = HMConnection(interface_id="myserver", autostart=False, eventcallback=self.eventcallback, systemcallback=self.systemcallback, - remote=remotes, localport=proxyPort, local=_hm.LOCAL) + remotes=remotes, localport=self.proxyPort, local="0.0.0.0") except: - self.logger.error("Unable to create HomeMatic object") + self.logger.error("Unable to create HomeMatic obxyject") self._init_complete = False return @@ -110,11 +110,11 @@ def __init__(self, sh, *args, **kwargs): # create HomeMaticIP object try: remotes={self.hmip_id:{"ip": self.host, "port": self.port_hmip}} - if(self.customCallbackHost) + if(self.customCallbackHost): remotes={self.hmip_id:{"ip": self.host, "port": self.port_hmip, "callbackip": self.callbackHost, "callbackport": self.callbackPort_hmip}} - self.hmip = HMConnection(interface_id="myserver_ip", autostart=False, + self.hmip = HMConnection(interface_id="myserver_ip", autostart=False, eventcallback=self.eventcallback, systemcallback=self.systemcallback, - remotes=remotes, localport=proxyPort_hmip, local=_hm.LOCAL) + remotes=remotes, localport=self.proxyPort_hmip, local="0.0.0.0") except: self.logger.error("Unable to create HomeMaticIP object") # self._init_complete = False From 0ff0af8703272a77409d488b2e3a57ce4288b099 Mon Sep 17 00:00:00 2001 From: AAPohl <82733706+AAPohl@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:52:28 +0100 Subject: [PATCH 6/6] Typo fixed --- homematic/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homematic/__init__.py b/homematic/__init__.py index a17f16833..d23dbbf15 100755 --- a/homematic/__init__.py +++ b/homematic/__init__.py @@ -97,7 +97,7 @@ def __init__(self, sh, *args, **kwargs): eventcallback=self.eventcallback, systemcallback=self.systemcallback, remotes=remotes, localport=self.proxyPort, local="0.0.0.0") except: - self.logger.error("Unable to create HomeMatic obxyject") + self.logger.error("Unable to create HomeMatic object") self._init_complete = False return