Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ocpp: cache and re-use initial status (3rd attempt) #16908

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
wip
  • Loading branch information
andig committed Oct 26, 2024
commit 2313623ffdc39766c8ea21f8257429e1e45d0a18
8 changes: 4 additions & 4 deletions charger/ocpp/cs.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,21 @@ func (cs *CS) NewChargePoint(chargePoint ocpp16.ChargePointConnection) {
defer cs.mu.Unlock()

// check for configured charge point
state, ok := cs.regs[chargePoint.ID()]
reg, ok := cs.regs[chargePoint.ID()]
if ok {
cs.log.DEBUG.Printf("charge point connected: %s", chargePoint.ID())

// trigger initial connection if charge point is already setup
if cp := state.cp; cp != nil {
if cp := reg.cp; cp != nil {
cp.connect(true)
}

return
}

// check for configured anonymous charge point
state, ok = cs.regs[""]
if cp := state.cp; ok && cp != nil {
reg, ok = cs.regs[""]
if cp := reg.cp; ok && cp != nil {
cs.log.INFO.Printf("charge point connected, registering: %s", chargePoint.ID())

// update id
Expand Down
Loading