Ocpp: trigger status globally for chargers that don't answer the connector (#16327)

This commit is contained in:
andig 2024-09-25 21:06:58 +02:00 • committed by GitHub
parent 37705b873b
commit ee928e3ae7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View file

@ -162,13 +162,7 @@ func NewOCPP(id string, connector int, idTag string,
stackLevelZero: stackLevelZero,
}
if cp.HasRemoteTriggerFeature {
if err := conn.TriggerMessageRequest(core.StatusNotificationFeatureName); err != nil {
c.log.DEBUG.Printf("failed triggering StatusNotification: %v", err)
}
go conn.WatchDog(10 * time.Second)
}
go conn.WatchDog(10 * time.Second)
return c, conn.Initialized()
}

View file

@ -156,6 +156,13 @@ func (cp *CP) Setup(meterValues string, meterInterval time.Duration) error {
cp.log.DEBUG.Printf("failed configuring %s: %v", KeyWebSocketPingInterval, err)
}
// trigger status for all connectors
if cp.HasRemoteTriggerFeature {
if err := cp.TriggerMessageRequest(0, core.StatusNotificationFeatureName); err != nil {
cp.log.WARN.Printf("failed triggering StatusNotification: %v", err)
}
}
return nil
}