@blokcert/node-red-contrib-ocpp 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.1.1] - 2026-02-12
6
+
7
+ ### Fixed
8
+ - Fixed `ocpp-response` node to correctly find and notify `ocpp-command` nodes using `RED.nodes.getNode()` instead of `RED.nodes.eachNode()`
9
+
5
10
  ## [1.1.0] - 2026-02-12
6
11
 
7
12
  ### Added
@@ -81,16 +81,32 @@ module.exports = function (RED) {
81
81
 
82
82
  // Find and notify all ocpp-command nodes
83
83
  let handled = false;
84
+
85
+ // Get all flows and find ocpp-command nodes
86
+ const allNodes = [];
84
87
  RED.nodes.eachNode((n) => {
85
- if (n.type === 'ocpp-command' && n.handleResponse) {
86
- // Try to handle this response
87
- const wasHandled = n.handleResponse(messageId, msg.payload, isError);
88
- if (wasHandled) {
89
- handled = true;
90
- }
88
+ if (n.type === 'ocpp-command') {
89
+ allNodes.push(n.id);
91
90
  }
92
91
  });
93
92
 
93
+ // Try to get the runtime node instance and call handleResponse
94
+ for (const nodeId of allNodes) {
95
+ try {
96
+ const commandNode = RED.nodes.getNode(nodeId);
97
+ if (commandNode && typeof commandNode.handleResponse === 'function') {
98
+ const wasHandled = commandNode.handleResponse(messageId, msg.payload, isError);
99
+ if (wasHandled) {
100
+ handled = true;
101
+ node.log(`Response ${messageId} handled by ocpp-command node ${nodeId}`);
102
+ break; // Only one node should handle each response
103
+ }
104
+ }
105
+ } catch (e) {
106
+ node.warn(`Error calling handleResponse on node ${nodeId}: ${e.message}`);
107
+ }
108
+ }
109
+
94
110
  // Update status
95
111
  if (handled) {
96
112
  node.status({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blokcert/node-red-contrib-ocpp",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Node-RED nodes for OCPP (Open Charge Point Protocol) message handling via Redis Streams",
5
5
  "keywords": [
6
6
  "node-red",