Bugfix for devices that do not have any data yet
This commit is contained in:
parent
c46aab31e9
commit
0b029f68e3
3 changed files with 5 additions and 6 deletions
|
|
@ -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()};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue