mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for Foobot
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
b74e1e671d
commit
0a46ff2a79
@ -15,8 +15,6 @@ package org.openhab.binding.foobot.internal.handler;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.measure.Unit;
|
import javax.measure.Unit;
|
||||||
@ -201,8 +199,7 @@ public class FoobotDeviceHandler extends BaseThingHandler {
|
|||||||
} else {
|
} else {
|
||||||
final Unit<?> stateUnit = sensor.getUnit(unit);
|
final Unit<?> stateUnit = sensor.getUnit(unit);
|
||||||
if (sensor == FoobotSensor.TIME) {
|
if (sensor == FoobotSensor.TIME) {
|
||||||
return new DateTimeType(
|
return new DateTimeType(Instant.ofEpochSecond(Long.parseLong(value)));
|
||||||
ZonedDateTime.ofInstant(Instant.ofEpochSecond(Long.parseLong(value)), ZoneId.systemDefault()));
|
|
||||||
} else if (stateUnit == null) {
|
} else if (stateUnit == null) {
|
||||||
return new DecimalType(value);
|
return new DecimalType(value);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user