Repository navigation
Show vehicle status on the dashboard (#168) - #176
Merged
Merged
Conversation
The loop records what it learns anyway: whether a connection is open and since when, the last successful command, the last error, and the sleep state from the sleep check and wake-ups. BleControl.Vehicles() returns a snapshot; QueueLength() the waiting commands. Nothing here contacts the vehicle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GET /api/proxy/1/status combines the loop's view of each connection with the cached charge_state, climate_state and the last body_controller_state, each with the time it was fetched, plus proxy facts (version, uptime, active key, queue). It never contacts the vehicle and shows expired cache entries with their age instead of fetching them. Location and drive data stay out even when cached. POST /api/proxy/1/status/refresh (vin, wakeup) fetches charge_state and climate_state through the command queue, bypassing the cache, and wakes the vehicle only with wakeup=true. It shares fetchVehicleData with the vehicle_data handler, so the result is cached for evcc too. As a POST it is covered by the cross-origin protection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One card per vehicle: connection and sleep badge, battery with a state of charge bar and limit mark, charging, climate, lock state, last contact and last error. Every block says when its data is from (absolute time and a relative age that keeps counting) and is marked outdated once older than vehicleDataCacheTime. Refresh never wakes the vehicle; Wake & refresh asks for confirmation first. static/js/status.js polls the status endpoint every 10 s while the tab is visible and builds the DOM with textContent only; a test keeps innerHTML and similar out of it. Styles follow the existing look, including dark mode and phone width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🟡 Merge after the to-dos@wimaha: The change only adds new routes and a dashboard view. Existing API routes, config and Docker setup are untouched. The new buttons can use BLE and wake the car, so test them on a real car first. Impact on existing users: None – the change is additive. The evcc/Home Assistant routes keep the same format. One small internal change: To-do for the author
Test before merging: Open the dashboard with evcc polling. Click Refresh on a sleeping car and check it stays asleep. Then use Wake & refresh once and check evcc still gets its data. Technical details
|
…inistic - Remove the leading blank line in fetchVehicleData (golangci-lint whitespace). - README: the dashboard and the status endpoints have no login, like the rest of the API; anyone on the network can read the data and wake the vehicle. Recommend a trusted network and a VPN or an authenticating reverse proxy for remote access. - TestVehiclesTracksConnection checked "connected" within a 100 ms connection timeout, which a busy machine can miss. It now keeps the connection open and closes it with RequestClose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Test's in real car successful |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #168.
Why
The dashboard only offered key management. #168 asks for a quick look at what the proxy knows: whether it talks to the car, battery and charging, climate, and when the last contact was. It also asks that the dashboard not wake the car or add BLE load.
What
Vehicle status at the top of
/dashboard. Each vehicle the proxy has talked to gets a card with:body_controller_state.Every block shows when its data is from: the absolute time (with the date if it is not today) plus a relative age that keeps counting. Data older than
vehicleDataCacheTimeis marked outdated instead of being fetched.No BLE from the page itself. The page polls
GET /api/proxy/1/statusevery 10 s while the tab is visible. That endpoint only reads what is already in memory:control/status.go);charge_state/climate_state, however old;body_controller_state.Location and drive data stay out even when cached.
Two buttons per vehicle:
charge_state/climate_statethrough the normal command queue, bypassing the cache, without waking the car. If the car is asleep, the card says so.Both use
POST /api/proxy/1/status/refresh(form fieldsvin,wakeup), which is covered by the cross-origin protection from #170. They sharefetchVehicleDatawith thevehicle_datahandler, so the result is cached for evcc too.Safe rendering.
static/js/status.jsbuilds the DOM withtextContentonly. A test keepsinnerHTMLand similar out of it. Styles follow the existing look, including dark mode and phone width.The full VIN is shown, since it is printed on the car anyway.
Testing
go vet ./...,go test -race ./...updated_at, without drive or location data.Wakeup.Wakeup, data in the status.wimaha/tesla-ble-http-proxy:pr-176(built by Publish a Docker test image :pr-<number> for each pull request #175) for that.🤖 Generated with Claude Code