From 42023a487cdf63900fb15889e4607106bcb1ff31 Mon Sep 17 00:00:00 2001 From: jlippold Date: Thu, 31 Dec 2015 19:31:39 -0500 Subject: [PATCH] Adds option to disable upnp listener this is needed so the echo does not discover devices when you dont tell it to. useful if you want to run multiple ha-bridges on one server --- src/main/java/com/armzilla/ha/upnp/UpnpListener.java | 8 ++++++++ src/main/resources/application.properties | 1 + 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/armzilla/ha/upnp/UpnpListener.java b/src/main/java/com/armzilla/ha/upnp/UpnpListener.java index 00e59ec..686bc2e 100644 --- a/src/main/java/com/armzilla/ha/upnp/UpnpListener.java +++ b/src/main/java/com/armzilla/ha/upnp/UpnpListener.java @@ -32,11 +32,19 @@ public class UpnpListener { @Value("${upnp.config.address}") private String responseAddress; + @Value("${upnp.disable}") + private boolean disable; + @Autowired private ApplicationContext applicationContext; @Scheduled(fixedDelay = Integer.MAX_VALUE) public void startListening(){ + + if (disable) { + return; + } + log.info("Starting UPNP Discovery Listener"); try (DatagramSocket responseSocket = new DatagramSocket(upnpResponsePort); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ed8db7f..fec7dba 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,3 +1,4 @@ upnp.response.port=50000 server.port=8080 upnp.config.address=192.168.1.1 +upnp.disable=false