mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
Simplify DateTimeType handling for Ruuvi Gateway MQTT
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
cb74dd6497
commit
d00d654976
@ -13,7 +13,6 @@
|
||||
package org.openhab.binding.mqtt.ruuvigateway.internal;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.binding.mqtt.generic.ChannelConfig;
|
||||
@ -33,8 +32,6 @@ import org.openhab.core.thing.ChannelUID;
|
||||
@NonNullByDefault
|
||||
public class RuuviCachedDateTimeState extends ChannelState {
|
||||
|
||||
private static final ZoneId UTC = ZoneId.of("UTC");
|
||||
|
||||
/**
|
||||
* Construct cache for DateTime values
|
||||
*
|
||||
@ -51,6 +48,6 @@ public class RuuviCachedDateTimeState extends ChannelState {
|
||||
* @param value instant representing value
|
||||
*/
|
||||
public void update(Instant value) {
|
||||
cachedValue.update(new DateTimeType(value.atZone(UTC)));
|
||||
cachedValue.update(new DateTimeType(value));
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -360,8 +359,8 @@ public class RuuviGatewayTest extends MqttOSGiTest {
|
||||
|
||||
assertEquals(new QuantityType<>(new BigDecimal(rssiDecibelMilliwatts), Units.DECIBEL_MILLIWATTS),
|
||||
channelStateGetter.apply(CHANNEL_ID_RSSI));
|
||||
assertEquals(new DateTimeType(ts.atZone(ZoneId.of("UTC"))), channelStateGetter.apply(CHANNEL_ID_TS));
|
||||
assertEquals(new DateTimeType(gwts.atZone(ZoneId.of("UTC"))), channelStateGetter.apply(CHANNEL_ID_GWTS));
|
||||
assertEquals(new DateTimeType(ts), channelStateGetter.apply(CHANNEL_ID_TS));
|
||||
assertEquals(new DateTimeType(gwts), channelStateGetter.apply(CHANNEL_ID_GWTS));
|
||||
assertEquals(new StringType(gwMac), channelStateGetter.apply(CHANNEL_ID_GWMAC));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user