diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java index 5f175a88967..09c1cf3d3d3 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java @@ -99,6 +99,7 @@ public class TeslaBindingConstants { public static final String CHANNEL_CHARGE = "charge"; public static final String CHANNEL_COMBINED_TEMP = "combinedtemp"; + public static final String CHANNEL_EVENTSTAMP = "eventstamp"; // thing configurations public static final String CONFIG_ALLOWWAKEUP = "allowWakeup"; diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java index aa9525cff81..440b5e6da2a 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java @@ -54,6 +54,7 @@ import org.openhab.binding.tesla.internal.protocol.VehicleState; import org.openhab.binding.tesla.internal.throttler.QueueChannelThrottler; import org.openhab.binding.tesla.internal.throttler.Rate; import org.openhab.core.io.net.http.WebSocketFactory; +import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.IncreaseDecreaseType; import org.openhab.core.library.types.OnOffType; @@ -834,6 +835,7 @@ public class TeslaVehicleHandler extends BaseThingHandler { try { if (request != null && result != null && !"null".equals(result)) { updateStatus(ThingStatus.ONLINE); + updateState(CHANNEL_EVENTSTAMP, new DateTimeType()); // first, update state objects if ("queryVehicle".equals(request)) { if (vehicle != null) { @@ -844,8 +846,8 @@ public class TeslaVehicleHandler extends BaseThingHandler { return; } - if (vehicle != null && "asleep".equals(vehicle.state)) { - logger.debug("Vehicle is asleep."); + if (vehicle != null && ("asleep".equals(vehicle.state) || "offline".equals(vehicle.state))) { + logger.debug("Vehicle is {}", vehicle.state); return; }