mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
Simplify DateTimeType handling for Tellstick
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
d8485acf58
commit
a6f9977e29
@ -15,9 +15,7 @@ package org.openhab.binding.tellstick.internal.handler;
|
|||||||
import static org.openhab.binding.tellstick.internal.TellstickBindingConstants.*;
|
import static org.openhab.binding.tellstick.internal.TellstickBindingConstants.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.ZoneId;
|
import java.time.Instant;
|
||||||
import java.time.ZonedDateTime;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import org.openhab.binding.tellstick.internal.TellstickBindingConstants;
|
import org.openhab.binding.tellstick.internal.TellstickBindingConstants;
|
||||||
import org.openhab.binding.tellstick.internal.live.xml.DataTypeValue;
|
import org.openhab.binding.tellstick.internal.live.xml.DataTypeValue;
|
||||||
@ -292,10 +290,7 @@ public class TelldusDevicesHandler extends BaseThingHandler implements DeviceSta
|
|||||||
} else {
|
} else {
|
||||||
logger.debug("Unhandled Device {}.", device.getDeviceType());
|
logger.debug("Unhandled Device {}.", device.getDeviceType());
|
||||||
}
|
}
|
||||||
Calendar cal = Calendar.getInstance();
|
updateState(timestampChannel, new DateTimeType(Instant.ofEpochMilli(event.getTimestamp())));
|
||||||
cal.setTimeInMillis(event.getTimestamp());
|
|
||||||
updateState(timestampChannel,
|
|
||||||
new DateTimeType(ZonedDateTime.ofInstant(cal.toInstant(), ZoneId.systemDefault())));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user