Bugfix for devices that do not have any data yet

This commit is contained in:
Ziver Koc 2021-09-23 00:02:05 +02:00
parent c46aab31e9
commit 0b029f68e3
3 changed files with 5 additions and 6 deletions

View file

@ -40,10 +40,10 @@ public class DeviceTraitFactory {
public static DeviceTrait[] getTraits(HalAbstractDevice device) {
if (device == null || device.getDeviceData() == null)
if (device == null || device.getDeviceConfig() == null)
return new DeviceTrait[0];
switch (device.getDeviceData().getClass().getName()) {
switch (device.getDeviceConfig().getDeviceDataClass().getName()) {
case "se.hal.struct.devicedata.DimmerEventData":
case "se.hal.struct.devicedata.OnOffEventData":
return new DeviceTrait[]{new OnOffTrait()};

View file

@ -148,10 +148,10 @@ public enum DeviceType {
public static DeviceType getType(HalAbstractDevice device) {
if (device == null || device.getDeviceData() == null)
if (device == null || device.getDeviceConfig() == null)
return null;
switch (device.getDeviceData().getClass().getName()) {
switch (device.getDeviceConfig().getDeviceDataClass().getName()) {
case "se.hal.struct.devicedata.DimmerEventData":
case "se.hal.struct.devicedata.OnOffEventData":
return LIGHT;

View file

@ -395,8 +395,7 @@ public class ZigbeeController implements HalSensorController,
logger.info("Starting Zigbee pairing process.");
networkManager.permitJoin(120);
permitJoinTimer = new Timer(120_000);
permitJoinTimer.start();
permitJoinTimer = new Timer(120_000).start();
}
@Override