Fixed closing homes to actually call the close on the homes. Updated the

lowest setting on the test dim function to b 1.

Fixes #438
Fixes #440
This commit is contained in:
bwssystems
2017-02-05 14:37:35 -06:00
parent 6b3ae1b971
commit 3016712ad8
14 changed files with 44 additions and 19 deletions

View File

@@ -87,6 +87,7 @@ public class HABridge {
bridgeSettings.save(bridgeSettings.getBridgeSettingsDescriptor());
homeManager.closeHomes();
udpSender.closeResponseSocket();
udpSender = null;
}
bridgeSettings.getBridgeControl().setReinit(false);
stop();

View File

@@ -1,5 +1,6 @@
package com.bwssystems.HABridge;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -96,6 +97,11 @@ public class HomeManager {
}
public void closeHomes() {
Collection<Home> theHomes = homeList.values();
for(Home aHome : theHomes) {
aHome.closeHome();
}
homeList.clear();
homeList = null;
}
}

View File

@@ -94,10 +94,10 @@ public class NestHome implements com.bwssystems.HABridge.Home {
public void closeHome() {
if(theSession != null) {
theNest.endNestSession();
theNest = null;
theSession = null;
nestItems = null;
}
theNest = null;
theSession = null;
nestItems = null;
}
@Override

View File

@@ -185,4 +185,11 @@ public class HalInfo {
this.halAddress = halAddress;
}
public void closeInfo() {
if(httpClient != null)
httpClient.closeHandler();
httpClient = null;
halAddress = null;
theToken = null;
}
}

View File

@@ -151,10 +151,14 @@ public class HassHome implements Home {
public void closeHome() {
if(!validHass)
return;
if(hassMap == null)
return;
Iterator<String> keys = hassMap.keySet().iterator();
while(keys.hasNext()) {
String key = keys.next();
hassMap.get(key).closeClient();
}
hassMap = null;
}
}

View File

@@ -104,5 +104,6 @@ public class HomeAssistant {
protected void closeClient() {
anHttpHandler.closeHandler();
anHttpHandler = null;
}
}

View File

@@ -81,7 +81,9 @@ public class HTTPHome implements Home {
@Override
public void closeHome() {
anHttpHandler.closeHandler();
if(anHttpHandler != null)
anHttpHandler.closeHandler();
anHttpHandler = null;
}
}

View File

@@ -124,10 +124,13 @@ public class HueHome implements Home {
public void closeHome() {
if(!validHue)
return;
if(hues == null)
return;
Iterator<String> keys = hues.keySet().iterator();
while(keys.hasNext()) {
String key = keys.next();
hues.get(key).closeHue();;
}
hues = null;
}
}

View File

@@ -68,5 +68,6 @@ public class MQTTHandler {
} catch (MqttException e) {
log.warn("Could not disconnect MQTT client for name: " + myConfig.getName() + " and ip: " + myConfig.getIp());
}
myClient = null;
}
}

View File

@@ -42,6 +42,7 @@ public class MQTTHome implements Home {
handlers.get(key).shutdown();
}
}
handlers = null;
}
public MQTTHandler getMQTTHandler(String aName) {

View File

@@ -106,7 +106,6 @@ public class VeraHome implements Home {
@Override
public void closeHome() {
// TODO Auto-generated method stub
veras = null;
}
}