diff --git a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java index 53db9bbb..6f57e9ac 100644 --- a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java +++ b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java @@ -98,7 +98,7 @@ public class SmartHomeImpl extends SmartHomeApp implements TokenRegistrationList SyncResponse.Payload.Device.Builder deviceBuilder = new SyncResponse.Payload.Device.Builder() .setId(device.getClass().getSimpleName() + "-" + device.getId()) - .setType(type.toString()) + .setType("" + type) .setTraits(DeviceTraitFactory.getTraitIds(traits)) .setName( DeviceProto.DeviceNames.newBuilder() diff --git a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/type/DeviceType.java b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/type/DeviceType.java index db59858a..2d9ad4c3 100644 --- a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/type/DeviceType.java +++ b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/type/DeviceType.java @@ -148,6 +148,9 @@ public enum DeviceType { public static DeviceType getType(HalAbstractDevice device) { + if (device == null || device.getDeviceData() == null) + return null; + switch (device.getDeviceData().getClass().getName()) { case "se.hal.struct.devicedata.DimmerEventData": case "se.hal.struct.devicedata.OnOffEventData":