Skip to content

Changing wake up behavior and introducing cache#139

Merged
wimaha merged 14 commits intomainfrom
dev
Jan 6, 2026
Merged

Changing wake up behavior and introducing cache#139
wimaha merged 14 commits intomainfrom
dev

Conversation

@wimaha
Copy link
Copy Markdown
Owner

@wimaha wimaha commented Jan 6, 2026

Breaking Changes

Other

  • Introduces per-endpoint, per-VIN in-memory caching for VehicleData API responses, configurable via the new vehicleDataCacheTime environment variable (default: 30 seconds) (0f1a219)
  • Bump Go version from 1.24 to 1.25

wimaha added 8 commits January 6, 2026 10:40
Introduces an 'autoWakeup' parameter to BLE command requests, allowing clients to specify if the vehicle should be woken up before executing commands. Updates the API handler, BLE control logic, and command struct to support this feature.
Updated the README to clarify that vehicles are not automatically woken up before executing commands or fetching data. Added documentation and examples for using the `wakeup=true` parameter to wake the vehicle before performing actions.
Introduces per-endpoint, per-VIN in-memory caching for VehicleData API responses, configurable via the new vehicleDataCacheTime environment variable (default: 30 seconds). Updates documentation and config to clarify cache behavior and usage. Cached responses are served immediately if valid, reducing BLE connection overhead for frequent requests.
Bump Go version to 1.25.5 and update the replacement for github.com/teslamotors/vehicle-command to v0.0.7.
Bump Go version from 1.24 to 1.25 in GitHub workflows, golangci-lint config, and Dockerfile to ensure consistency and use the latest features and fixes.
Enhanced the TryConnectToVehicle method to always check the vehicle's sleep status before starting an Infotainment session. The logic now handles unknown or failed status checks more robustly, attempts wakeup when appropriate, and provides clearer debug logging.
Refactors TryConnectToVehicle to allow the wake_up command to execute with only a VCSEC session, skipping Infotainment and sleep checks. After a successful wake_up, the session is upgraded to include Infotainment for subsequent commands. Improves clarity and control flow for command-specific connection requirements.
Introduces a cache in BleControl to track when each vehicle was last confirmed awake, skipping redundant sleep status checks if the vehicle was confirmed awake within the last 9 minutes. Updates the scanTimeout default from 2 to 5 seconds and documents this change.
@bicaluv
Copy link
Copy Markdown

bicaluv commented Jan 6, 2026

What does the change improve?
And does it effect the evcc config or has one to set the wakeup parameters in the evcc config?

@wimaha
Copy link
Copy Markdown
Owner Author

wimaha commented Jan 6, 2026

The PR should resolve the issue evcc-io/evcc#25707. When you are using the tesla-ble template in evcc, everything should work. I will perform some tests before releasing.

wimaha added 2 commits January 6, 2026 13:44
Bumps the golangci/golangci-lint-action version from v6 to v9 in the GitHub Actions workflow for improved linting and compatibility.
@bicaluv
Copy link
Copy Markdown

bicaluv commented Jan 6, 2026

The PR should resolve the issue evcc-io/evcc#25707. When you are using the tesla-ble template in evcc, everything should work. I will perform some tests before releasing.

Looks like it does only effect when using TWC, right?

@wimaha wimaha changed the title Dev Changing wake up behavior and introducing cache Jan 6, 2026
@wimaha
Copy link
Copy Markdown
Owner Author

wimaha commented Jan 6, 2026

I'm not sure. But since we have a dedicated wake_up command, the old behavior with automatic wake up seems to be confusing. So I've changed that. With the option to activate the automatic wake up again.

wimaha added 3 commits January 6, 2026 16:02
Added a note suggesting to increase scanTimeout if the vehicle is sometimes not found, providing users with guidance for troubleshooting BLE device discovery.
Commands now always trigger auto-wakeup except for 'wake_up' itself, and the 'wakeup' parameter is ignored for commands (only used for 'vehicle_data'). BLE control logic distinguishes between 'vehicle_data' (conditional wakeup based on cache) and other commands (always wake up), improving reliability and clarity in vehicle connection handling.
@wimaha wimaha merged commit 6ddb6b1 into main Jan 6, 2026
5 checks passed
@darkenbula
Copy link
Copy Markdown

The release page lists

Breaking Changes

Vehicles are no longer automatically woken up before fetching data ("vehicle_data"). This is a solution for [evcc-io/evcc#25707](https://github.com/evcc-io/evcc/issues/25707).

If it is a breaking change, is there anything that needs to be changed with the EVCC config?

@wimaha
Copy link
Copy Markdown
Owner Author

wimaha commented Jan 7, 2026

A "Breaking Change" means that certain setups may no longer work and need to be adjusted to the new behavior. The purpose of this label is to draw extra attention to the change. It does not mean that everything stops working.

If you are using the TeslaBLE template (https://docs.evcc.io/docs/devices/vehicles#tesla-ble), you do not need to make any further adjustments. The new version of the proxy works with it without issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants