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

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,145 @@
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.3] - 2025-12-04
9
+
10
+ ### Added
11
+ - **State reconciliation loop** for charging detection (every 10 seconds)
12
+ - Automatically detects charging state based on cached slot timestamps
13
+ - No API calls - uses local data only
14
+ - Handles imminent/immediate slots when car is plugged in
15
+ - Self-healing: corrects state if timers miss edge cases
16
+ - **Flow Library scorecard compliance**
17
+ - Added `version` field to `node-red` section in package.json (>=2.0.0)
18
+ - Added `examples/` folder with 3 demonstration flows
19
+ - Satisfies Node-RED Flow Library requirements
20
+
21
+ ### Fixed
22
+ - **Home Assistant sensors going "unknown"** when adjusting controls
23
+ - Sensors now maintain last known values while editing pending preferences
24
+ - Only update when fresh data arrives from API
25
+ - Added `lastKnownState` cache and state merging in `publishCurrentState()`
26
+ - **Charging state not updating** for imminent/immediate slots
27
+ - Fixed edge case where slots starting <30s after poll were not detected
28
+ - Reconciliation loop catches these within 10 seconds
29
+ - Ensures accurate "Charging Now" sensor in Home Assistant
30
+
31
+ ### Changed
32
+ - Improved charging state management with redundant detection methods
33
+ - Enhanced MQTT state publishing to preserve sensor data during control updates
34
+
35
+ ## [1.0.2] - 2025-11-30
36
+
37
+ ### Changed
38
+ - Updated flow example description in Node-RED help panel for better clarity
39
+ - Improved explanation of default behavior: reads by default, manually refreshable, and accepts commands
40
+
41
+ ## [1.0.1] - 2025-11-30
42
+
43
+ ### Added
44
+ - **Node.js and Node-RED version requirements** in package.json engines field
45
+ - Minimum Node.js: >=14.0.0
46
+ - Minimum Node-RED: >=2.0.0
47
+ - Addresses Flow Library scorecard requirements
48
+ - **Comprehensive example flows** in Node-RED help panel
49
+ - Basic monitoring flow (inject every 5 min)
50
+ - Set preferences from flow (JSON payload with set_limit/set_time)
51
+ - Home Assistant MQTT integration example
52
+ - **Visual documentation** with screenshots
53
+ - Node-RED flow examples showing monitoring, preferences, and preset buttons
54
+ - MQTT integration flow example
55
+ - Home Assistant device page with all entities
56
+ - **Visual Examples section** in Node-RED help panel with embedded GitHub-hosted images
57
+ - **Screenshots section** in README.md showing real-world usage
58
+
59
+ ### Changed
60
+ - Updated README.md with Screenshots section after Features
61
+ - Updated .npmignore to exclude images/ folder (keeps npm package lightweight)
62
+ - Updated .gitignore to exclude local documentation files
63
+
64
+ ### Fixed
65
+ - Flow Library scorecard now shows supported Node-RED and Node.js versions
66
+ - Flow Library scorecard "Nodes have examples" requirement now satisfied
67
+
68
+ ## [1.0.0] - 2025-11-30
69
+
70
+ ### Added
71
+ - Initial public release
72
+ - **Octopus Energy GraphQL API integration**
73
+ - Authentication via API key
74
+ - Fetch planned charging dispatches (smart-charge and bump-charge slots)
75
+ - Query vehicle charging preferences (target SOC and ready time)
76
+ - Update charging preferences via GraphQL mutations
77
+ - **Home Assistant MQTT auto-discovery**
78
+ - Number entity: Target charge limit (50-100%)
79
+ - Select entity: Ready time (04:00-11:00)
80
+ - Button entity: Apply changes
81
+ - Sensor entities: Confirmed settings, next charge time, total energy, slot times
82
+ - Binary sensor: Charging now (ON/OFF)
83
+ - Organized into Controls, Sensors, and Diagnostics categories
84
+ - **Real-time charging slot detection**
85
+ - Detects currently active charging slots
86
+ - Calculates next charging start time
87
+ - Provides individual slot start/end times (up to 3 slots)
88
+ - Calculates overall charging window
89
+ - Shows charge source (smart-charge vs bump-charge)
90
+ - **Exponential backoff validation**
91
+ - Smart retry mechanism when updating preferences
92
+ - Prevents sensors from becoming "unavailable" during API updates
93
+ - Validates changes at 15s, 30s, 60s, 120s intervals
94
+ - **Comprehensive debugging**
95
+ - Full API call tracking in msg.debug
96
+ - Success/failure status for each operation
97
+ - Detailed error messages
98
+ - **Node-RED flow control**
99
+ - Accept input messages to set preferences programmatically
100
+ - Output payload with all charging data
101
+ - 5-minute default refresh interval (configurable)
102
+ - **Octopus Energy branding**
103
+ - Professional pink theme (#E8146F)
104
+ - Device branded as "Octopus Intelligent" in Home Assistant
105
+ - Suggested "Energy" area in Home Assistant
106
+ - **Unit test coverage**
107
+ - Data processing tests (10 tests)
108
+ - Timer management tests (10 tests)
109
+ - Mock API responses for consistent testing
110
+
111
+ ### Security
112
+ - API key stored securely as Node-RED credential (not exposed in flows)
113
+ - Account numbers sanitized in MQTT topics and entity IDs
114
+
115
+ ### Documentation
116
+ - Comprehensive README.md with:
117
+ - Feature list and capabilities
118
+ - Installation instructions (npm and palette manager)
119
+ - Configuration guide
120
+ - Home Assistant setup instructions
121
+ - Node-RED usage examples
122
+ - Home Assistant automation examples
123
+ - Troubleshooting section
124
+ - Support options (GitHub Star, Sponsor, PayPal donate)
125
+ - MIT License
126
+ - GitHub repository with issue tracking
127
+
128
+ ## Release Notes
129
+
130
+ ### Version Numbering
131
+ This project follows [Semantic Versioning](https://semver.org/):
132
+ - **MAJOR** version (X.0.0): Breaking changes
133
+ - **MINOR** version (1.X.0): New features (backwards compatible)
134
+ - **PATCH** version (1.0.X): Bug fixes (backwards compatible)
135
+
136
+ ### Links
137
+ - [npm Package](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
138
+ - [GitHub Repository](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
139
+ - [Node-RED Flow Library](https://flows.nodered.org/node/node-red-contrib-octopus-intelligent)
140
+ - [Issues & Bug Reports](https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues)
141
+
142
+ ### Support
143
+ - ⭐ [Star on GitHub](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
144
+ - 💖 [Become a Sponsor](https://github.com/sponsors/ASomerN)
145
+ - ☕ [Donate via PayPal](https://www.paypal.com/donate?hosted_button_id=A2B8ZFEJBE2S6)
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Node-RED Global Context Setter for Octopus Intelligent Node
3
+ *
4
+ * This is a helper function that stores all data from the Octopus Intelligent node
5
+ * into Node-RED's global context for easy access across your flows.
6
+ *
7
+ * USAGE:
8
+ * 1. Add a Function node after your Octopus Intelligent node
9
+ * 2. Copy this code into the Function node
10
+ * 3. All data will be stored in global context with 'octopus_' prefix
11
+ *
12
+ * ACCESSING THE DATA:
13
+ * In any Function node:
14
+ * const chargingNow = global.get("octopus_charging_now");
15
+ * const nextStart = global.get("octopus_next_start");
16
+ * const allData = global.get("octopus_data"); // entire payload as object
17
+ *
18
+ * In Change nodes or templates:
19
+ * {{global.octopus_charging_now}}
20
+ * {{global.octopus_next_start}}
21
+ */
22
+
23
+ // Store all payload data to global context
24
+ function storeOctopusDataToGlobal(payload) {
25
+ // Store main charging data
26
+ global.set("octopus_next_start", payload.next_start);
27
+ global.set("octopus_total_energy", payload.total_energy);
28
+ global.set("octopus_next_kwh", payload.next_kwh);
29
+ global.set("octopus_next_source", payload.next_source);
30
+
31
+ // Store preferences (confirmed from API)
32
+ global.set("octopus_confirmed_limit", payload.confirmed_limit);
33
+ global.set("octopus_confirmed_time", payload.confirmed_time);
34
+
35
+ // Store pending preferences (user selections not yet submitted)
36
+ global.set("octopus_pending_limit", payload.pending_limit);
37
+ global.set("octopus_pending_time", payload.pending_time);
38
+
39
+ // Store charging status (boolean: true/false)
40
+ global.set("octopus_charging_now", payload.charging_now);
41
+
42
+ // Store individual charging slots (formatted timestamps)
43
+ global.set("octopus_slot1_start", payload.slot1_start);
44
+ global.set("octopus_slot1_end", payload.slot1_end);
45
+ global.set("octopus_slot2_start", payload.slot2_start);
46
+ global.set("octopus_slot2_end", payload.slot2_end);
47
+ global.set("octopus_slot3_start", payload.slot3_start);
48
+ global.set("octopus_slot3_end", payload.slot3_end);
49
+
50
+ // Store overall charging window (first start to last end)
51
+ global.set("octopus_window_start", payload.window_start);
52
+ global.set("octopus_window_end", payload.window_end);
53
+
54
+ // Store raw timestamp strings (exact API output)
55
+ global.set("octopus_next_start_raw", payload.next_start_raw);
56
+ global.set("octopus_slot1_start_raw", payload.slot1_start_raw);
57
+ global.set("octopus_slot1_end_raw", payload.slot1_end_raw);
58
+ global.set("octopus_slot2_start_raw", payload.slot2_start_raw);
59
+ global.set("octopus_slot2_end_raw", payload.slot2_end_raw);
60
+ global.set("octopus_slot3_start_raw", payload.slot3_start_raw);
61
+ global.set("octopus_slot3_end_raw", payload.slot3_end_raw);
62
+ global.set("octopus_window_start_raw", payload.window_start_raw);
63
+ global.set("octopus_window_end_raw", payload.window_end_raw);
64
+
65
+ // Store entire payload as single object for convenience
66
+ global.set("octopus_data", payload);
67
+
68
+ // Store last update timestamp
69
+ global.set("octopus_last_update", new Date().toISOString());
70
+ }
71
+
72
+ // Call the function with the incoming payload
73
+ storeOctopusDataToGlobal(msg.payload);
74
+
75
+ // Pass the message through unchanged
76
+ return msg;
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
 
package/RELEASE.md ADDED
@@ -0,0 +1,140 @@
1
+ # Release Checklist
2
+
3
+ Use this checklist when releasing a new version to ensure nothing is missed.
4
+
5
+ ---
6
+
7
+ ## Phase 1: Development & Testing
8
+
9
+ - [ ] Create feature branch: `dev/feature-name`
10
+ - [ ] Make code changes and commit
11
+ - [ ] Update version in `package.json` (e.g., 1.0.2 → 1.0.3)
12
+ - [ ] Run unit tests: `npm test` - **ALL MUST PASS** ✅
13
+ - [ ] Build package: `npm pack`
14
+ - [ ] Test .tgz on Raspberry Pi Node-RED installation
15
+ - [ ] Verify functionality in Home Assistant
16
+ - [ ] Run `git status` - ensure no untracked files to commit
17
+
18
+ ---
19
+
20
+ ## Phase 2: Documentation
21
+
22
+ - [ ] Update `CHANGELOG.md` with new version section:
23
+ ```markdown
24
+ ## [1.0.3] - YYYY-MM-DD
25
+
26
+ ### Added
27
+ - New features listed here
28
+
29
+ ### Changed
30
+ - Changes listed here
31
+
32
+ ### Fixed
33
+ - Bug fixes listed here
34
+ ```
35
+ - [ ] Review `README.md` for any needed updates
36
+ - [ ] Commit documentation updates
37
+
38
+ ---
39
+
40
+ ## Phase 3: Merge to Master
41
+
42
+ - [ ] Ensure all changes committed on dev branch
43
+ - [ ] Run final tests: `npm test`
44
+ - [ ] Switch to master: `git checkout master`
45
+ - [ ] Merge dev branch: `git merge dev/feature-name`
46
+ - [ ] Verify merged correctly: `git log --oneline -5`
47
+
48
+ ---
49
+
50
+ ## Phase 4: Git Release
51
+
52
+ - [ ] Create annotated tag: `git tag -a v1.0.3 -m "Release v1.0.3 - Description"`
53
+ - [ ] Push master branch: `git push origin master`
54
+ - [ ] Push tag: `git push origin v1.0.3`
55
+ - [ ] Verify on GitHub: https://github.com/ASomerN/node-red-contrib-octopus-intelligent/releases
56
+
57
+ ---
58
+
59
+ ## Phase 5: npm Publication
60
+
61
+ - [ ] Verify you're on master branch: `git branch`
62
+ - [ ] Verify version is correct: `npm view node-red-contrib-octopus-intelligent version`
63
+ - [ ] Publish to npm: `npm publish`
64
+ - [ ] Verify publication: `npm view node-red-contrib-octopus-intelligent version`
65
+ - [ ] Check package page: https://www.npmjs.com/package/node-red-contrib-octopus-intelligent
66
+
67
+ ---
68
+
69
+ ## Phase 6: Flow Library Update
70
+
71
+ - [ ] Go to: https://flows.nodered.org/node/node-red-contrib-octopus-intelligent
72
+ - [ ] Log in to flows.nodered.org
73
+ - [ ] Click "request refresh" link in sidebar (or resubmit via + button)
74
+ - [ ] Wait for sync (can take hours)
75
+ - [ ] Verify version updated on Flow Library page
76
+ - [ ] Check scorecard: https://flows.nodered.org/node/node-red-contrib-octopus-intelligent/scorecard
77
+ - [ ] All items should be ✅ green
78
+
79
+ ---
80
+
81
+ ## Phase 7: GitHub Release (Optional but Recommended)
82
+
83
+ - [ ] Go to: https://github.com/ASomerN/node-red-contrib-octopus-intelligent/releases/new
84
+ - [ ] Select tag: `v1.0.3`
85
+ - [ ] Release title: `v1.0.3 - Short Description`
86
+ - [ ] Copy CHANGELOG.md entry for this version into description
87
+ - [ ] Attach the `.tgz` file (optional)
88
+ - [ ] Publish release
89
+
90
+ ---
91
+
92
+ ## Phase 8: Cleanup
93
+
94
+ - [ ] Delete local dev branch: `git branch -d dev/feature-name`
95
+ - [ ] Delete remote dev branch: `git push origin --delete dev/feature-name`
96
+ - [ ] Delete local `.tgz` file: `rm *.tgz`
97
+ - [ ] Celebrate! 🎉
98
+
99
+ ---
100
+
101
+ ## Quick Reference Commands
102
+
103
+ ```bash
104
+ # Testing
105
+ npm test
106
+
107
+ # Build
108
+ npm pack
109
+
110
+ # Version check
111
+ npm view node-red-contrib-octopus-intelligent version
112
+
113
+ # Git workflow
114
+ git checkout master
115
+ git merge dev/feature-name
116
+ git tag -a v1.0.3 -m "Release v1.0.3"
117
+ git push origin master
118
+ git push origin v1.0.3
119
+
120
+ # Publish
121
+ npm publish
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Common Issues
127
+
128
+ ### Flow Library not updating
129
+ - Wait 24 hours for automatic sync
130
+ - Try "request refresh" link when logged in
131
+ - If still not updating, resubmit via + button
132
+
133
+ ### npm publish fails with "version already exists"
134
+ - Check version in package.json was bumped
135
+ - Verify with: `npm view node-red-contrib-octopus-intelligent version`
136
+
137
+ ### Tests failing
138
+ - DO NOT proceed with release
139
+ - Fix tests first
140
+ - Re-test on Pi before publishing
@@ -0,0 +1 @@
1
+ [{"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","accountNumber":"A-XXXXXXXX","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":[]}]
@@ -0,0 +1 @@
1
+ [{"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","accountNumber":"A-XXXXXXXX","refreshInterval":"5","enableMqtt":true,"broker":"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":""}]
@@ -0,0 +1 @@
1
+ [{"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","accountNumber":"A-XXXXXXXX","refreshInterval":"5","enableMqtt":true,"broker":"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":[]}]
@@ -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>