Thanks again for the help. Ive already been using a state variable and a timestamp that is updated, whenever the car changes from “asleep” to “online” and vice versa. Over the last week, I watched the car and binding more closely (through debug logs) and think there’s something wrong with the binding or my configuration (I even cleared openHAB’s cache and tmp folders). I’m not using other services that use the Tesla API and I even closed the Tesla app during my tests. Nothing should prevent the car from sleeping or wake it up. I only know that strange things are going on, if I use the binding. Here are two excerpts from my log.
The car wakes up after sleeping for 10 minutes, although nothing should have woken it up. No app use, no physical interaction and the car certainly didn’t move. I don’t know what happens here and why (I manually marked the lines with state changes):
2022-09-08 16:41:35.447 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is neither charging nor moving, skipping updates to allow it to sleep
2022-09-08 16:41:43.471 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:41:43.474 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:41:43.478 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is neither charging nor moving, skipping updates to allow it to sleep
2022-09-08 16:41:50.449 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is neither charging nor moving, skipping updates to allow it to sleep
2022-09-08 16:42:05.450 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is neither charging nor moving, skipping updates to allow it to sleep
2022-09-08 16:42:20.451 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is neither charging nor moving, skipping updates to allow it to sleep
2022-09-08 16:42:35.453 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is neither charging nor moving, skipping updates to allow it to sleep
**2022-09-08 16:42:46.531 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaState' changed from online to asleep**
2022-09-08 16:42:46.660 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaStateChangeTimestamp' changed from 2022-09-08T16:20:31.479529+0200 to 2022-09-08T16:42:46.656414+0200
2022-09-08 16:42:46.525 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:42:46.528 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:43:46.743 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:43:46.745 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:44:50.516 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:44:50.518 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:45:53.673 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:45:53.676 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:46:56.343 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:46:56.345 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:47:59.325 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:47:59.326 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:47:59.327 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is inactive
2022-09-08 16:49:02.416 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:49:02.418 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:50:05.385 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:50:05.388 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:51:08.333 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:51:08.335 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
**2022-09-08 16:52:11.325 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaState' changed from asleep to online**
2022-09-08 16:52:11.345 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaStateChangeTimestamp' changed from 2022-09-08T16:42:46.656414+0200 to 2022-09-08T16:52:11.331642+0200
2022-09-08 16:52:11.319 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:52:11.322 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:52:11.325 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is now awake, updating all data
2022-09-08 16:52:11.326 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:52:11.329 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
2022-09-08 16:52:11.614 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle moved, resetting last location timestamp
2022-09-08 16:52:12.327 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: charge_state
2022-09-08 16:52:13.658 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaInsideTemperature' changed from 21.7 °C to 21.5 °C
2022-09-08 16:52:13.659 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaOutsideTemperature' changed from 21 °C to 20.5 °C
2022-09-08 16:52:13.328 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: climate_state
2022-09-08 16:52:14.330 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: gui_settings
2022-09-08 16:52:15.331 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: charge_state
2022-09-08 16:52:16.332 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: climate_state
2022-09-08 16:52:17.332 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: gui_settings
2022-09-08 16:52:18.334 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: mobile_enabled
2022-09-08 16:52:20.462 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:52:21.463 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
2022-09-08 16:52:35.462 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:52:36.463 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
2022-09-08 16:52:50.463 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:52:51.464 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
2022-09-08 16:53:05.463 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:53:06.464 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
2022-09-08 16:53:11.824 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaOutsideTemperature' changed from 20.5 °C to 21 °C
2022-09-08 16:53:11.489 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 16:53:11.491 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 16:53:11.494 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: charge_state
2022-09-08 16:53:11.494 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: climate_state
2022-09-08 16:53:12.495 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: gui_settings
2022-09-08 16:53:13.496 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: mobile_enabled
2022-09-08 16:53:20.464 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:53:21.465 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
2022-09-08 16:53:35.464 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:53:36.465 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
2022-09-08 16:53:50.464 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: drive_state
2022-09-08 16:53:51.465 [DEBUG] [internal.handler.TeslaAccountHandler] - Invoking: vehicle_state
In this second example, the state changes to asleep, but the binding appears do miss this (I marked the relevant lines again):
**2022-09-08 17:08:43.587 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaState' changed from online to asleep**
2022-09-08 17:08:43.592 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TeslaStateChangeTimestamp' changed from 2022-09-08T16:52:11.331642+0200 to 2022-09-08T17:08:43.589571+0200
2022-09-08 17:08:43.580 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:08:43.583 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:09:46.361 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:09:46.364 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:10:52.372 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:10:52.375 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:11:52.835 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:11:52.838 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:12:56.602 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:12:56.604 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:13:59.498 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:13:59.500 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:13:59.501 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle is inactive
2022-09-08 17:15:02.578 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:15:02.580 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:16:06.861 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:16:06.864 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:17:10.468 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:17:10.471 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:18:13.503 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:18:13.506 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:19:16.580 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:19:16.582 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:20:19.656 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:20:19.659 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:21:20.286 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:21:20.288 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:22:20.726 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:22:20.729 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:23:21.094 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:23:21.097 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:24:21.505 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:24:21.508 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:25:21.936 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:25:21.938 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:26:25.746 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:26:25.749 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:27:26.009 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:27:26.011 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:28:29.557 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:28:29.559 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:29:32.514 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:29:32.517 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:30:35.614 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:30:35.616 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:31:38.583 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:31:38.585 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:32:40.007 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:32:40.011 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:33:43.493 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:33:43.496 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
2022-09-08 17:34:43.700 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:34:43.703 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
**2022-09-08 17:34:43.705 [DEBUG] [internal.handler.TeslaVehicleHandler] - Vehicle did not fall asleep within sleep period, checking again**
2022-09-08 17:35:44.160 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle, response : 200, OK
2022-09-08 17:35:44.162 [DEBUG] [internal.handler.TeslaVehicleHandler] - Querying the vehicle: VIN XXXXXXXXXXXXXXXXX
I don’t know what’s going on here. Combined with the unsolved token refresh problem I decided to disable the binding for now. If the binding was really this “confused” or broken, shouldn’t others/everyone have these problems?