mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
fix NPE in discovery (#8931)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
parent
603ceedff9
commit
a6f6410b5c
@ -148,4 +148,8 @@ public class Robot {
|
|||||||
public void setCreatedAt(String createdAt) {
|
public void setCreatedAt(String createdAt) {
|
||||||
this.createdAt = createdAt;
|
this.createdAt = createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean discoveryInformationPresent() {
|
||||||
|
return serial != null && secretKey != null && name != null && model != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,9 +84,14 @@ public class NeatoAccountDiscoveryService extends AbstractDiscoveryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addThing(Robot robot) {
|
private void addThing(Robot robot) {
|
||||||
|
if (robot == null || !robot.discoveryInformationPresent()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logger.debug("addThing(): Adding new Neato unit {} to the smarthome inbox", robot.getName());
|
logger.debug("addThing(): Adding new Neato unit {} to the smarthome inbox", robot.getName());
|
||||||
|
|
||||||
Map<String, Object> properties = new HashMap<>();
|
Map<String, Object> properties = new HashMap<>();
|
||||||
|
String serial = robot.getSerial();
|
||||||
ThingUID thingUID = new ThingUID(NeatoBindingConstants.THING_TYPE_VACUUMCLEANER, bridgeUID, robot.getSerial());
|
ThingUID thingUID = new ThingUID(NeatoBindingConstants.THING_TYPE_VACUUMCLEANER, bridgeUID, robot.getSerial());
|
||||||
properties.put(NeatoBindingConstants.CONFIG_SECRET, robot.getSecretKey());
|
properties.put(NeatoBindingConstants.CONFIG_SECRET, robot.getSecretKey());
|
||||||
properties.put(NeatoBindingConstants.CONFIG_SERIAL, robot.getSerial());
|
properties.put(NeatoBindingConstants.CONFIG_SERIAL, robot.getSerial());
|
||||||
|
Loading…
Reference in New Issue
Block a user