From b523032d742ae51e88b1869852d2130060544d16 Mon Sep 17 00:00:00 2001 From: Benedikt Arnold Date: Thu, 28 May 2015 23:13:21 +0200 Subject: [PATCH 1/2] add gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fcc7a56 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.iml +.idea/ +.gradle/ +build/ +hm2mqtt.devcache \ No newline at end of file From a944ccb4991d5acb13e516ad11400dd271eda100 Mon Sep 17 00:00:00 2001 From: Benedikt Arnold Date: Thu, 28 May 2015 23:41:50 +0200 Subject: [PATCH 2/2] added config option hm.bindaddress --- README.md | 7 +++++++ src/main/java/com/tellerulam/hm2mqtt/XMLRPCServer.java | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 52f3107..c327152 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,13 @@ Examples: Local address used when sending init (callback) requests to the XML-RPC server. Default is the result of getHostAddress(). Set this when hm2mqtt has trouble determining your local host's address automatically. + +- hm.bindaddress + + Local address and port used to listen for callback requests. If not specified hm2mqtt will pick a valid local address + and a random port + + Example: Listen on all local adresses on port 3333: 0.0.0.0:3333 - hm.disableReGa diff --git a/src/main/java/com/tellerulam/hm2mqtt/XMLRPCServer.java b/src/main/java/com/tellerulam/hm2mqtt/XMLRPCServer.java index 7e54d49..43ba67c 100644 --- a/src/main/java/com/tellerulam/hm2mqtt/XMLRPCServer.java +++ b/src/main/java/com/tellerulam/hm2mqtt/XMLRPCServer.java @@ -16,7 +16,13 @@ public static String init() throws IOException { ss=new ServerSocket(); ss.setReuseAddress(true); - ss.bind(null); + String bindaddress=System.getProperty("hm2mqtt.hm.bindaddress"); + if(bindaddress == null) + ss.bind(null); + else{ + String[] parts = bindaddress.split(":"); + ss.bind(new InetSocketAddress(parts[0], Integer.parseInt(parts[1]))); + } new XMLRPCAcceptor().start(); String localhost=System.getProperty("hm2mqtt.hm.localhost"); if(localhost==null)