Ocpp: initial StatusNotification trigger request (#15734)

This commit is contained in:
premultiply 2024-08-27 12:51:27 +02:00 • committed by GitHub
parent bc61905176
commit e6d3ad3f9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -273,6 +273,10 @@ func NewOCPP(id string, connector int, idtag string,
// see who's there
if c.hasRemoteTriggerFeature {
if err := conn.TriggerMessageRequest(core.StatusNotificationFeatureName); err != nil {
c.log.DEBUG.Printf("failed triggering StatusNotification: %v", err)
}
if err := ocpp.Instance().TriggerMessageRequest(cp.ID(), core.BootNotificationFeatureName); err == nil {
select {
case <-time.After(timeout):
@ -282,6 +286,8 @@ func NewOCPP(id string, connector int, idtag string,
c.bootNotification = res
}
}
} else {
c.log.DEBUG.Printf("failed triggering BootNotification: %v", err)
}
}

View file

@ -100,12 +100,16 @@ func (conn *Connector) WatchDog(timeout time.Duration) {
// Initialized waits for initial charge point status notification
func (conn *Connector) Initialized() error {
trigger := time.After(conn.timeout / 2)
timeout := time.After(conn.timeout)
for {
select {
case <-conn.statusC:
return nil
case <-trigger: // try to trigger StatusNotification again as last resort
conn.TriggerMessageRequest(core.StatusNotificationFeatureName)
case <-timeout:
return api.ErrTimeout
}