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/CHANGELOG.md +209 -118
- package/README.md +477 -432
- package/__tests__/README.md +220 -0
- package/__tests__/TEST-SUMMARY.md +194 -0
- package/__tests__/charging-now-validation.test.js +495 -0
- package/__tests__/charging-timers.test.js +601 -0
- package/__tests__/data-processing.test.js +478 -0
- package/__tests__/mqtt-refresh-cooldown.test.js +420 -0
- package/__tests__/reconciliation-loop.test.js +474 -0
- package/examples/basic-monitoring.json +1 -0
- package/examples/mqtt-integration.json +1 -0
- package/examples/set-preferences.json +1 -0
- package/images/IMAGES_NEEDED.md +64 -0
- package/images/examples/basic-monitoring-flow.png +0 -0
- package/images/examples/homeassistant-device-v1.0.4.png +0 -0
- package/images/examples/homeassistant-device.png +0 -0
- package/images/examples/mqtt-integration-flow.png +0 -0
- package/octopus-intelligent.js +1163 -861
- package/package.json +58 -46
- package/test-mocks.js +1038 -0
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
|
-
[](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
|
|
8
|
-
[](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
|
-
[](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
|
-
- **
|
|
66
|
-
- **
|
|
67
|
-
- **
|
|
68
|
-
- **
|
|
69
|
-
- **
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- **
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- **
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- **
|
|
109
|
-
|
|
110
|
-
**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
- **
|
|
125
|
-
- **
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- **
|
|
129
|
-
- **
|
|
130
|
-
- **
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
- **
|
|
143
|
-
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
###
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
sensor.
|
|
213
|
-
sensor.
|
|
214
|
-
sensor.
|
|
215
|
-
sensor.
|
|
216
|
-
sensor.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
---
|
|
431
|
-
|
|
432
|
-
|
|
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
|
+
[](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
|
|
8
|
+
[](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
|
+
[](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
|
+

|
|
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
|
+

|
|
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
|
+

|
|
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**
|