mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for Gardena
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
e950bc7d70
commit
3a6a2a27e9
@ -59,7 +59,7 @@ public class GardenaHandlerFactory extends BaseThingHandlerFactory {
|
||||
if (THING_TYPE_ACCOUNT.equals(thing.getThingTypeUID())) {
|
||||
return new GardenaAccountHandler((Bridge) thing, httpClientFactory, webSocketFactory, timeZoneProvider);
|
||||
} else {
|
||||
return new GardenaThingHandler(thing, timeZoneProvider);
|
||||
return new GardenaThingHandler(thing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ package org.openhab.binding.gardena.internal.handler;
|
||||
|
||||
import static org.openhab.binding.gardena.internal.GardenaBindingConstants.*;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -44,7 +43,6 @@ import org.openhab.binding.gardena.internal.model.dto.command.ValveSetCommand.Va
|
||||
import org.openhab.binding.gardena.internal.util.PropertyUtils;
|
||||
import org.openhab.binding.gardena.internal.util.StringUtils;
|
||||
import org.openhab.binding.gardena.internal.util.UidUtils;
|
||||
import org.openhab.core.i18n.TimeZoneProvider;
|
||||
import org.openhab.core.library.types.DateTimeType;
|
||||
import org.openhab.core.library.types.DecimalType;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
@ -74,13 +72,11 @@ import org.slf4j.LoggerFactory;
|
||||
@NonNullByDefault
|
||||
public class GardenaThingHandler extends BaseThingHandler {
|
||||
private final Logger logger = LoggerFactory.getLogger(GardenaThingHandler.class);
|
||||
private TimeZoneProvider timeZoneProvider;
|
||||
private @Nullable ScheduledFuture<?> commandResetFuture;
|
||||
private Map<String, Integer> commandDurations = new HashMap<>();
|
||||
|
||||
public GardenaThingHandler(Thing thing, TimeZoneProvider timeZoneProvider) {
|
||||
public GardenaThingHandler(Thing thing) {
|
||||
super(thing);
|
||||
this.timeZoneProvider = timeZoneProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -213,8 +209,7 @@ public class GardenaThingHandler extends BaseThingHandler {
|
||||
if (date == null) {
|
||||
return UnDefType.NULL;
|
||||
} else {
|
||||
ZonedDateTime zdt = ZonedDateTime.ofInstant(date.toInstant(), timeZoneProvider.getTimeZone());
|
||||
return new DateTimeType(zdt);
|
||||
return new DateTimeType(date.toInstant());
|
||||
}
|
||||
}
|
||||
} catch (GardenaException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user