Use core unit classes (#9261)

Add-ons should not depend on tec.uom.se classes but use core unit classes instead so they are less impacted when this library is replaced or upgraded.

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-12-06 19:57:26 +01:00
committed by GitHub
parent 4fafb06251
commit ac18da7fc3
14 changed files with 46 additions and 67 deletions

View File

@@ -29,8 +29,10 @@ import javax.measure.Unit;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.neohub.internal.NeoHubAbstractDeviceData.AbstractRecord;
import org.openhab.binding.neohub.internal.NeoHubBindingConstants.NeoHubReturnResult;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
@@ -46,8 +48,6 @@ import org.slf4j.LoggerFactory;
import com.google.gson.JsonSyntaxException;
import tec.uom.se.unit.Units;
/**
* The {@link NeoHubHandler} is the openHAB Handler for NeoHub devices
*
@@ -212,7 +212,7 @@ public class NeoHubHandler extends BaseBridgeHandler {
/**
* sends a JSON request to the NeoHub to read the device data
*
*
* @return a class that contains the full status of all devices
*/
protected @Nullable NeoHubAbstractDeviceData fromNeoHubGetDeviceData() {
@@ -259,7 +259,7 @@ public class NeoHubHandler extends BaseBridgeHandler {
if (deviceData instanceof NeoHubLiveDeviceData) {
/*
* note: time-stamps are measured in seconds from 1970-01-01T00:00:00Z
*
*
* new API: discard systemData if its time-stamp is older than the system
* time-stamp on the hub
*/
@@ -269,7 +269,7 @@ public class NeoHubHandler extends BaseBridgeHandler {
} else {
/*
* note: time-stamps are measured in seconds from 1970-01-01T00:00:00Z
*
*
* legacy API: discard systemData if its time-stamp is older than one hour
*/
if (systemData.timeStamp < Instant.now().minus(1, ChronoUnit.HOURS).getEpochSecond()) {
@@ -288,7 +288,7 @@ public class NeoHubHandler extends BaseBridgeHandler {
/**
* sends a JSON request to the NeoHub to read the system data
*
*
* @return a class that contains the status of the system
*/
protected @Nullable NeoHubReadDcbResponse fromNeoHubReadSystemData() {
@@ -369,7 +369,7 @@ public class NeoHubHandler extends BaseBridgeHandler {
onlineDeviceCount++;
}
}
state = new QuantityType<>((100.0 * onlineDeviceCount) / totalDeviceCount, Units.PERCENT);
state = new QuantityType<>((100.0 * onlineDeviceCount) / totalDeviceCount, SmartHomeUnits.PERCENT);
}
updateState(CHAN_MESH_NETWORK_QOS, state);
}