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

Use numbers option during json decoding #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lorenzodonini
Copy link
Owner

Forces the UseNumber option on the JSON decoder while parsing a message. This prevents intermediate conversion to float64 values, which may cut off values on very high numbers and cause rounding errors.

This will likely introduce some performance decrease, since the json.Decoder is more memory-intensive. Optimization will be analyzed later on.

Solves #188

Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
@eas-ol
Copy link

eas-ol commented Sep 28, 2023

Hi i m facing the the invalid TransactionId problem currently on my Alfen box do you think this patch will solve the Alfen ID issue?
Is it planed to push it to the master?

@olga2323
Copy link

Hi i m facing the the invalid TransactionId problem currently on my Alfen box do you think this patch will solve the Alfen ID issue? Is it planed to push it to the master?

No. It does not solve the issue. It is an problem within the Alfen firmware up to the most current version 6.4.0. I have open tickets with Alfen for more than one year now. The problem is that they set MaxInt as invalid value and I assume that this happens if you use SetChargeProfile without a TransactionId (although the spec allows this and it makes sense in many use cases, Alfen then "forgets" current transactionId leading to the problem described. Is this also your case, maybe you can help with contacting Alfen to solve this?

The only thing you might do is to catch it with an invalid message callback, see here #188

Info on InvalidMessageHook can be found here: #215

@eas-ol
Copy link

eas-ol commented Sep 29, 2023

Hi, i gues iita the same problem.

2023-09-28T16:31:28.433Z:INFO:db_chargingprofi:23: transactionId 18446744073709551615 (not specified)

2023-09-28T16:31:47.546Z:COM:ocpp_rpc.c:681:-> [2,"2","MeterValues",{"connectorId":1,"transactionId":9223372036854775807,"me 2023-09-28T16:31:47.546Z:COM:ocpp_rpc.c:681:terValue":[{"timestamp":"2022-01-01T19:52:37Z","sampledValue":[{"value":"1310.87 2023-09-28T16:31:47.546Z:COM:ocpp_rpc.c:681:7","context":"Sample.Periodic","measurand":"Energy.Active.Import.Register","loca 2023-09-28T16:31:47.546Z:COM:ocpp_rpc.c:681:tion":"Outlet","unit":"kWh"}]}]}] 2023-09-28T16:31:47.593Z:COM:ocpp_rpc.c:1127:<- [4,"2","FormationViolation","json: cannot unmarshal number 922337203685477600 2023-09-28T16:31:47.593Z:COM:ocpp_rpc.c:1127:0 into Go struct field MeterValuesRequest.transactionId of type int",{}] 2023-09-28T16:31:47.621Z:ERROR:ocpp_json.c:462:WAMP_ERROR on (FormationViolation) Desc: json: cannot unmarshal number 922337203 2023-09-28T16:31:47.621Z:ERROR:ocpp_json.c:462:6854776000 into Go struct field MeterValuesRequest.transactionId of type int 2023-09-28T16:31:47.644Z:ERROR:ocpp_rpc.c:438:reply error REPLY ERROR

is it not possible to fix it somehow on the server side by setting the tanactionId for the profile.
I know this still not fix the firmwere from alfen

@andig
Copy link
Contributor

andig commented Jan 15, 2024

@olga2323 @ALL: please excuse OT post. Working on https://github.com/evcc-io/evcc we're faced with varying compatibility issues like the one mentioned above. Would you be interested in creating a collaboration area for cross-project exchange on vendor issues, does and don'ts? Maybe Github or anything else. Please excuse the OT post- thank you!

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

Successfully merging this pull request may close these issues.

ocpp1.6 - parsing MeterValues from Alfen with invalid TransactionId (9223372036854775807)
4 participants