Home chargers: your own wallbox as a record, imported the way a car is
The Home chargers tab has been showing a hardcoded "Home charger · 11 kW · NACS" since it was drawn, and the control card asked for a serial as free text — a number printed on a box hanging in a garage, typed in by hand while the connected account already knew it. The garage solved the same problem for cars a while ago, so this is that solution aimed at the wall: pick the charger off a service you have connected, press Import, and it becomes a record of yours. A charger is a record rather than a live listing because it has to outlive the account it came from. Disconnect Anker and the wallbox is still on the wall; the integration is how the charger was found, not what it is. Hence home_chargers, owned by a person and not related to any car — it charges whichever car is plugged into it, and it outlives all of them — and hence no sharing: a charger is one household's business in a way a car shared with a partner is not. The provider layer is vehicleproviders.go's shape on purpose, down to the soft gate: a listing answers 200 with an empty list and the sentence that says what to do about a closed gate, a write answers 400, because there the caller asked for something that did not happen. Anker and Greencell are two adapters over plugins that already exist, so the next charger service is an adapter appended to chargerSources() and nothing else. What is deliberately absent is the car import's checkbox panel: a charger is a name, a serial and the hardware behind it, all of which the list already carries, so there is nothing to choose and the whole screen is pick one, press Import. Only the name is editable afterwards. The rest describes hardware and came from the service, and the provider link is written by the import endpoint alone, so renaming a charger cannot quietly orphan it from the account it tracks. Deleting one says as much in its confirmation: the charger is untouched, and importing it again brings the record straight back. The Anker gate moved into ankerGate() beside greencellGate(), because the same four-case switch was about to exist in a third place. Behaviour is unchanged — the same sentences, and the probe still skips the personal opt-in, since checking credentials is what you do before switching the integration on. The phone app still has the old tab; parity there is a separate change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a809980d8b
commit
a3f69fa5ef
@@ -153,6 +153,7 @@ const (
|
||||
colMaintenance = "maintenance_entries"
|
||||
colDocuments = "car_documents"
|
||||
colReminders = "reminders"
|
||||
colHomeChargers = "home_chargers"
|
||||
colControlAudit = "control_audit"
|
||||
colAppSettings = "app_settings"
|
||||
)
|
||||
@@ -464,6 +465,17 @@ func (s *Server) Handler() http.Handler {
|
||||
mux.HandleFunc("GET /api/vehicle-providers/{provider}/vehicles", s.handleProviderVehicles)
|
||||
mux.HandleFunc("POST /api/vehicle-providers/{provider}/import", s.handleProviderImport)
|
||||
|
||||
// Charger providers — the same move for the wallbox: a charger on a connected
|
||||
// service becomes one of the caller's home chargers. See chargerproviders.go.
|
||||
mux.HandleFunc("GET /api/charger-providers", s.handleListChargerProviders)
|
||||
mux.HandleFunc("GET /api/charger-providers/{provider}/chargers", s.handleProviderChargers)
|
||||
mux.HandleFunc("POST /api/charger-providers/{provider}/import", s.handleChargerImport)
|
||||
|
||||
// The caller's own chargers (homechargers.go).
|
||||
mux.HandleFunc("GET /api/home-chargers", s.listHomeChargers)
|
||||
mux.HandleFunc("PATCH /api/home-chargers/{id}", s.updateHomeCharger)
|
||||
mux.HandleFunc("DELETE /api/home-chargers/{id}", s.deleteHomeCharger)
|
||||
|
||||
// Cars + sharing.
|
||||
mux.HandleFunc("GET /api/cars", s.listCars)
|
||||
mux.HandleFunc("POST /api/cars", s.createCar)
|
||||
|
||||
Reference in New Issue
Block a user