Open solanu opened 3 years ago
I have the following code and I don't receive meter values:
package main import ( "errors" "fmt" "log" "os" "strings" "time" "github.com/voltbras/go-ocpp" "github.com/voltbras/go-ocpp/cs" "github.com/voltbras/go-ocpp/messages/v1x/cpreq" "github.com/voltbras/go-ocpp/messages/v1x/cpresp" ) func main() { ocpp.SetDebugLogger(log.New(os.Stdout, "DEBUG:", log.Ltime)) ocpp.SetErrorLogger(log.New(os.Stderr, "ERROR:", log.Ltime)) csys := cs.New() go csys.Run(":21022", func(req cpreq.ChargePointRequest, metadata cs.ChargePointRequestMetadata) (cpresp.ChargePointResponse, error) { fmt.Printf("EXAMPLE(MAIN): Request from %s\n", metadata.ChargePointID) fmt.Printf(">>>>>>> %v\n", req.Action()) switch req := req.(type) { case *cpreq.BootNotification: return &cpresp.BootNotification{ Status: "Accepted", CurrentTime: time.Now(), Interval: 60, }, nil case *cpreq.Heartbeat: return &cpresp.Heartbeat{CurrentTime: time.Now()}, nil case *cpreq.MeterValues: fmt.Println("This message is not displayed") fmt.Printf("METADATA %#v\n", metadata) fmt.Printf("REQ - metervalue: %#v\n", req.MeterValue) return &cpresp.MeterValues{}, nil case *cpreq.StatusNotification: fmt.Println("This works " + req.Status) if req.Status != "Available" { // chargepoint is unavailable } return &cpresp.StatusNotification{}, nil default: fmt.Printf("EXAMPLE(MAIN): action not supported: %s\n", req.Action()) return nil, errors.New("Response not supported") } }) select {} }
My charge point is configure to send meter values.
I have the following code and I don't receive meter values:
My charge point is configure to send meter values.