[infrastructure] move infered nullness warnings to error and update EEA (#8949)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -328,6 +328,10 @@ public class NikoHomeControlCommunication1 extends NikoHomeControlCommunication
|
||||
for (Map<String, String> location : data) {
|
||||
String id = location.get("id");
|
||||
String name = location.get("name");
|
||||
if (id == null || name == null) {
|
||||
logger.debug("id or name null, ignoring entry");
|
||||
continue;
|
||||
}
|
||||
NhcLocation1 nhcLocation1 = new NhcLocation1(name);
|
||||
locations.put(id, nhcLocation1);
|
||||
}
|
||||
@@ -337,8 +341,11 @@ public class NikoHomeControlCommunication1 extends NikoHomeControlCommunication
|
||||
logger.debug("Niko Home Control: list actions");
|
||||
|
||||
for (Map<String, String> action : data) {
|
||||
|
||||
String id = action.get("id");
|
||||
if (id == null) {
|
||||
logger.debug("id not found in action {}", action);
|
||||
continue;
|
||||
}
|
||||
String value1 = action.get("value1");
|
||||
int state = ((value1 == null) || value1.isEmpty() ? 0 : Integer.parseInt(value1));
|
||||
String value2 = action.get("value2");
|
||||
@@ -349,6 +356,10 @@ public class NikoHomeControlCommunication1 extends NikoHomeControlCommunication
|
||||
if (!actions.containsKey(id)) {
|
||||
// Initial instantiation of NhcAction class for action object
|
||||
String name = action.get("name");
|
||||
if (name == null) {
|
||||
logger.debug("name not found in action {}", action);
|
||||
continue;
|
||||
}
|
||||
String type = action.get("type");
|
||||
ActionType actionType = ActionType.GENERIC;
|
||||
switch (type) {
|
||||
@@ -371,8 +382,8 @@ public class NikoHomeControlCommunication1 extends NikoHomeControlCommunication
|
||||
}
|
||||
String locationId = action.get("location");
|
||||
String location = "";
|
||||
if (!locationId.isEmpty()) {
|
||||
location = locations.get(locationId).getName();
|
||||
if (locationId != null && !locationId.isEmpty()) {
|
||||
location = locations.getOrDefault(locationId, new NhcLocation1("")).getName();
|
||||
}
|
||||
NhcAction nhcAction = new NhcAction1(id, name, actionType, location, this, scheduler);
|
||||
if (actionType == ActionType.ROLLERSHUTTER) {
|
||||
@@ -405,6 +416,10 @@ public class NikoHomeControlCommunication1 extends NikoHomeControlCommunication
|
||||
for (Map<String, String> thermostat : data) {
|
||||
try {
|
||||
String id = thermostat.get("id");
|
||||
if (id == null) {
|
||||
logger.debug("skipping thermostat {}, id not found", thermostat);
|
||||
continue;
|
||||
}
|
||||
int measured = parseIntOrThrow(thermostat.get("measured"));
|
||||
int setpoint = parseIntOrThrow(thermostat.get("setpoint"));
|
||||
int mode = parseIntOrThrow(thermostat.get("mode"));
|
||||
@@ -528,6 +543,10 @@ public class NikoHomeControlCommunication1 extends NikoHomeControlCommunication
|
||||
|
||||
private void eventGetAlarms(Map<String, String> data) {
|
||||
String alarmText = data.get("text");
|
||||
if (alarmText == null) {
|
||||
logger.debug("message does not contain alarmtext: {}", data);
|
||||
return;
|
||||
}
|
||||
switch (data.getOrDefault("type", "")) {
|
||||
case "0":
|
||||
logger.debug("Niko Home Control: alarm - {}", alarmText);
|
||||
|
||||
@@ -33,8 +33,7 @@ import java.util.stream.IntStream;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.nikohomecontrol.internal.protocol.NhcControllerEvent;
|
||||
import org.openhab.binding.nikohomecontrol.internal.protocol.NikoHomeControlCommunication;
|
||||
import org.openhab.binding.nikohomecontrol.internal.protocol.*;
|
||||
import org.openhab.binding.nikohomecontrol.internal.protocol.NikoHomeControlConstants.ActionType;
|
||||
import org.openhab.binding.nikohomecontrol.internal.protocol.nhc2.NhcDevice2.NhcProperty;
|
||||
import org.openhab.binding.nikohomecontrol.internal.protocol.nhc2.NhcMessage2.NhcMessageParam;
|
||||
@@ -309,7 +308,7 @@ public class NikoHomeControlCommunication2 extends NikoHomeControlCommunication
|
||||
return;
|
||||
} else if ("devices.added".equals(method)) {
|
||||
deviceList.forEach(this::addDevice);
|
||||
} else if ("devices.changed".contentEquals(method)) {
|
||||
} else if ("devices.changed".equals(method)) {
|
||||
deviceList.forEach(this::removeDevice);
|
||||
deviceList.forEach(this::addDevice);
|
||||
}
|
||||
@@ -444,12 +443,16 @@ public class NikoHomeControlCommunication2 extends NikoHomeControlCommunication
|
||||
return;
|
||||
}
|
||||
|
||||
if (actions.containsKey(device.uuid)) {
|
||||
updateActionState((NhcAction2) actions.get(device.uuid), deviceProperties);
|
||||
} else if (thermostats.containsKey(device.uuid)) {
|
||||
updateThermostatState((NhcThermostat2) thermostats.get(device.uuid), deviceProperties);
|
||||
} else if (energyMeters.containsKey(device.uuid)) {
|
||||
updateEnergyMeterState((NhcEnergyMeter2) energyMeters.get(device.uuid), deviceProperties);
|
||||
NhcAction action = actions.get(device.uuid);
|
||||
NhcThermostat thermostat = thermostats.get(device.uuid);
|
||||
NhcEnergyMeter energyMeter = energyMeters.get(device.uuid);
|
||||
|
||||
if (action != null) {
|
||||
updateActionState((NhcAction2) action, deviceProperties);
|
||||
} else if (thermostat != null) {
|
||||
updateThermostatState((NhcThermostat2) thermostat, deviceProperties);
|
||||
} else if (energyMeter != null) {
|
||||
updateEnergyMeterState((NhcEnergyMeter2) energyMeter, deviceProperties);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user