mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[tesla] Fix update timestamp and null exception for offline state (#15756)
Signed-off-by: Bill Forsyth <git@billforsyth.net>
This commit is contained in:
parent
43f5b216f1
commit
118afa31fd
@ -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";
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user