diff --git a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/internal/config/Device.java b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/internal/config/Device.java index f35ddad7dda16..1cc410455f614 100644 --- a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/internal/config/Device.java +++ b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/internal/config/Device.java @@ -64,6 +64,12 @@ public class Device { @SerializedName("Lqi") @Expose private Integer lqi; + @SerializedName("ReceptionOfDevice") + @Expose + private Reception receptionOfDevice; + @SerializedName("ReceptionOfController") + @Expose + private Reception receptionOfController; public Integer getId() { return id; @@ -126,19 +132,28 @@ public String getBatteryLevel() { } public Integer getRssi() { - if (rssi == null) { - return Integer.MIN_VALUE; + if (rssi != null) { + return rssi; + } + + // JSON response changed with firmware update to include RSSI and LQI on a separate object + if (receptionOfDevice != null) { + return receptionOfDevice.getRSSI(); } - return rssi; + return null; } public Integer getLqi() { - if (lqi == null) { - return Integer.MIN_VALUE; + if (lqi != null) { + return lqi; + } + + if (receptionOfDevice != null) { + return receptionOfDevice.getLQI(); } - return lqi; + return null; } } diff --git a/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/internal/config/Reception.java b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/internal/config/Reception.java new file mode 100644 index 0000000000000..b44fc8d83c1a2 --- /dev/null +++ b/addons/binding/org.openhab.binding.draytonwiser/src/main/java/org/openhab/binding/draytonwiser/internal/config/Reception.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2010-2018 by the respective copyright holders. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ + +package org.openhab.binding.draytonwiser.internal.config; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * @author Andrew Schofield - Initial contribution + */ +public class Reception { + + @SerializedName("Rssi") + @Expose + private Integer rssi; + @SerializedName("Lqi") + @Expose + private Integer lqi; + + public Integer getRSSI() { + return rssi; + } + + public Integer getLQI() { + return lqi; + } + +}