Skip to content

Commit

Permalink
Ocpp: fix connector id not sent
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Apr 14, 2023
1 parent 4408343 commit d043992
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion charger/ocpp/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/util"
"github.com/lorenzodonini/ocpp-go/ocpp1.6/core"
"github.com/lorenzodonini/ocpp-go/ocpp1.6/remotetrigger"
"github.com/lorenzodonini/ocpp-go/ocpp1.6/types"
)

Expand Down Expand Up @@ -121,7 +122,9 @@ func (cp *CP) Initialized() error {
case <-cp.statusC:
return
default:
Instance().TriggerMessageRequest(cp.ID(), core.StatusNotificationFeatureName)
Instance().TriggerMessageRequest(cp.ID(), core.StatusNotificationFeatureName, func(request *remotetrigger.TriggerMessageRequest) {
request.ConnectorId = &cp.connector
})
}
})

Expand Down
2 changes: 1 addition & 1 deletion charger/ocpp/cs_core.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (cs *CS) TriggerMessageRequest(id string, requestedMessage remotetrigger.Me
}

log.Printf("TriggerMessage %s for %s: %+v", requestedMessage, id, status)
}, requestedMessage); err != nil {
}, requestedMessage, props...); err != nil {
cs.log.ERROR.Printf("send TriggerMessage %s for %s failed: %v", requestedMessage, id, err)
}
}
Expand Down
2 changes: 2 additions & 0 deletions charger/ocpp_test_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ func (handler *ChargePointHandler) OnDataTransfer(request *core.DataTransferRequ
func (handler *ChargePointHandler) OnGetConfiguration(request *core.GetConfigurationRequest) (confirmation *core.GetConfigurationConfirmation, err error) {
fmt.Printf("%T %+v\n", request, request)
one := "1"
meter := "Power.Active.Import"
return core.NewGetConfigurationConfirmation([]core.ConfigurationKey{
{Key: "AuthorizationKey"},
{Key: "NumberOfConnectors", Value: &one},
{Key: "ChargeProfileMaxStackLevel", Value: &one},
{Key: "ChargingScheduleMaxPeriods", Value: &one},
{Key: "MaxChargingProfilesInstalled", Value: &one},
{Key: "ChargingScheduleAllowedChargingRateUnit", Value: &one},
{Key: "MeterValuesSampledData", Value: &meter},
}), nil
}

Expand Down

0 comments on commit d043992

Please sign in to comment.