node-red-contrib-octopus-intelligent 1.0.0 → 1.0.2

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 ADDED
@@ -0,0 +1,118 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.2] - 2025-11-30
9
+
10
+ ### Changed
11
+ - Updated flow example description in Node-RED help panel for better clarity
12
+ - Improved explanation of default behavior: reads by default, manually refreshable, and accepts commands
13
+
14
+ ## [1.0.1] - 2025-11-30
15
+
16
+ ### Added
17
+ - **Node.js and Node-RED version requirements** in package.json engines field
18
+ - Minimum Node.js: >=14.0.0
19
+ - Minimum Node-RED: >=2.0.0
20
+ - Addresses Flow Library scorecard requirements
21
+ - **Comprehensive example flows** in Node-RED help panel
22
+ - Basic monitoring flow (inject every 5 min)
23
+ - Set preferences from flow (JSON payload with set_limit/set_time)
24
+ - Home Assistant MQTT integration example
25
+ - **Visual documentation** with screenshots
26
+ - Node-RED flow examples showing monitoring, preferences, and preset buttons
27
+ - MQTT integration flow example
28
+ - Home Assistant device page with all entities
29
+ - **Visual Examples section** in Node-RED help panel with embedded GitHub-hosted images
30
+ - **Screenshots section** in README.md showing real-world usage
31
+
32
+ ### Changed
33
+ - Updated README.md with Screenshots section after Features
34
+ - Updated .npmignore to exclude images/ folder (keeps npm package lightweight)
35
+ - Updated .gitignore to exclude local documentation files
36
+
37
+ ### Fixed
38
+ - Flow Library scorecard now shows supported Node-RED and Node.js versions
39
+ - Flow Library scorecard "Nodes have examples" requirement now satisfied
40
+
41
+ ## [1.0.0] - 2025-11-30
42
+
43
+ ### Added
44
+ - Initial public release
45
+ - **Octopus Energy GraphQL API integration**
46
+ - Authentication via API key
47
+ - Fetch planned charging dispatches (smart-charge and bump-charge slots)
48
+ - Query vehicle charging preferences (target SOC and ready time)
49
+ - Update charging preferences via GraphQL mutations
50
+ - **Home Assistant MQTT auto-discovery**
51
+ - Number entity: Target charge limit (50-100%)
52
+ - Select entity: Ready time (04:00-11:00)
53
+ - Button entity: Apply changes
54
+ - Sensor entities: Confirmed settings, next charge time, total energy, slot times
55
+ - Binary sensor: Charging now (ON/OFF)
56
+ - Organized into Controls, Sensors, and Diagnostics categories
57
+ - **Real-time charging slot detection**
58
+ - Detects currently active charging slots
59
+ - Calculates next charging start time
60
+ - Provides individual slot start/end times (up to 3 slots)
61
+ - Calculates overall charging window
62
+ - Shows charge source (smart-charge vs bump-charge)
63
+ - **Exponential backoff validation**
64
+ - Smart retry mechanism when updating preferences
65
+ - Prevents sensors from becoming "unavailable" during API updates
66
+ - Validates changes at 15s, 30s, 60s, 120s intervals
67
+ - **Comprehensive debugging**
68
+ - Full API call tracking in msg.debug
69
+ - Success/failure status for each operation
70
+ - Detailed error messages
71
+ - **Node-RED flow control**
72
+ - Accept input messages to set preferences programmatically
73
+ - Output payload with all charging data
74
+ - 5-minute default refresh interval (configurable)
75
+ - **Octopus Energy branding**
76
+ - Professional pink theme (#E8146F)
77
+ - Device branded as "Octopus Intelligent" in Home Assistant
78
+ - Suggested "Energy" area in Home Assistant
79
+ - **Unit test coverage**
80
+ - Data processing tests (10 tests)
81
+ - Timer management tests (10 tests)
82
+ - Mock API responses for consistent testing
83
+
84
+ ### Security
85
+ - API key stored securely as Node-RED credential (not exposed in flows)
86
+ - Account numbers sanitized in MQTT topics and entity IDs
87
+
88
+ ### Documentation
89
+ - Comprehensive README.md with:
90
+ - Feature list and capabilities
91
+ - Installation instructions (npm and palette manager)
92
+ - Configuration guide
93
+ - Home Assistant setup instructions
94
+ - Node-RED usage examples
95
+ - Home Assistant automation examples
96
+ - Troubleshooting section
97
+ - Support options (GitHub Star, Sponsor, PayPal donate)
98
+ - MIT License
99
+ - GitHub repository with issue tracking
100
+
101
+ ## Release Notes
102
+
103
+ ### Version Numbering
104
+ This project follows [Semantic Versioning](https://semver.org/):
105
+ - **MAJOR** version (X.0.0): Breaking changes
106
+ - **MINOR** version (1.X.0): New features (backwards compatible)
107
+ - **PATCH** version (1.0.X): Bug fixes (backwards compatible)
108
+
109
+ ### Links
110
+ - [npm Package](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
111
+ - [GitHub Repository](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
112
+ - [Node-RED Flow Library](https://flows.nodered.org/node/node-red-contrib-octopus-intelligent)
113
+ - [Issues & Bug Reports](https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues)
114
+
115
+ ### Support
116
+ - ⭐ [Star on GitHub](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
117
+ - 💖 [Become a Sponsor](https://github.com/sponsors/ASomerN)
118
+ - ☕ [Donate via PayPal](https://www.paypal.com/donate?hosted_button_id=A2B8ZFEJBE2S6)
package/README.md CHANGED
@@ -76,6 +76,67 @@ If this project has helped you!
76
76
 
77
77
  ---
78
78
 
79
+ ## 📸 Screenshots
80
+
81
+ ### Node-RED Flow Examples
82
+
83
+ #### Basic Monitoring & Control
84
+ ![Node-RED Flow Examples](images/examples/basic-monitoring-flow.png)
85
+
86
+ This example flow demonstrates three key usage patterns:
87
+
88
+ 1. **Basic Monitoring**
89
+ - The Octopus Intelligent Node automaticaly refreshes every 5 minutes
90
+ - Octopus Intelligent node fetches latest charging data
91
+ - Debug node displays all charging slots and settings
92
+
93
+ 2. **Setting Preferences**
94
+ - Inject node with JSON payload: `{"set_limit": 85, "set_time": "07:30"}` ommit a key:value if you don't want to change it
95
+ - Sends charge limit +/ ready time to the node
96
+ - Debug shows confirmed values from API
97
+
98
+ **How to use:** Import any of these flows, configure your Account Number and API Key in the Octopus Intelligent node, and deploy!
99
+
100
+ #### MQTT Integration with Home Assistant
101
+ ![MQTT Integration Flow](images/examples/mqtt-integration-flow.png)
102
+
103
+ This flow shows the complete MQTT setup:
104
+
105
+ - **MQTT Broker Configuration**: Connected to Home Assistant (localhost:1883)
106
+ - **Enable MQTT toggle**: Activated in node settings
107
+ - **Auto-Discovery**: Node automatically creates all entities in Home Assistant on first run
108
+ - **Real-time Updates**: Every 5 minutes, charging data is published to MQTT and updates HA sensors
109
+
110
+ **What you get in Home Assistant:** All controls and sensors appear automatically - no manual YAML configuration needed!
111
+
112
+ ### Home Assistant Auto-Configured Entities
113
+
114
+ ![Home Assistant Device](images/examples/homeassistant-device.png)
115
+
116
+ After enabling MQTT in the Node-RED node, Home Assistant automatically creates:
117
+
118
+ #### Controls (Top Section)
119
+ - **Target Charge** - Number slider (50-100%) to set desired battery level
120
+ - **Ready Time** - Dropdown selector (04:00-11:00) for when car needs to be ready
121
+ - **Apply Changes** - Button to submit new settings (prevents API spam while adjusting)
122
+
123
+ #### Sensors (Main Section)
124
+ - **Confirmed Charge Limit** - Current API-validated charge limit
125
+ - **Confirmed Ready Time** - Current API-validated ready time
126
+ - **Next Charge Time** - When your next charging slot starts (formatted for your timezone)
127
+ - **Total Planned Energy** - Total kWh across all upcoming slots
128
+ - **Slot 1, 2, 3 Start/End** - Individual charging slot times
129
+ - **Overall Window Start/End** - First slot start to last slot end
130
+ - **Charging Now** - Binary sensor (ON/OFF) showing if actively charging
131
+
132
+ #### Diagnostics (Includes the same information but in a raw output)
133
+ - Raw timestamp sensors with exact API responses
134
+ - Useful for debugging and advanced automations
135
+
136
+ **All entities are automatically organized under a single "Octopus Intelligent" device!**
137
+
138
+ ---
139
+
79
140
  ## 📋 Requirements
80
141
 
81
142
  - **Node-RED** v2.0+
@@ -353,17 +414,18 @@ Use at your own risk. The Octopus Energy name and logo are trademarks of Octopus
353
414
 
354
415
  ## 📜 Changelog
355
416
 
356
- ### v1.0.0 (2025-11-29)
357
-
358
- - ✅ Octopus Energy GraphQL API integration
359
- - ✅ Home Assistant MQTT auto-discovery
360
- - ✅ Submit button for preference changes
361
- - ✅ Raw timestamp sensors in diagnostics
362
- - ✅ Active charging slot detection
363
- - ✅ Exponential backoff validation
364
- - ✅ Comprehensive debug output
365
- - ✅ Entity category organization
366
- - ✅ Octopus Energy branding
417
+ See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
418
+
419
+ ### Latest Release: v1.0.1 (2025-11-30)
420
+ - Added Node.js and Node-RED version requirements
421
+ - Added comprehensive example flows and visual documentation
422
+ - Flow Library scorecard improvements
423
+
424
+ ### Previous Release: v1.0.0 (2025-11-30)
425
+ - Initial public release with full Octopus Energy API integration
426
+ - Home Assistant MQTT auto-discovery
427
+ - Real-time charging slot detection
428
+ - Exponential backoff validation
367
429
 
368
430
  ---
369
431
 
@@ -55,9 +55,73 @@
55
55
  </script>
56
56
 
57
57
  <script type="text/html" data-help-name="octopus-intelligent">
58
- <p>Fetches Intelligent Octopus slots and settings.</p>
59
- <h3>Outputs</h3>
60
- <p>Outputs a payload containing <code>next_charge</code>, <code>settings</code>, and raw data.</p>
61
- <h3>Home Assistant</h3>
62
- <p>If an MQTT broker is configured, this node will automatically create sensors in Home Assistant.</p>
58
+ <p>This node integrates with the <strong>Octopus Energy Intelligent Octopus Go</strong> API to retrieve planned charging slots and preferences.</p>
59
+ <p>Configure your Account Number and API Key, then deploy the flow. The node will fetch data at regular intervals and output charging information.</p>
60
+ <p>Enable MQTT to automatically configure Home Assistant entities via auto-discovery.</p>
61
+
62
+ <h3>Examples</h3>
63
+
64
+ <h4>1. Basic Monitoring</h4>
65
+ <p>Monitor your charging slots every 5 minutes:</p>
66
+ <pre>[{"id":"1","type":"inject","name":"Every 5 min","props":[{"p":"payload"}],"repeat":"300","crontab":"","once":true,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":false,"x":340,"y":80,"wires":[["3"]]},{"id":"3","type":"debug","name":"Debug Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":80,"wires":[]}]</pre>
67
+
68
+ <h4>2. Set Preferences from Flow</h4>
69
+ <p>Control charge limit and ready time programmatically:</p>
70
+ <pre>[{"id":"1","type":"inject","name":"Set 85% by 07:30","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"{\"set_limit\":85,\"set_time\":\"07:30\"}","payloadType":"json","x":150,"y":140,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":true,"mqttBroker":"mqtt-broker","x":380,"y":140,"wires":[["3"]]},{"id":"3","type":"debug","name":"Confirmation","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":140,"wires":[]}]</pre>
71
+
72
+ <h4>3. Home Assistant MQTT Integration</h4>
73
+ <p>Automatically create Home Assistant entities via MQTT discovery:</p>
74
+ <pre>[{"id":"1","type":"inject","name":"Every 5 min","props":[{"p":"payload"}],"repeat":"300","crontab":"","once":true,"topic":"","payload":"","payloadType":"date","x":130,"y":200,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":true,"mqttBroker":"mqtt-broker","x":340,"y":200,"wires":[["3"]]},{"id":"3","type":"debug","name":"Debug Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":200,"wires":[]},{"id":"mqtt-broker","type":"mqtt-broker","name":"Home Assistant MQTT","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]</pre>
75
+
76
+ <h3>Visual Examples</h3>
77
+ <p><strong>Node-RED Flow Examples:</strong></p>
78
+ <img src="https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/basic-monitoring-flow.png" alt="Node-RED Flow Examples" style="max-width: 100%; border: 1px solid #ddd; border-radius: 4px;">
79
+ <p style="margin-top: 8px;"><em>Reads by default, manually refreshable from a button, pass in commands to change charge time and percentage</em></p>
80
+
81
+ <p style="margin-top: 16px;"><strong>MQTT Integration:</strong></p>
82
+ <img src="https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/mqtt-integration-flow.png" alt="MQTT Integration Flow" style="max-width: 100%; border: 1px solid #ddd; border-radius: 4px;">
83
+ <p style="margin-top: 8px;"><em>Complete MQTT integration with Home Assistant</em></p>
84
+
85
+ <p style="margin-top: 16px;"><strong>Home Assistant Device:</strong></p>
86
+ <img src="https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/homeassistant-device.png" alt="Home Assistant Device" style="max-width: 100%; border: 1px solid #ddd; border-radius: 4px;">
87
+ <p style="margin-top: 8px;"><em>Octopus Intelligent device with all controls and sensors automatically configured</em></p>
88
+
89
+ <h3>Output Format</h3>
90
+ <p>The node outputs a message with the following structure:</p>
91
+ <pre>{
92
+ "payload": {
93
+ "next_start": "2025-11-29T01:30:00Z",
94
+ "total_energy": 42.5,
95
+ "next_kwh": "15.20",
96
+ "next_source": "smart-charge",
97
+ "confirmed_limit": 80,
98
+ "confirmed_time": "07:00",
99
+ "charging_now": false,
100
+ "slot1_start": "2025-11-29T01:30:00Z",
101
+ "slot1_end": "2025-11-29T05:30:00Z"
102
+ },
103
+ "debug": {
104
+ "success": true,
105
+ "step": "complete",
106
+ "apiCalls": [...]
107
+ }
108
+ }</pre>
109
+
110
+ <h3>Home Assistant Integration</h3>
111
+ <p>When MQTT is enabled, the node automatically creates:</p>
112
+ <ul>
113
+ <li><strong>Controls:</strong> Target charge slider, ready time selector, apply changes button</li>
114
+ <li><strong>Sensors:</strong> Next charge time, total energy, charging status, individual slots</li>
115
+ <li><strong>Binary Sensor:</strong> Charging now indicator (ON/OFF)</li>
116
+ </ul>
117
+ <p>All entities appear under a single "Octopus Intelligent" device in Home Assistant.</p>
118
+
119
+ <h3>Requirements</h3>
120
+ <ul>
121
+ <li>Octopus Energy account with Intelligent Octopus Go tariff</li>
122
+ <li>API key from <a href="https://octopus.energy/dashboard/new/accounts/personal-details/api-access" target="_blank">Octopus dashboard</a></li>
123
+ <li>MQTT broker (optional, for Home Assistant integration)</li>
124
+ </ul>
125
+
126
+ <p>See the <a href="https://github.com/ASomerN/node-red-contrib-octopus-intelligent/blob/master/README.md" target="_blank">full documentation</a> for details.</p>
63
127
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-octopus-intelligent",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Node-RED integration for Octopus Energy Intelligent Octopus Go with Home Assistant MQTT discovery",
5
5
  "main": "octopus-intelligent.js",
6
6
  "scripts": {
@@ -24,6 +24,10 @@
24
24
  "octopus-intelligent": "octopus-intelligent.js"
25
25
  }
26
26
  },
27
+ "engines": {
28
+ "node": ">=14.0.0",
29
+ "node-red": ">=2.0.0"
30
+ },
27
31
  "dependencies": {
28
32
  "axios": "^1.6.0"
29
33
  },