Skip to content

Commit

Permalink
Add RSSI and LQI back to devices after the firmware change
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Schofield <[email protected]> (github: andrew-schofield)
  • Loading branch information
andrew-schofield committed Jun 14, 2018
1 parent a6103c7 commit cdfd4a2
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

}
Original file line number Diff line number Diff line change
@@ -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;
}

}

0 comments on commit cdfd4a2

Please sign in to comment.