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

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/README.md CHANGED
@@ -1,432 +1,477 @@
1
- # node-red-contrib-octopus-intelligent
2
-
3
- > Node-RED integration for **Octopus Energy Intelligent Octopus Go** with automatic Home Assistant MQTT discovery
4
-
5
- Monitor your EV charging slots, control charge limits, and manage ready times directly from Home Assistant - all automatically configured via MQTT discovery.
6
-
7
- [![npm version](https://badge.fury.io/js/node-red-contrib-octopus-intelligent.svg)](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
-
10
- ---
11
-
12
- ## 🤝 Support This Project
13
-
14
- Found this useful? Support continued development:
15
-
16
- <table>
17
- <tr>
18
- <td width="33%" align="center">
19
-
20
- ### ⭐ GitHub Star
21
- Star the repository to show your support!
22
-
23
- [⭐ Star on GitHub](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
24
-
25
- </td>
26
- <td width="33%" align="center">
27
-
28
- ### 💖 Sponsor
29
- Support ongoing development and maintenance
30
-
31
- [Become a Sponsor](https://github.com/sponsors/ASomerN)
32
-
33
- </td>
34
- <td width="33%" align="center">
35
-
36
- ### ☕ Buy Me a Coffee
37
- If this project has helped you!
38
-
39
- [![Donate with PayPal](https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate?hosted_button_id=A2B8ZFEJBE2S6)
40
-
41
- </td>
42
- </tr>
43
- </table>
44
-
45
- **Your support helps with:** Bug fixes and maintenance • New feature development • Documentation improvements • Community support • Feeding my children
46
-
47
- ---
48
-
49
- ## ✨ Features
50
-
51
- ### 🎮 Smart Controls
52
- - **Target Charge Slider** (50-100%) - Set your desired battery level
53
- - **Ready Time Dropdown** (04:00-11:00) - When your car needs to be ready
54
- - **Apply Changes Button** - Prevents API spam while adjusting settings
55
- - **Confirmed Values** - See your current API-validated settings
56
-
57
- ### ⚡ Real-Time Charging Data
58
- - **Next Charge Time** - When your next slot starts
59
- - **Total Planned Energy** - Total kWh across all upcoming slots
60
- - **Individual Slot Times** - Up to 3 slots with start/end times
61
- - **Charging Window** - Overall window from first to last slot
62
- - **Charge Source** - Smart-charge vs bump-charge indicator
63
-
64
- ### 🔧 Advanced Features
65
- - **Raw Timestamps** - Exact API responses in Diagnostics section
66
- - **Exponential Backoff** - Smart retry prevents sensor unavailability
67
- - **Comprehensive Debugging** - Full API call tracking in msg.debug
68
- - **Active Slot Detection** - Shows currently running sessions
69
- - **Entity Categories** - Organized Controls, Sensors, and Diagnostics
70
-
71
- ### 🏠 Home Assistant Integration
72
- - **Zero Configuration** - MQTT auto-discovery sets everything up
73
- - **Professional UI** - Octopus Energy branded device cards
74
- - **Organized Entities** - Controls, main sensors, and diagnostics neatly grouped
75
- - **Suggested Area** - Auto-suggests "Energy" area
76
-
77
- ---
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
-
140
- ## 📋 Requirements
141
-
142
- - **Node-RED** v2.0+
143
- - **Octopus Energy Account** with [Intelligent Octopus Go](https://octopus.energy/intelligent/) tariff
144
- - **API Key** - [Generate here](https://octopus.energy/dashboard/new/accounts/personal-details/api-access)
145
- - **MQTT Broker** (optional, for Home Assistant integration)
146
- - **Home Assistant** (optional, for MQTT features)
147
-
148
- ---
149
-
150
- ## 🚀 Quick Start
151
-
152
- ### 1. Install via Node-RED Palette
153
-
154
- 1. Open Node-RED → **Menu** → **Manage Palette**
155
- 2. **Install** tab → Search `node-red-contrib-octopus-intelligent`
156
- 3. Click **Install**
157
-
158
- ### 2. Get Your Credentials
159
-
160
- **Account Number** (format: `A-XXXXXXXX`):
161
- - Found at https://octopus.energy/dashboard/
162
-
163
- **API Key** (format: `sk_live_...`):
164
- - Get from https://octopus.energy/dashboard/new/accounts/personal-details/api-access
165
- - Click "Generate API Key"
166
-
167
- ### 3. Configure the Node
168
-
169
- 1. Drag **Octopus Intelligent** into your flow
170
- 2. Double-click to configure:
171
- - Account Number
172
- - API Key (stored securely)
173
- - Refresh Interval (default: 5 min)
174
- - Enable MQTT if using Home Assistant
175
- 3. **Deploy**
176
-
177
- ### 4. Home Assistant (Optional)
178
-
179
- If MQTT enabled:
180
- 1. Wait ~5 seconds after deploy
181
- 2. **Settings** → **Devices & Services** → **MQTT**
182
- 3. Find "Octopus Intelligent" device
183
- 4. All entities created automatically!
184
-
185
- ---
186
-
187
- ## 📊 Home Assistant Entities
188
-
189
- ### Controls
190
- ```
191
- number.octopus_target_charge Battery charge limit (50-100%)
192
- select.octopus_ready_time Ready by time (04:00-11:00)
193
- button.octopus_apply_changes Submit changes to API
194
- ```
195
-
196
- ### Main Sensors
197
- ```
198
- sensor.octopus_confirmed_charge_limit API-confirmed charge limit
199
- sensor.octopus_confirmed_ready_time API-confirmed ready time
200
- sensor.octopus_next_charge_time Next charging slot start
201
- sensor.octopus_total_planned_energy Total kWh planned
202
- sensor.octopus_next_slot_energy Energy in next slot
203
- sensor.octopus_charge_source smart-charge/bump-charge
204
- sensor.octopus_slot_[1-3]_start Individual slot starts
205
- sensor.octopus_slot_[1-3]_end Individual slot ends
206
- sensor.octopus_overall_window_start First slot start
207
- sensor.octopus_overall_window_end Last slot end
208
- ```
209
-
210
- ### Diagnostics (Raw Timestamps)
211
- ```
212
- sensor.octopus_next_charge_time_raw Exact API timestamp
213
- sensor.octopus_slot_[1-3]_start_raw Raw slot start times
214
- sensor.octopus_slot_[1-3]_end_raw Raw slot end times
215
- sensor.octopus_overall_window_start_raw Raw window start
216
- sensor.octopus_overall_window_end_raw Raw window end
217
- ```
218
-
219
- ---
220
-
221
- ## 💡 Node-RED Usage
222
-
223
- ### Basic Monitoring
224
-
225
- ```
226
- [Inject: Every 5 min] → [Octopus Intelligent] → [Debug]
227
- ```
228
-
229
- ### Set Preferences from Flow
230
-
231
- ```javascript
232
- msg.payload = {
233
- set_limit: 85, // 85% charge
234
- set_time: "07:30" // Ready by 07:30
235
- };
236
- return msg;
237
- ```
238
-
239
- ### Output Format
240
-
241
- ```json
242
- {
243
- "payload": {
244
- "next_start": "2025-11-29T01:30:00Z",
245
- "total_energy": 42.5,
246
- "next_kwh": "15.20",
247
- "next_source": "smart-charge",
248
- "confirmed_limit": 80,
249
- "confirmed_time": "07:00",
250
- "slot1_start": "2025-11-29T01:30:00Z",
251
- "slot1_end": "2025-11-29T05:30:00Z"
252
- },
253
- "debug": {
254
- "success": true,
255
- "step": "complete",
256
- "apiCalls": [...]
257
- }
258
- }
259
- ```
260
-
261
- ---
262
-
263
- ## 🏡 Home Assistant Automation Examples
264
-
265
- ### Notify When Charging Starts
266
-
267
- ```yaml
268
- automation:
269
- - alias: "EV Charging Starting"
270
- trigger:
271
- platform: state
272
- entity_id: sensor.octopus_next_charge_time
273
- condition:
274
- condition: template
275
- value_template: "{{ trigger.to_state.state != 'None' }}"
276
- action:
277
- service: notify.mobile_app
278
- data:
279
- message: "EV charging at {{ states('sensor.octopus_next_charge_time') }}"
280
- ```
281
-
282
- ### Run Dishwasher During Cheap Rate
283
-
284
- ```yaml
285
- automation:
286
- - alias: "Dishwasher During Cheap Window"
287
- trigger:
288
- platform: time_pattern
289
- minutes: "/5"
290
- condition:
291
- - condition: template
292
- value_template: >
293
- {% set start = as_timestamp(states('sensor.octopus_slot1_start')) %}
294
- {% set end = as_timestamp(states('sensor.octopus_slot1_end')) %}
295
- {% set now = as_timestamp(now()) %}
296
- {{ start <= now <= end }}
297
- action:
298
- service: switch.turn_on
299
- target:
300
- entity_id: switch.dishwasher
301
- ```
302
-
303
- ---
304
-
305
- ## 🔍 Troubleshooting
306
-
307
- ### No Data (All Sensors Null/0)
308
-
309
- **Check `msg.debug` output** in a Debug node:
310
-
311
- Common issues:
312
- - ❌ Account format must include `A-` prefix
313
- - ❌ Invalid API key - regenerate at Octopus dashboard
314
- - ❌ Not on Intelligent Octopus tariff
315
- - ❌ Car not plugged in (no slots scheduled)
316
-
317
- ### Authentication Failing
318
-
319
- Check `msg.debug.apiCalls[0].errors` for details.
320
-
321
- **Solution:** Regenerate API key and update node configuration.
322
-
323
- ### Sensors Unavailable in Home Assistant
324
-
325
- 1. Verify MQTT broker is running
326
- 2. Check Node-RED can connect to MQTT
327
- 3. Deploy the flow to trigger discovery
328
- 4. Confirm Home Assistant MQTT integration is enabled
329
-
330
- ### Raw Sensors Not in Diagnostics
331
-
332
- If entities existed before v1.0:
333
- 1. Delete "Octopus Intelligent" device in Home Assistant
334
- 2. Redeploy Node-RED flow
335
- 3. Entities will be rediscovered with proper categories
336
-
337
- ### Changes Not Applying
338
-
339
- **Working as designed!** Use the **Apply Changes** button to submit.
340
-
341
- This prevents API spam when making multiple adjustments.
342
-
343
- ---
344
-
345
- ## 🛠️ How It Works
346
-
347
- ### Authentication Flow
348
-
349
- 1. **Get Token** - Exchange API key for token
350
- 2. **Fetch Data** - Query planned dispatches & preferences
351
- 3. **Process** - Filter active/future slots, calculate totals
352
- 4. **Publish** - Send to Node-RED + MQTT
353
-
354
- ### Exponential Backoff
355
-
356
- When changing preferences:
357
-
358
- ```
359
- Mutation sent → Wait 15s → Validate
360
- ↓ If not confirmed
361
- → Wait 30s → Validate
362
- ↓ If not confirmed
363
- → Wait 60s → Validate
364
- ↓ If not confirmed
365
- → Wait 120s → Final check
366
- ↓ Then normal interval resumes
367
- ```
368
-
369
- This prevents sensors becoming "unavailable" during updates.
370
-
371
- ### Debug Information
372
-
373
- Every message includes `msg.debug`:
374
-
375
- ```json
376
- {
377
- "timestamp": "2025-11-29T10:30:00Z",
378
- "success": true,
379
- "step": "complete",
380
- "apiCalls": [
381
- {"name": "authentication", "tokenObtained": true},
382
- {"name": "data_query", "slotsFound": 3}
383
- ]
384
- }
385
- ```
386
-
387
- ---
388
-
389
- ## 📝 License
390
-
391
- MIT License - Copyright (c) 2025 Andrew Somerharju Neale
392
-
393
- See [LICENSE](LICENSE) file for full details.
394
-
395
- ---
396
-
397
- ## ⚠️ Disclaimer
398
-
399
- This is an **unofficial integration** and is not affiliated with, endorsed by, or connected to Octopus Energy Ltd.
400
-
401
- Use at your own risk. The Octopus Energy name and logo are trademarks of Octopus Energy Ltd.
402
-
403
- ---
404
-
405
- ## 🔗 Links
406
-
407
- - **npm**: https://www.npmjs.com/package/node-red-contrib-octopus-intelligent
408
- - **GitHub**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent
409
- - **Issues**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues
410
- - **Octopus Intelligent**: https://octopus.energy/intelligent/
411
- - **API Docs**: https://developer.octopus.energy/docs/api/
412
-
413
- ---
414
-
415
- ## 📜 Changelog
416
-
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
429
-
430
- ---
431
-
432
- **Made with ⚡ for the Octopus Energy & Home Assistant communities**
1
+ # node-red-contrib-octopus-intelligent
2
+
3
+ > Node-RED integration for **Octopus Energy Intelligent Octopus Go** with automatic Home Assistant MQTT discovery
4
+
5
+ Monitor your EV charging slots, control charge limits, and manage ready times directly from Home Assistant - all automatically configured via MQTT discovery.
6
+
7
+ [![npm version](https://badge.fury.io/js/node-red-contrib-octopus-intelligent.svg)](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ ---
11
+
12
+ ## 🤝 Support This Project
13
+
14
+ Found this useful? Support continued development:
15
+
16
+ <table>
17
+ <tr>
18
+ <td width="33%" align="center">
19
+
20
+ ### ⭐ GitHub Star
21
+ Star the repository to show your support!
22
+
23
+ [⭐ Star on GitHub](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
24
+
25
+ </td>
26
+ <td width="33%" align="center">
27
+
28
+ ### 💖 Sponsor
29
+ Support ongoing development and maintenance
30
+
31
+ [Become a Sponsor](https://github.com/sponsors/ASomerN)
32
+
33
+ </td>
34
+ <td width="33%" align="center">
35
+
36
+ ### ☕ Buy Me a Coffee
37
+ If this project has helped you!
38
+
39
+ [![Donate with PayPal](https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate?hosted_button_id=A2B8ZFEJBE2S6)
40
+
41
+ </td>
42
+ </tr>
43
+ </table>
44
+
45
+ **Your support helps with:** Bug fixes and maintenance • New feature development • Documentation improvements • Community support • Feeding my children
46
+
47
+ ---
48
+
49
+ ## ✨ Features
50
+
51
+ ### 🎮 Smart Controls
52
+ - **Target Charge Slider** (50-100%) - Set your desired battery level
53
+ - **Ready Time Dropdown** (04:00-11:00) - When your car needs to be ready
54
+ - **Apply Changes Button** - Prevents API spam while adjusting settings
55
+ - **Confirmed Values** - See your current API-validated settings
56
+
57
+ ### ⚡ Real-Time Charging Data
58
+ - **Next Charge Time** - When your next slot starts
59
+ - **Total Planned Energy** - Total kWh across all upcoming slots
60
+ - **Individual Slot Times** - Up to 3 slots with start/end times
61
+ - **Charging Window** - Overall window from first to last slot
62
+ - **Charge Source** - Smart-charge vs bump-charge indicator
63
+
64
+ ### 🔧 Advanced Features
65
+ - **Manual Refresh Button** - Force API refresh from Home Assistant (30s cooldown)
66
+ - **Next Poll Timer** - See when the next automatic refresh will occur
67
+ - **API Usage Tracking** - Monitor requests and complexity in diagnostics
68
+ - **Raw Timestamps** - Exact API responses in Diagnostics section
69
+ - **Exponential Backoff** - Smart retry prevents sensor unavailability
70
+ - **Comprehensive Debugging** - Full API call tracking in msg.debug
71
+ - **Active Slot Detection** - Shows currently running sessions
72
+ - **Entity Categories** - Organized Controls, Sensors, and Diagnostics
73
+
74
+ ### 🏠 Home Assistant Integration
75
+ - **Zero Configuration** - MQTT auto-discovery sets everything up
76
+ - **Professional UI** - Octopus Energy branded device cards
77
+ - **Organized Entities** - Controls, main sensors, and diagnostics neatly grouped
78
+ - **Suggested Area** - Auto-suggests "Energy" area
79
+
80
+ ---
81
+
82
+ ## 📸 Screenshots
83
+
84
+ ### Node-RED Flow Examples
85
+
86
+ #### Basic Monitoring & Control
87
+ ![Node-RED Flow Examples](images/examples/basic-monitoring-flow.png)
88
+
89
+ This example flow demonstrates three key usage patterns:
90
+
91
+ 1. **Basic Monitoring**
92
+ - The Octopus Intelligent Node automaticaly refreshes every 5 minutes
93
+ - Octopus Intelligent node fetches latest charging data
94
+ - Debug node displays all charging slots and settings
95
+
96
+ 2. **Setting Preferences**
97
+ - Inject node with JSON payload: `{"set_limit": 85, "set_time": "07:30"}` ommit a key:value if you don't want to change it
98
+ - Sends charge limit +/ ready time to the node
99
+ - Debug shows confirmed values from API
100
+
101
+ **How to use:** Import any of these flows, configure your Account Number and API Key in the Octopus Intelligent node, and deploy!
102
+
103
+ #### MQTT Integration with Home Assistant
104
+ ![MQTT Integration Flow](images/examples/mqtt-integration-flow.png)
105
+
106
+ This flow shows the complete MQTT setup:
107
+
108
+ - **MQTT Broker Configuration**: Connected to Home Assistant (localhost:1883)
109
+ - **Enable MQTT toggle**: Activated in node settings
110
+ - **Auto-Discovery**: Node automatically creates all entities in Home Assistant on first run
111
+ - **Real-time Updates**: Every 5 minutes, charging data is published to MQTT and updates HA sensors
112
+
113
+ **What you get in Home Assistant:** All controls and sensors appear automatically - no manual YAML configuration needed!
114
+
115
+ ### Home Assistant Auto-Configured Entities
116
+
117
+ ![Home Assistant Device](images/examples/homeassistant-device-v1.0.4.png)
118
+
119
+ After enabling MQTT in the Node-RED node, Home Assistant automatically creates:
120
+
121
+ #### Controls (Top Section)
122
+ - **Target Charge** - Number slider (50-100%) to set desired battery level
123
+ - **Ready Time** - Dropdown selector (04:00-11:00) for when car needs to be ready
124
+ - **Apply Changes** - Button to submit new settings (prevents API spam while adjusting)
125
+ - **Refresh API** - Button to force manual refresh (30-second cooldown prevents spam)
126
+
127
+ #### Sensors (Main Section)
128
+ - **Confirmed Charge Limit** - Current API-validated charge limit
129
+ - **Confirmed Ready Time** - Current API-validated ready time
130
+ - **Next Charge Time** - When your next charging slot starts (formatted for your timezone)
131
+ - **Next Poll Time** - When the next automatic refresh will occur
132
+ - **Total Planned Energy** - Total kWh across all upcoming slots
133
+ - **Slot 1, 2, 3 Start/End** - Individual charging slot times
134
+ - **Overall Window Start/End** - First slot start to last slot end
135
+ - **Charging Now** - Binary sensor (ON/OFF) showing if actively charging
136
+
137
+ #### Diagnostics (Raw timestamps and monitoring)
138
+ - **Refresh Available At** - Countdown timestamp showing when manual refresh becomes available
139
+ - **API Requests (Last Hour)** - Number of API calls in the last 60 minutes
140
+ - **API Complexity (Last Hour)** - Total complexity used (max 50,000/hour)
141
+ - **API Complexity Usage** - Percentage of hourly API limit used
142
+ - **Raw timestamp sensors** - Exact API responses for all sensors
143
+ - Useful for debugging, advanced automations, and monitoring API usage
144
+
145
+ **All entities are automatically organized under a single "Octopus Intelligent" device!**
146
+
147
+ ---
148
+
149
+ ## 📋 Requirements
150
+
151
+ - **Node-RED** v2.0+
152
+ - **Octopus Energy Account** with [Intelligent Octopus Go](https://octopus.energy/intelligent/) tariff
153
+ - **API Key** - [Generate here](https://octopus.energy/dashboard/new/accounts/personal-details/api-access)
154
+ - **MQTT Broker** (optional, for Home Assistant integration)
155
+ - **Home Assistant** (optional, for MQTT features)
156
+
157
+ ---
158
+
159
+ ## 🚀 Quick Start
160
+
161
+ ### 1. Install via Node-RED Palette
162
+
163
+ 1. Open Node-RED → **Menu** → **Manage Palette**
164
+ 2. **Install** tab → Search `node-red-contrib-octopus-intelligent`
165
+ 3. Click **Install**
166
+
167
+ ### 2. Get Your Credentials
168
+
169
+ **Account Number** (format: `A-XXXXXXXX`):
170
+ - Found at https://octopus.energy/dashboard/
171
+
172
+ **API Key** (format: `sk_live_...`):
173
+ - Get from https://octopus.energy/dashboard/new/accounts/personal-details/api-access
174
+ - Click "Generate API Key"
175
+
176
+ ### 3. Configure the Node
177
+
178
+ 1. Drag **Octopus Intelligent** into your flow
179
+ 2. Double-click to configure:
180
+ - Account Number
181
+ - API Key (stored securely)
182
+ - Refresh Interval (default: 5 min)
183
+ - Enable MQTT if using Home Assistant
184
+ 3. **Deploy**
185
+
186
+ ### 4. Home Assistant (Optional)
187
+
188
+ If MQTT enabled:
189
+ 1. Wait ~5 seconds after deploy
190
+ 2. **Settings** → **Devices & Services** → **MQTT**
191
+ 3. Find "Octopus Intelligent" device
192
+ 4. All entities created automatically!
193
+
194
+ ---
195
+
196
+ ## 📊 Home Assistant Entities
197
+
198
+ ### Controls
199
+ ```
200
+ number.octopus_target_charge Battery charge limit (50-100%)
201
+ select.octopus_ready_time Ready by time (04:00-11:00)
202
+ button.octopus_apply_changes Submit changes to API
203
+ button.octopus_refresh_api Manual refresh (30s cooldown)
204
+ ```
205
+
206
+ ### Main Sensors
207
+ ```
208
+ sensor.octopus_confirmed_charge_limit API-confirmed charge limit
209
+ sensor.octopus_confirmed_ready_time API-confirmed ready time
210
+ sensor.octopus_next_charge_time Next charging slot start
211
+ sensor.octopus_next_poll_time Next automatic refresh time
212
+ sensor.octopus_total_planned_energy Total kWh planned
213
+ sensor.octopus_next_slot_energy Energy in next slot
214
+ sensor.octopus_charge_source smart-charge/bump-charge
215
+ sensor.octopus_slot_[1-3]_start Individual slot starts
216
+ sensor.octopus_slot_[1-3]_end Individual slot ends
217
+ sensor.octopus_overall_window_start First slot start
218
+ sensor.octopus_overall_window_end Last slot end
219
+ ```
220
+
221
+ ### Diagnostics (Raw Timestamps & Monitoring)
222
+ ```
223
+ # Refresh & Polling
224
+ sensor.octopus_refresh_available_at When manual refresh becomes available
225
+ sensor.octopus_next_poll_time_raw Raw next poll timestamp
226
+
227
+ # API Usage Tracking
228
+ sensor.octopus_api_requests_hour API calls in last 60 minutes
229
+ sensor.octopus_api_complexity_hour Total complexity used
230
+ sensor.octopus_api_complexity_usage Percentage of 50,000/hour limit
231
+
232
+ # Raw Timestamps
233
+ sensor.octopus_next_charge_time_raw Exact API timestamp
234
+ sensor.octopus_slot_[1-3]_start_raw Raw slot start times
235
+ sensor.octopus_slot_[1-3]_end_raw Raw slot end times
236
+ sensor.octopus_overall_window_start_raw Raw window start
237
+ sensor.octopus_overall_window_end_raw Raw window end
238
+ ```
239
+
240
+ ---
241
+
242
+ ## 💡 Node-RED Usage
243
+
244
+ ### Basic Monitoring
245
+
246
+ ```
247
+ [Inject: Every 5 min] → [Octopus Intelligent] → [Debug]
248
+ ```
249
+
250
+ ### Set Preferences from Flow
251
+
252
+ ```javascript
253
+ msg.payload = {
254
+ set_limit: 85, // 85% charge
255
+ set_time: "07:30" // Ready by 07:30
256
+ };
257
+ return msg;
258
+ ```
259
+
260
+ ### Output Format
261
+
262
+ ```json
263
+ {
264
+ "payload": {
265
+ "next_start": "2025-11-29T01:30:00Z",
266
+ "total_energy": 42.5,
267
+ "next_kwh": "15.20",
268
+ "next_source": "smart-charge",
269
+ "confirmed_limit": 80,
270
+ "confirmed_time": "07:00",
271
+ "pending_limit": 80,
272
+ "pending_time": "07:00",
273
+ "charging_now": false,
274
+ "next_poll": "2025-11-29T10:35:00Z",
275
+ "refresh_available_at": null,
276
+ "api_requests_hour": 12,
277
+ "api_complexity_hour": 3600,
278
+ "api_complexity_percent": 7.2,
279
+ "slot1_start": "2025-11-29T01:30:00Z",
280
+ "slot1_end": "2025-11-29T05:30:00Z"
281
+ },
282
+ "debug": {
283
+ "success": true,
284
+ "step": "complete",
285
+ "apiCalls": [
286
+ {
287
+ "name": "data_query",
288
+ "responseHeaders": {...},
289
+ "extensions": null
290
+ }
291
+ ],
292
+ "api_usage": {
293
+ "requests_last_hour": 12,
294
+ "complexity_last_hour": 3600,
295
+ "complexity_percent_used": "7.2",
296
+ "api_limit_hourly": 50000,
297
+ "request_complexity": 300,
298
+ "complexity_source": "estimated"
299
+ }
300
+ }
301
+ }
302
+ ```
303
+
304
+ ---
305
+
306
+ ## 🏡 Home Assistant Automation Examples
307
+
308
+ ### Notify When Charging Starts
309
+
310
+ ```yaml
311
+ automation:
312
+ - alias: "EV Charging Starting"
313
+ trigger:
314
+ platform: state
315
+ entity_id: sensor.octopus_next_charge_time
316
+ condition:
317
+ condition: template
318
+ value_template: "{{ trigger.to_state.state != 'None' }}"
319
+ action:
320
+ service: notify.mobile_app
321
+ data:
322
+ message: "EV charging at {{ states('sensor.octopus_next_charge_time') }}"
323
+ ```
324
+
325
+ ### Run Dishwasher During Cheap Rate
326
+
327
+ ```yaml
328
+ automation:
329
+ - alias: "Dishwasher During Cheap Window"
330
+ trigger:
331
+ platform: time_pattern
332
+ minutes: "/5"
333
+ condition:
334
+ - condition: template
335
+ value_template: >
336
+ {% set start = as_timestamp(states('sensor.octopus_slot1_start')) %}
337
+ {% set end = as_timestamp(states('sensor.octopus_slot1_end')) %}
338
+ {% set now = as_timestamp(now()) %}
339
+ {{ start <= now <= end }}
340
+ action:
341
+ service: switch.turn_on
342
+ target:
343
+ entity_id: switch.dishwasher
344
+ ```
345
+
346
+ ---
347
+
348
+ ## 🔍 Troubleshooting
349
+
350
+ ### No Data (All Sensors Null/0)
351
+
352
+ **Check `msg.debug` output** in a Debug node:
353
+
354
+ Common issues:
355
+ - ❌ Account format must include `A-` prefix
356
+ - ❌ Invalid API key - regenerate at Octopus dashboard
357
+ - ❌ Not on Intelligent Octopus tariff
358
+ - ❌ Car not plugged in (no slots scheduled)
359
+
360
+ ### Authentication Failing
361
+
362
+ Check `msg.debug.apiCalls[0].errors` for details.
363
+
364
+ **Solution:** Regenerate API key and update node configuration.
365
+
366
+ ### Sensors Unavailable in Home Assistant
367
+
368
+ 1. Verify MQTT broker is running
369
+ 2. Check Node-RED can connect to MQTT
370
+ 3. Deploy the flow to trigger discovery
371
+ 4. Confirm Home Assistant MQTT integration is enabled
372
+
373
+ ### Raw Sensors Not in Diagnostics
374
+
375
+ If entities existed before v1.0:
376
+ 1. Delete "Octopus Intelligent" device in Home Assistant
377
+ 2. Redeploy Node-RED flow
378
+ 3. Entities will be rediscovered with proper categories
379
+
380
+ ### Changes Not Applying
381
+
382
+ **Working as designed!** Use the **Apply Changes** button to submit.
383
+
384
+ This prevents API spam when making multiple adjustments.
385
+
386
+ ---
387
+
388
+ ## 🛠️ How It Works
389
+
390
+ ### Authentication Flow
391
+
392
+ 1. **Get Token** - Exchange API key for token
393
+ 2. **Fetch Data** - Query planned dispatches & preferences
394
+ 3. **Process** - Filter active/future slots, calculate totals
395
+ 4. **Publish** - Send to Node-RED + MQTT
396
+
397
+ ### Exponential Backoff
398
+
399
+ When changing preferences:
400
+
401
+ ```
402
+ Mutation sent → Wait 15s → Validate
403
+ ↓ If not confirmed
404
+ → Wait 30s → Validate
405
+ ↓ If not confirmed
406
+ → Wait 60s → Validate
407
+ ↓ If not confirmed
408
+ → Wait 120s → Final check
409
+ ↓ Then normal interval resumes
410
+ ```
411
+
412
+ This prevents sensors becoming "unavailable" during updates.
413
+
414
+ ### Debug Information
415
+
416
+ Every message includes `msg.debug`:
417
+
418
+ ```json
419
+ {
420
+ "timestamp": "2025-11-29T10:30:00Z",
421
+ "success": true,
422
+ "step": "complete",
423
+ "apiCalls": [
424
+ {"name": "authentication", "tokenObtained": true},
425
+ {"name": "data_query", "slotsFound": 3}
426
+ ]
427
+ }
428
+ ```
429
+
430
+ ---
431
+
432
+ ## 📝 License
433
+
434
+ MIT License - Copyright (c) 2025 Andrew Somerharju Neale
435
+
436
+ See [LICENSE](LICENSE) file for full details.
437
+
438
+ ---
439
+
440
+ ## ⚠️ Disclaimer
441
+
442
+ This is an **unofficial integration** and is not affiliated with, endorsed by, or connected to Octopus Energy Ltd.
443
+
444
+ Use at your own risk. The Octopus Energy name and logo are trademarks of Octopus Energy Ltd.
445
+
446
+ ---
447
+
448
+ ## 🔗 Links
449
+
450
+ - **npm**: https://www.npmjs.com/package/node-red-contrib-octopus-intelligent
451
+ - **GitHub**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent
452
+ - **Issues**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues
453
+ - **Octopus Intelligent**: https://octopus.energy/intelligent/
454
+ - **API Docs**: https://developer.octopus.energy/docs/api/
455
+
456
+ ---
457
+
458
+ ## 📜 Changelog
459
+
460
+ See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
461
+
462
+ ### Latest Release: v1.0.4 (2025-12-11)
463
+ - **Manual Refresh Button** - Force API refresh via Home Assistant with 30s cooldown
464
+ - **Next Poll Timer** - See when next automatic refresh occurs
465
+ - **API Complexity Monitoring** - Track API usage against 50,000/hour limit
466
+ - **Enhanced State Output** - Every poll outputs full state to Node-RED
467
+ - **Rate Limiting** - MQTT button (30s cooldown), Node-RED input (no limit)
468
+ - **Improved Debugging** - Response headers and extensions captured
469
+
470
+ ### Previous Release: v1.0.3 (2025-12-04)
471
+ - State reconciliation loop for charging detection
472
+ - Fixed Home Assistant sensors going "unknown"
473
+ - Flow Library scorecard compliance
474
+
475
+ ---
476
+
477
+ **Made with ⚡ for the Octopus Energy & Home Assistant communities**