From 870d9cbbab0d505afed26e48b225ecfe8586c300 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Sun, 29 Aug 2021 19:59:02 +0200 Subject: [PATCH] Some more bug fixes --- .../src/se/hal/plugin/assistant/google/SmartHomeImpl.java | 2 +- .../src/se/hal/plugin/assistant/google/type/DeviceType.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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":