Comments (9)
Update: noticed that DateTime
supports custom format via DateTimeFormat
. Unfortunately that is a global setting and cannot be adjusted per chargepoint.
from ocpp-go.
RFC3339 indeed doesn't support a timestamp without explicit timezone and I oversimplified the ISO8601 support, due to it actually being a huge collection of different formats (see https://ijmacd.github.io/rfc3339-iso8601/).
I'd fix this by supporting all ISO8601 via an external lib. Shouldn't break anything and instead add more flexibility.
from ocpp-go.
That would imho be preferable over a fallback global format 👍🏻
from ocpp-go.
Added the improved ISO8601 parsing.
The DateTimeFormat
global variable is still used for sending messages: this allows to configure the lib to use a specific (if any) format for marshaling timestamps. This can be set to arbitrary format. If set to empty (""
), it will use the internal Go default (RFC3339, which is ISO8601-compatible in that case).
from ocpp-go.
The DateTimeFormat global variable is still used for sending messages: this allows to configure the lib to use a specific (if any) format for marshaling timestamps.
Problem remains that this approach does not allow to mix different charge points. The format should be per CP instead of global in order to be useful beyond the most basic case?
from ocpp-go.
Problem remains that this approach does not allow to mix different charge points. The format should be per CP instead of global in order to be useful beyond the most basic case?
You expect sending timestamps in different formats to different clients? Why? By sending an ISO-formatted timestamp to all of them it wouldn't cause any issue, assuming the charge points implement the spec correctly.
from ocpp-go.
Please don't get me wrong- I haven't seen this particular issue in the wild yet.
By sending an ISO-formatted timestamp to all of them it wouldn't cause any issue, assuming the charge points implement the spec correctly.
If that wasn't the case, the global fallback setting would not be needed at all, right?
from ocpp-go.
If that wasn't the case, the global fallback setting would not be needed at all, right?
Totally true for servers. The fallback was originally meant for charge points, in case a vendor wishes to enforce a specific format of the ISO standard.
I'm really hoping to keep this as simple as possible tbh. If this is ever needed I can think of two ways to make this dynamic though:
- include a format override option in the
DateTime
struct itself. This would need to be passed at runtime for every message. It would offer the best flexibility but would require a bit more effort for the applications - a global mapping that can be looked up during serialization. The type serialization is not linked to any state currently (pure object marhsaling operation), so the map needs to be "static". This one is uglier imo
from ocpp-go.
Totally true for servers. The fallback was originally meant for charge points, in case a vendor wishes to enforce a specific format of the ISO standard.
Oh yeah, I've had our server use case in mind. Let's solve this when it really becomes a problem.
Thank you for all the efforts spend with maintaining this great library!
from ocpp-go.
Related Issues (20)
- Fix vet report HOT 2
- Issue with DataTransfer on both ocpp 1.6 and 2.0.1 HOT 2
- Send Command To Charging Station
- I call remote start transaction but got error "ocpp message (2193907606): InternalError - An internal error occurred and the receiver was not able to process the requested Action successfully" HOT 1
- SecurityEventNotification.req HOT 13
- Decouple websocket server and message processing HOT 7
- Parses an OCPP-J message,Occurrence anomaly HOT 4
- Is their any way to bypass the SubjectAlternateName check while using tls? HOT 1
- Fetch chargePointId inside SetBasichandler HOT 6
- Fetch raw ocpp message HOT 4
- Bug with validation for connectorId of GetCompositeSchedule.conf #275
- shoudl idTag validator be altered? HOT 3
- Configurable session timeout HOT 1
- Authorize request missing connectorId? HOT 4
- Websocket Disconnect Handler not called HOT 1
- [中文] help! websocket write: broken pipe, and ws.cleanupConnection() Unlock() not work HOT 1
- [ENG] help! websocket write: broken pipe, and ws.cleanupConnection() Unlock() not work HOT 3
- ocpp16.ChargePointConnectionHandler unreliable or racy HOT 6
- Question on error handling
- CS confuses error responses between requests in case of timeout HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocpp-go.