ADR 0001: Station Domain Model
Status: Accepted Date: 2026-05-19
Purpose
Define the Autimit station domain model used by the API, CSMS, dashboard, mobile app, and PostgreSQL database.
Domain Terms
| Term | Description |
|---|---|
Station | Physical charging station managed by Autimit |
stationCode | Public station identifier used during station provisioning and CSMS connection |
stationSecret | One-time secret generated for station provisioning |
stationSecretHash | Stored hash of the station provisioning secret |
Station Connector | Physical charging connector attached to a station |
Station Runtime State | Current operational state reported by the CSMS |
Charging Session | Charging session created when a user starts using a station connector |
Station Provisioning
Station provisioning starts in the Autimit API.
The API creates a station and returns provisioning data once:
{
"station": {
"id": "uuid",
"stationCode": "AUTIMIT_STATION_CODE",
"ocppConnectionUrl": "wss://ws.autimit.com/ocpp/1.6/AUTIMIT_STATION_CODE"
},
"provisioning": {
"stationCode": "AUTIMIT_STATION_CODE",
"ocppConnectionUrl": "wss://ws.autimit.com/ocpp/1.6/AUTIMIT_STATION_CODE",
"stationSecret": "ONE_TIME_SECRET"
}
}
Rules:
stationSecretis shown only once.- Only
stationSecretHashis stored. stationCodemust be unique.- A station must belong to an account.
- A station must belong to a location.
- A station may have one or more connectors.
API Surface
Initial API endpoints:
POST /api/stations
GET /api/stations
GET /api/stations/:id
Request fields for station creation:
{
"accountId": "uuid",
"locationId": "uuid",
"stationCode": "AUTIMIT_STATION_CODE",
"serialNumber": "SERIAL_NUMBER",
"manufacturer": "MANUFACTURER",
"model": "MODEL",
"connectors": 1
}
PostgreSQL Model
Time-series storage and current-state/event-history rules are defined in ADR 0002: Timeseries Data Model.
Initial foundation tables:
accounts
locations
stations
station_connectors
station_runtime_state
accounts
Represents the business owner or tenant that owns locations and stations.
Required fields:
idnamedocumentis_activecreated_atupdated_at
locations
Represents a physical place where stations are installed.
Required fields:
idaccount_idnameaddresslatitudelongitudeis_publicis_activecreated_atupdated_at
stations
Stores stable station registration data.
Required fields:
idaccount_idlocation_idstation_codestation_secret_hashserial_numbermanufacturermodelconnectorsis_activecreated_atupdated_at
Rules:
account_idreferencesaccounts.id.location_idreferenceslocations.id.station_codeis unique case-insensitively.connectorsmust be greater than zero.- This table should not store frequently updated online/offline state.
station_connectors
Stores connector configuration for each station.
Required fields:
idstation_idconnector_numberconnector_typemax_power_kwis_activecreated_atupdated_at
Rules:
station_idreferencesstations.id.connector_numberis unique per station.max_power_kwmust be greater than zero.
station_runtime_state
Stores frequently updated CSMS state for each station.
Required fields:
station_idstatuslast_heartbeat_atbooted_atfirmware_versionlast_error_codeupdated_at
Rules:
station_idis the primary key.station_idreferencesstations.id.statusmust use a constrained set of values.- CSMS updates this table on connection lifecycle and station messages.
CSMS Connection Flow
Station connection path:
/ocpp/1.6/{stationCode}
Handshake:
- Extract
stationCodefrom path. - Validate Basic Auth username equals
stationCode. - Find active station by
stationCode. - Verify password against
stationSecretHash. - Accept WebSocket connection.
- Bind connection to
station.id.
Runtime persistence:
| Event | Persistence |
|---|---|
| Station connects | update station_runtime_state.status |
| Boot notification | update station_runtime_state.booted_at, firmware_version |
| Heartbeat | update station_runtime_state.last_heartbeat_at |
| Connector status change | update connector runtime data |
| Station disconnects | update station_runtime_state.status |
Implementation Order
- Create PostgreSQL foundation tables.
- Add API station provisioning.
- Update CSMS station lookup and authentication.
- Add connector runtime state.
- Add charging session tables.
- Add meter values storage.