diff --git a/homematic/__init__.py b/homematic/__init__.py index ed87c9f6f..d23dbbf15 100755 --- a/homematic/__init__.py +++ b/homematic/__init__.py @@ -74,6 +74,13 @@ 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.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 @@ -83,10 +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}}) -# remotes={self.hm_id:{"ip": self.host, "port": self.port}, self.hmip_id:{"ip": self.host, "port": self.port_hmip}}) + remotes=remotes, localport=self.proxyPort, local="0.0.0.0") except: self.logger.error("Unable to create HomeMatic object") self._init_complete = False @@ -100,9 +109,12 @@ def __init__(self, sh, *args, **kwargs): self.hmip_id += '_' + self.get_instance_name() # create HomeMaticIP object try: - self.hmip = HMConnection(interface_id="myserver_ip", autostart=False, + 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}}) + remotes=remotes, localport=self.proxyPort_hmip, local="0.0.0.0") except: self.logger.error("Unable to create HomeMaticIP object") # self._init_complete = False diff --git a/homematic/plugin.yaml b/homematic/plugin.yaml index 8ef12e24b..fd005eba2 100755 --- a/homematic/plugin.yaml +++ b/homematic/plugin.yaml @@ -32,6 +32,51 @@ 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' + + 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