Background
A charge point must send a StatusNotification CALL to the CSMS whenever a connector's operational state changes. This is how the CSMS tracks connector availability in real time — without it, the CSMS never knows whether connectors are available, charging, faulted, etc.
The Python reference handles this in ocpp/v16/call.py:
@dataclass
class StatusNotification:
connector_id: int
error_code: enums.ChargePointErrorCode
status: enums.ChargePointStatus
timestamp: Optional[str] = None
info: Optional[str] = None
vendor_id: Optional[str] = None
vendor_error_code: Optional[str] = None
The current Rust ChargePoint never sends StatusNotification, even as connector state transitions happen inside TransactionManager. This means a connected CSMS has no visibility into connector state.
What needs to change
ChargePoint::send_status_notification(connector_id, status, error_code) — sends StatusNotificationRequest via call(). Timestamp set to Utc::now().
- Automatic notifications on state transitions —
start_transaction() and stop_transaction() should send StatusNotification to reflect each state change:
- Before auth:
Available → Preparing
- After
StartTransactionResponse accepted: Preparing → Charging
- After
StopTransactionRequest sent: Charging → Finishing → Available
- On connect / after boot: send
StatusNotification(connector_id=0, status=Available, error_code=NoError) for each configured connector.
- CSMS handler on the server side: default
on_status_notification handler in OcppServer that logs the status change and emits a TransportEvent::StatusNotification { cp_id, connector_id, status }.
Acceptance criteria
Python reference
Dependencies
Background
A charge point must send a
StatusNotificationCALL to the CSMS whenever a connector's operational state changes. This is how the CSMS tracks connector availability in real time — without it, the CSMS never knows whether connectors are available, charging, faulted, etc.The Python reference handles this in
ocpp/v16/call.py:The current Rust
ChargePointnever sendsStatusNotification, even as connector state transitions happen insideTransactionManager. This means a connected CSMS has no visibility into connector state.What needs to change
ChargePoint::send_status_notification(connector_id, status, error_code)— sendsStatusNotificationRequestviacall(). Timestamp set toUtc::now().start_transaction()andstop_transaction()should sendStatusNotificationto reflect each state change:Available → PreparingStartTransactionResponseaccepted:Preparing → ChargingStopTransactionRequestsent:Charging → Finishing → AvailableStatusNotification(connector_id=0, status=Available, error_code=NoError)for each configured connector.on_status_notificationhandler inOcppServerthat logs the status change and emits aTransportEvent::StatusNotification { cp_id, connector_id, status }.Acceptance criteria
ChargePoint::send_status_notification(connector_id: u32, status: ChargePointStatus, error_code: ChargePointErrorCode) -> OcppResult<()>implementedstart_transaction(): sendsPreparingbefore authorize,Chargingafter accepted startstop_transaction(): sendsFinishing, thenAvailableafter stop confirmedStatusNotification(connector_id=0, status=Available, error_code=NoError)for each connectorChargePointErrorCode::NoErroris the default for normal state transitionsstatus_notification_sent_on_start_transaction— verify Preparing → Charging framesstatus_notification_sent_on_stop_transaction— verify Finishing → Available framesstatus_notification_sent_after_boot_accepted— connector 0 Available after bootsend_status_notification_custom_error_code— sends with specified error codecargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test --workspaceall passPython reference
ocpp/v16/call.py—StatusNotificationdataclassocpp/v16/call_result.py—StatusNotificationresponse (empty{})ocpp/v16/enums.py—ChargePointStatus,ChargePointErrorCodeDependencies
start_transaction()andstop_transaction()must send OCPP messages before StatusNotification can be woven insend_status_notificationafter boot requires the boot sequence to complete