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

Send Command To Charging Station #259

Open
digzaw opened this issue Mar 16, 2024 · 0 comments
Open

Send Command To Charging Station #259

digzaw opened this issue Mar 16, 2024 · 0 comments

Comments

@digzaw
Copy link

digzaw commented Mar 16, 2024

According to the documentation, we can send request command to the charger station using the simplified API: https://github.com/lorenzodonini/ocpp-go?tab=readme-ov-file#sending-requests

how to run the command outside the SetNewChargePointHandler , because when trying to send command like the example

`func TestSendCommand(t *testing.T) {
cb := func(request *core.ResetConfirmation, e error) {
if e != nil {
log.Printf("operation failed: %v", e)
log.Printf("status: %v", request.GetFeatureName())
} else {
log.Printf("status: %v", request.GetFeatureName())
// ... your own custom logic
}
}

err := utils.CentralSystem.Reset("2", cb, core.ResetTypeSoft)

if err != nil {
	log.Println("error")
	println(err.Error())
}

fmt.Println("ok")

}`

get the panic error:
`--- FAIL: TestSendCommand (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x665568]

goroutine 19 [running]:
testing.tRunner.func1.2({0x69eae0, 0x9180b0})
/usr/local/go/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
/usr/local/go/src/testing/testing.go:1548 +0x397
panic({0x69eae0?, 0x9180b0?})`

Thanks Before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant