diff --git a/charger/ocpp.go b/charger/ocpp.go index 918486fd9..c387463e5 100644 --- a/charger/ocpp.go +++ b/charger/ocpp.go @@ -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) } } diff --git a/charger/ocpp/connector.go b/charger/ocpp/connector.go index 9e0439e42..bb6ecd2b5 100644 --- a/charger/ocpp/connector.go +++ b/charger/ocpp/connector.go @@ -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 }