Releases: lorenzodonini/ocpp-go
v0.18.0
Additions and improvements
Generic
- Retry initial Websocket connection by @h0ru5 in #252
- Add Stop method to CSMS and CentralSystem by @rbright in #245
- Added iso8601 timestamp support by @lorenzodonini in #241
- Altered auto-reconnection attempt logic to comply with part 4 of the OCPP2.0.1 standard by @Jonesywolf in #221
- Allow returning of CallErrors by @VolkerLieber in #225
- Improved mutex usage in fifo queue and map by @andig in #229
- Moved
ocpp.FormationViolation
to Endpoint by @andig in #232 - Added
Now
datetime utility function by @lorenzodonini in #242 - Improved code quality by @frednesto in #254
Bugfixes
Generic
- Updated ProfileName constants by @xBlaz3kx in #248
- Fixed race in
DefaultServerDispatcher.Start()
by @andig in #228 - Fixed races in websocket and ocppj by @andig in #233
v2.0.1
- Fixed required validation for
idToken
value exceptNoAuthorization
type by @dwibudut in #226 - Allowed empty group ID tokens for
NoAuthorization
token type by @Jonesywolf in #250 - Fixed typo field
iso15118CertificateHashData
onAuthorizeRequest
by @dwibudut in #256 - Fixed custom v1.6 and v2.0.1 validations that would override each other by @dwibudut in #224
- Removed connection profile URL validation by @Jonesywolf in #238
Full Changelog: v0.17.0...v0.18.0
v0.17.0
Additions and improvements
v1.6
- Added the
IsConnected
getter to charge point instances
v2.0.1
- Added the
IsConnected
getter to charging station instances SampleValue.Value
field is not required anymore- Added the missing
CertificateHashDataChain
optional field in GetInstalledCertificateIds response - Added the missing
V2GCertificateChain
CertificateUse enum value - Added the missing
ISO15693
andMacAddress
enum values of IdTokenType
Websocket
- The default subprotocol is now set correctly during initial negotiation and may be enforced via the
SetRequestedSubProtocol
on the websocket client - The server now supports adding additional HTTP handlers, via an underlying router
Generic
- Upgraded lib to min Go version 1.16
- Upgraded some dependencies
- Message callbacks are now invoked within dedicated goroutines to prevent the called from being blocked
- Added debug logs for outgoing/incoming raw JSON messages
- Added support for HTML escaping
- Added the
SetNewChargingStationValidationHandler
on server endpoints for checking incoming connections before the websocket upgrade takes place - Improved error handling when sending responses/errors
- Added optional
SetInvalidMessageHook
handler to intercept and handle invalid messages on ocppj layer
Bugfixes
v1.6
stopTime
parameter in GetDiagnosticsRequest is now named correctlyChargingProfileStatusNotSupported
value in SetChargingProfile messageClearChargingProfileStatus
validation in ClearChargingProfile confirmationConfigurationKey
validation in GetConfiguration message- Several validation keys are not overwritten by the v2.0.1 package anymore due to name duplication
v2.0.1
idToken
type- Removed incorrect validation for
idToken
in RequestTransaction request AttributeStatus
validation in SetVariables responsemessagesInQueue
json field in GetTransactionStatus responsecertificateType
field in GetInstalledCertificateIds request- Update
FormatViolation
ocpp-j error type SerialNumber
updated to max length 40 in CertificateHashData and OCSPRequestDataType
Generic
- Incoming ocpp-j errors with empty details field are now parsed correctly
- Invalid ocpp-j message types are now parsed and handled correctly
- Fixed deadlock caused by double invocation on
client.Stop
Generic improvements and bugfixes
Additions and Improvements
v1.6
- Changed the
StopTransactionRequest.MeterStop
field to allow negative values
OCPP-J
- Added a
onDisconnectedHandler
callback to theClient
struct, which allows to be notified if a connection is interrupted and the dispatcher paused - Added a
onReconnectedHandler
callback to theClient
struct, which allows to be notified when a connection is re-established and the dispatcher resumed - Added a timeout option for outgoing server requests: if a response is not received within the configured timeframe, the request is discarded and an error is returned to the sender. The feature is available by invoking the
SetTimeout
method on aServerDispatcher
- Added support for disabling message validation entirely, via the
SetMessageValidation
package function - Added support for verbose logging (using an optional
logging.Logger
)
Websockets
- Added a
RemoteAddr
function to websockets for retrieving the address of the remote host - Added support for disabling ping/pong mechanism, by setting
PingWait = 0
within the timeout configuration - Added support for verbose logging (using an optional
logging.Logger
)
Generic
- Moved logging interfaces to a dedicated
ocpp-go/logging
package
Bugfixes
- Fixed a bug that occurred when sending messages over a closed websocket channel
- Fixed a bug that would deadlock a newly created websocket, if the
NewClientHandler
callback contained blocking code - Fixed several other race conditions in the ocpp-j layer
- Fixed a crash caused by incoming empty json requests/responses
- Fixed a crash caused by incoming OCCP errors not containing a description field
- Fixed the default subprotocol for v2 to be
ocpp2.0.1
Websocket and generic improvements
Breaking Changes
Some breaking changes in the central system's function callbacks were introduced in this release:
- The
ChargePointConnection
reference is passed to callbacks on the server (replaces the standalone charge point ID) - Handler functions in client and server now use type aliases
ConfigurationKey
(used by the GetConfiguration feature) now uses pointers to values, to differentiate between empty and nil values. This fixes omissions of empty strings inGetConfiguration
messages
All implementations will work as before, but the method signatures have slightly changed and will need to be updated. Please refer to the updated example or refer to a748928 for updating your implementation.
Additions and improvements
Websocket
- Added an
Addr
method to the websocket server for retrieving the listening address - Added a
StopConnection
function on the websocket server, to close a single existing connection - Added a graceful shutdown mechanism on the websocket server, which now sends a close message to every open connection
- Charge point IDs now contain only the ID, stripping any prefix from the path
- Subprotocols are now correctly handled and enforced by the server,
- New connections with unsupported subprotocol now get closed only after completing the handshake
Generic
- Added missing OCPP 2.0.1 features (examples and documentation still WIP)
- Improved OCPP error messages
- An
InternalError
is now sent, instead of aProtocolError
, when sending errors as a message response - Improved
ClientDispatcher.SendRequest
signature
Bugfixes
- Fixed several race conditions causing hanging and other issues when closing/restarting connections
- Fixed some field constraints that were too restrictive in:
- RemoteStopTransaction
- StartTransaction
- StopTransaction
- CancelReservation
- ReserveNow
- ClearChargingProfile
- Fixed panics when attempting to parse unknown responses
- New connections with the same ID no longer override previous connections but are closed immediately with a
PolicyViolation
error instead
Automatic reconnection and concurrency improvements
Breaking changes
The following interfaces in the ocppj package changed slightly, affecting existing custom implementations:
- ClientDispatcher
- ServerDispatcher
PendingRequestState
was split intoClientState
andServerState
ocppj.NewClient
andocppj.NewServer
now accept the respective state interface
Websocket clients now include the following new methods:
SetDisconnectedHandler
SetReconnectedHandler
IsConnected
Additions & improvements
- Client websockets automatically reconnect to server after connection loss
- Added network tests for re-connection and timeouts
- Added full support for concurrent requests in ocpp16 and ocpp2
- Automatically clear all callbacks when a charge point/central system is stopped
- Improved test coverage for websockets
- Improved test coverage for ocpp-j layer
- Added logger interface for getting library debug logs
- Added TLS connection state accessor to websocket
Channel
struct - Use slices instead of linked lists in FIFO queues
Bugfixes
- Fixed concurrency issues in websockets
- Fixed concurrency and state management issues in ocpp-j dispatchers
- Fixed concurrency issues in ocpp16 package
- Fixed several nil panics in websockets, ocppj and dispatcher
- Don't set
clientReadyMap
status in request dispatcher if not ready - Notify charge point of failed requests with
onRequestTimeout
callbacks
Websocket improvements and request queuing
Additions & improvements
- Replaced websocket package logs with channel errors
- Improved websocket package structure
- Added support for websocket header and origin
- Added support for custom websocket timeout configuration
- Created dedicated dispatchers for managing ocpp-j state and transmission
- Added support for multiple pending requests
Bugfixes
- Fix panics and logs in 1.6 examples
- Use SANs in x509 certificates, due to breaking changes in Go 1.15
Fixes and improvements for OCPP 1.6
Breaking changes
The following changes are small bugfixes/improvements, but will break previous implementations:
- Modify several optional primitive types to pointers
- Fix field name in v1.6 SetChargingProfile
- Fix field name in v1.6 MeterValues
Additions & improvements
- Added support for basic authentication in client and server
- Added support TLS config on websocket server
- Added update firmware logic in 1.6 example
- Updated more tests and types in v1.6 features
- Added more logging and error handling in cp1.6 example
- Improved documentation for websocket package
Updated OCPP 1.6 examples
Breaking changes
- Renamed profile handlers in 1.6
- Changed file and folder structure of examples
Additions & Improvements
- Added example routine for central system
- Added basic configuration support to example charge point
- Added docker-compose.tls for easy TLS testing
- Added create-test-certificates.sh utility script
- Using alpine base image for examples
- Added godoc, coverage and test report badges
- Update README and example documentation
Bugfixes
- Pending requests are now deleted automatically on disconnect
Ocpp v1.6 beta refactored
OCPP 1.6
Breaking changes
- Renamed Confirmation interface to Response
- Moved profiles (functional blocks) into separate packages
- Moved shared OCPP 1.6 types into a separate types package
- Changed all listener names to handler
- Renamed CentralSystem and ChargePoint OCPP-J structs to Server and Client respectively
Examples were updated according to the changes.
Additions & Improvements:
- Moved some logic from v16.go into separate files
- RFC3339 standard is now used for dateTime formatting
- Added MessageTypeNotSupported error code in OCPP-J
- Checks for unsupported feature when sending a request
- Improved documentation for OCPP-J and OCPP 1.6
OCPP 2.0
Added partial implementation of the OCPP 2.0 specification. No full examples are available yet.
Ocpp v1.6 beta
OCPP 1.6
Library supporting the following profiles on charge point and central system endpoints:
- Core
- Local Auth List
- Firmware Management
- Reservation
- Remote Trigger
- Smart Charging
Tests and examples for all profiles are provided.