Skip to content

Commit

Permalink
Ocpp: allow hijacking foreign transactions (evcc-io#10109)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Sep 30, 2023
1 parent c929e89 commit d96a1ec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions charger/ocpp/cp_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func (cp *CP) MeterValues(request *core.MeterValuesRequest) (*core.MeterValuesCo
cp.mu.Lock()
defer cp.mu.Unlock()

if request.TransactionId != nil && cp.txnId == 0 {
cp.log.DEBUG.Printf("hijacking transaction: %d", *request.TransactionId)
cp.txnId = *request.TransactionId
}

for _, meterValue := range request.MeterValue {
// ignore old meter value requests
if meterValue.Timestamp.Time.After(cp.meterUpdated) {
Expand Down

0 comments on commit d96a1ec

Please sign in to comment.