node-red-contrib-octopus-intelligent 1.5.0 → 1.7.0

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +597 -442
  2. package/README.md +1234 -980
  3. package/examples/basic-monitoring.json +1 -1
  4. package/examples/boost-on-cheap-or-surplus.json +171 -0
  5. package/examples/charging-and-error-alerts.json +95 -0
  6. package/examples/cheapest-window-planner.json +165 -0
  7. package/examples/daily-charging-summary.json +165 -0
  8. package/examples/ha-dashboard.yaml +667 -599
  9. package/examples/mqtt-integration.json +1 -1
  10. package/examples/node-red-dashboard-flow.json +1377 -1199
  11. package/examples/set-preferences.json +1 -1
  12. package/lib/active-now.js +33 -0
  13. package/lib/api-metrics.js +31 -31
  14. package/lib/auth.js +25 -20
  15. package/lib/boost.js +85 -0
  16. package/lib/categories/account.js +32 -32
  17. package/lib/categories/applicable-rates.js +137 -127
  18. package/lib/categories/completed-dispatches.js +36 -35
  19. package/lib/categories/electricity.js +156 -146
  20. package/lib/categories/flex-planned-dispatches.js +36 -36
  21. package/lib/categories/free-electricity.js +73 -61
  22. package/lib/categories/gas.js +102 -95
  23. package/lib/categories/home-mini.js +45 -37
  24. package/lib/categories/intelligent.js +221 -124
  25. package/lib/categories/octoplus.js +35 -32
  26. package/lib/categories/saving-sessions.js +78 -64
  27. package/lib/categories/smartflex-inverter.js +95 -0
  28. package/lib/categories/smartflex-vehicle.js +198 -0
  29. package/lib/categories/wheel-of-fortune.js +50 -49
  30. package/lib/commands.js +69 -0
  31. package/lib/discovery-retry.js +16 -0
  32. package/lib/discovery.js +154 -85
  33. package/lib/graphql-errors.js +174 -0
  34. package/lib/graphql.js +141 -44
  35. package/lib/http-get-json.js +80 -22
  36. package/lib/payload.js +104 -88
  37. package/lib/poll-retry.js +71 -0
  38. package/lib/poll-tick.js +112 -44
  39. package/lib/preferences.js +34 -0
  40. package/lib/scheduler.js +85 -47
  41. package/lib/sensor-definitions.js +269 -0
  42. package/lib/timezone.js +67 -49
  43. package/lib/update-check.js +38 -38
  44. package/lib/values.js +47 -0
  45. package/octopus-intelligent.html +258 -205
  46. package/octopus-intelligent.js +2816 -1807
  47. package/package.json +54 -54
package/README.md CHANGED
@@ -1,980 +1,1234 @@
1
- # node-red-contrib-octopus-intelligent
2
-
3
- > Node-RED integration for **Octopus Energy** with automatic Home Assistant MQTT discovery
4
-
5
- Monitor electricity and gas rates (import + export), EV charging schedules, real-time home energy usage, account balance, saving sessions, and Wheel of Fortune spins — all automatically configured as Home Assistant entities 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
- ### 🎮 EV 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
- - **Smart Charging Toggle** — Suspend or resume Octopus intelligent charging from Node-RED or Home Assistant
57
-
58
- ### ⚡ Real-Time Charging Data
59
- - **Next Charge Time** — When your next slot starts
60
- - **Total Planned Energy** — Total kWh across all upcoming slots
61
- - **Individual Slot Times** — Up to 3 slots with start/end times
62
- - **Charging Window** — Overall window from first to last slot
63
- - **Charge Source** — Smart-charge vs bump-charge indicator
64
- - **Completed Dispatches** — History of completed intelligent charging sessions
65
- - **Flex Planned Dispatches** — Upcoming flex dispatch schedule
66
-
67
- ### 🔌 Electricity & Gas Rates
68
- - **Live Unit Rate** — Current electricity rate (p/kWh) and gas rate (p/kWh)
69
- - **Standing Charges** — Daily standing charges for electricity and gas
70
- - **Tariff Code** — Your current tariff identifier and validity dates
71
- - **Recent Consumption** — Previous day kWh for electricity (import + export) and gas
72
- - **Current Rate Slot** — Live rate from your 24h applicable rates schedule
73
- - **Previous / Next Rate** — Adjacent slot rates and transition timestamps
74
- - **Energy Dashboard Rate** — Electricity rate in GBP/kWh, ready for HA's Energy Dashboard cost tracking
75
-
76
- ### 🌞 Electricity Export (Solar / Battery)
77
- - **Export Tariff** — Tariff code, standing charge, validity dates for the OUTGOING agreement
78
- - **Export Half-Hourly Rates** — Full 48-slot schedule for variable export tariffs (e.g. Agile Outgoing)
79
- - **Live Export Rate** — Current p/kWh and GBP/kWh
80
- - **Previous / Next Export Rate** — Adjacent slot rates and transition timestamps
81
- - **Export Consumption** — Previous day kWh exported to the grid (read from the export meter point)
82
-
83
- ### 🏠 Home Energy (Octopus Home Mini)
84
- - **Live Demand** — Real-time grid import in kW
85
- - **Period Consumption** — Energy consumed in the last half-hour period (kWh)
86
- - Requires Octopus Home Mini device registered to your account (opt-in)
87
-
88
- ### 💰 Account & Rewards
89
- - **Account Balance** — Current credit/debit balance in £
90
- - **Saving Sessions** — Next session availability, start/end times, joined status, and Octopus Points
91
- - **Free Electricity** — Upcoming free electricity window detection (active June–October)
92
- - **Wheel of Fortune** — Remaining electricity and gas spins (opt-in)
93
- - **Octoplus** — Enrollment status and loyalty points
94
-
95
- ### 🔧 Advanced Features
96
- - **Account Discovery** — Automatic product detection at startup; categories auto-enable based on registered products
97
- - **Per-Category Polling** — Each data category polls on its own configurable interval
98
- - **Manual Refresh Button** — Force API refresh from Home Assistant (30s cooldown)
99
- - **Next Poll Timer** — See when the next automatic refresh will occur
100
- - **API Usage Tracking** — Monitor requests and complexity in diagnostics
101
- - **Exponential Backoff** — Smart retry prevents sensor unavailability
102
- - **Comprehensive Debugging** — Full API call tracking in msg.debug
103
-
104
- ### 🏡 Home Assistant Integration
105
- - **Zero Configuration** — MQTT auto-discovery sets everything up
106
- - **Two-Tier Entity Organisation** — Main entities (controls, live rates, consumption, tariff metadata, rewards) and Diagnostics (errors, raw timestamps, API metrics, locale timestamps)
107
- - **Suggested Area** — Auto-suggests "Energy" area
108
- - **Reference dashboard YAML** — `examples/ha-dashboard.yaml` covers every entity in a packed sections layout, ready to paste into HA's Raw Configuration Editor
109
-
110
- ### 🌍 Timezone Support
111
- - **Locale Timestamps** (`*_locale` fields) — always in server auto-detected timezone
112
- - **Resolved Display Fields** — slot and window times in your configured timezone
113
- - **HA Timezone Select** — change timezone from Home Assistant without redeploying
114
- - **Node Config Override** — set IANA timezone directly in the node editor
115
- - **Zero Dependencies** — native `Intl` API, no new packages
116
-
117
- ---
118
-
119
- ## 📸 Screenshots
120
-
121
- ### Node Configuration
122
-
123
- ![Node Configuration](images/examples/Octopus%20Intelligent%20Node.png)
124
-
125
- Configure your account credentials, polling intervals, and MQTT broker in the node editor. The MQTT Broker dropdown connects directly to your Home Assistant Mosquitto instance. Per-category intervals let you tune how often each data source is polled — electricity and gas rates update hourly by default, while Home Mini polls every minute for live demand.
126
-
127
- ### Node-RED Flow Example
128
-
129
- ![Node-RED Flow Example](images/examples/basic-monitoring-flow.png)
130
-
131
- ### Home Assistant — Dashboard
132
-
133
- `examples/ha-dashboard.yaml` is a comprehensive Lovelace dashboard that exposes every entity the plugin publishes. Paste it into HA's Raw Configuration Editor to get the layout below. The layout uses HA's sections view and packs cards uniformly across up to 4 columns on wide screens.
134
-
135
- #### EV controls, electricity import & export
136
-
137
- ![Dashboard — EV, electricity import + export](images/examples/home_assistant_dashboard_1_1-3-0.png)
138
-
139
- EV target slider and ready-time dropdown at top, then live import rate / standing / today's kWh, full import tariff card, half-hourly applicable rates summary, and the same trio for export (live export rate, export tariff, export consumption, half-hourly Agile Outgoing rates).
140
-
141
- #### Gas, account, rewards, Home Mini
142
-
143
- ![Dashboard — gas, account, rewards, Home Mini](images/examples/home_assistant_dashboard_2_1-3-0.png)
144
-
145
- Gas rate / standing / consumption + tariff. Account balance, Octoplus enrolment, Saving Sessions card, Free Electricity card, Wheel of Fortune spins, and the Home Mini live-demand gauge with current half-hour kWh.
146
-
147
- #### Diagnostics — UTC timestamps, raw timestamps, errors
148
-
149
- ![Dashboard — diagnostics](images/examples/home_assistant_dashboard_3_1-3-0.png)
150
-
151
- UTC-class slot/window timestamps (HA renders them as relative "n hours ago"), raw API strings for verbatim debugging, timezone + API usage rows, and a consolidated error panel covering every category.
152
-
153
- #### Gas — live data from a real account
154
-
155
- ![Dashboard — gas live data](images/examples/home_assistant_dashboard_working_gas_1-3-0.png)
156
-
157
- For accounts with a gas meter point, the gas card populates with live tariff code, unit rate (p/kWh), standing charge, daily consumption (kWh), and tariff validity dates. Above shows v1.3.0 reading correctly from a real account on Octopus standard variable gas tariff.
158
-
159
- #### Seasonal / conditional entities — when they show "Unavailable"
160
-
161
- | Sensor | Active period | Outside season / condition |
162
- |---|---|---|
163
- | Saving Session Start / End | October–March | `null` — no sessions scheduled |
164
- | Free Electricity Start / End | typically June–October | `null` — no sessions scheduled |
165
- | Electricity / Gas Tariff Valid To | When tariff has an end date | `null` — open-ended tariff |
166
- | Gas entities | Only if account has a gas meter point | `null` — electricity-only accounts |
167
- | Home Mini | Only if a Home Mini device is registered | Entity skipped if not registered |
168
- | Electricity Export entities | Only if account has an OUTGOING agreement | Entity values null without an export tariff |
169
- | EV planned slots / dispatches | Only when a charge is scheduled | `null` between plug-in cycles |
170
-
171
- These are normal MQTT behaviours, not bugs. The plugin publishes the entity definitions so HA registers them; their values populate when the API returns data for that period.
172
-
173
- ---
174
-
175
- ## 📋 Requirements
176
-
177
- - **Node-RED** v2.0+
178
- - **Octopus Energy Account** — any electricity account works for rates/consumption/account data
179
- - [Intelligent Octopus Go](https://octopus.energy/intelligent/) tariff required for EV charging features
180
- - Octopus Home Mini device required for real-time consumption (opt-in)
181
- - Wheel of Fortune is opt-in and requires an active electricity agreement
182
- - **API Key** — [Generate here](https://octopus.energy/dashboard/new/accounts/personal-details/api-access)
183
- - **MQTT Broker** (optional, for Home Assistant integration)
184
- - **Home Assistant** (optional, for MQTT features)
185
-
186
- ---
187
-
188
- ## 🚀 Quick Start
189
-
190
- ### 1. Install via Node-RED Palette
191
-
192
- 1. Open Node-RED → **Menu** → **Manage Palette**
193
- 2. **Install** tab → Search `node-red-contrib-octopus-intelligent`
194
- 3. Click **Install**
195
-
196
- ### 2. Get Your Credentials
197
-
198
- **Account Number** (format: `A-XXXXXXXX`):
199
- - Found at https://octopus.energy/dashboard/
200
-
201
- **API Key** (format: `sk_live_...`):
202
- - Get from https://octopus.energy/dashboard/new/accounts/personal-details/api-access
203
- - Click "Generate API Key"
204
-
205
- ### 3. Configure the Node
206
-
207
- 1. Drag **Octopus Intelligent** into your flow
208
- 2. Double-click to configure:
209
- - Account Number (format: `A-XXXXXXXX`)
210
- - API Key (stored securely)
211
- - Refresh Interval (default: 5 min — controls EV charging data polling)
212
- - Per-category polling intervals (electricity, gas, etc.)
213
- - ☑ Enable Home Mini — tick if you have an Octopus Home Mini device
214
- - ☑ Enable Wheel of Fortune — tick to track remaining spins
215
- - Enable MQTT if using Home Assistant and select your MQTT broker
216
- 3. **Deploy** — account discovery runs automatically and enables categories based on your registered products
217
-
218
- ### 4. Home Assistant (Optional)
219
-
220
- If MQTT enabled:
221
- 1. Wait ~5 seconds after deploy
222
- 2. **Settings** → **Devices & Services** → **MQTT**
223
- 3. Find "Octopus Intelligent" device
224
- 4. All entities created automatically — no YAML required
225
-
226
- ---
227
-
228
- ## ⬆️ Upgrading from v1.2.x
229
-
230
- v1.3.0 is additive — no breaking changes. Existing flows, automations, and dashboards continue working unchanged.
231
-
232
- **What happens on upgrade:**
233
- - All existing entity IDs are preserved (HA's MQTT integration matches by `unique_id`, which is stable)
234
- - All v1.2.x payload fields remain in the same positions
235
- - ~70 new sensors appear in Home Assistant automatically after first poll — electricity import/export tariff and rates, gas tariff and consumption, Home Mini, Octoplus, saving sessions, free electricity, Wheel of Fortune, account balance, applicable rates
236
- - New node config options (Home Mini, Wheel of Fortune) default to off
237
- - Two existing Octoplus booleans (`octoplus_enrolled`, `octoplus_loyalty_points_user`) move from `sensor.` to `binary_sensor.` domain — a fresh install picks the right domain automatically; a clean upgrade may register both. Delete the old `sensor.` entries via Dev Tools if you want a tidy device card.
238
-
239
- If you installed an early dev build of v1.3 and have stale entities in Home Assistant, see [Stale Entities After Early v1.3 Dev Build](#stale-entities-after-early-v13-dev-build) in the Troubleshooting section.
240
-
241
- ---
242
-
243
- ## 📊 Home Assistant Entities
244
-
245
- **121 MQTT entities** are published under a single **Octopus Intelligent** device on a fresh install — verified against a live install. All entities are organised into two tiers: **Main** (controls, live data, tariff metadata, rewards) and **Diagnostics** (errors, raw timestamps, locale timestamps, API metrics).
246
-
247
- If your device card shows more than 121 entities, the extras are likely leftovers from earlier installed versions or interrupted discovery. They can be deleted via Settings → Devices & Services → MQTT → Octopus Intelligent → entity → cog → "Delete from registry" without affecting current operation.
248
-
249
- ### Node-RED payload vs MQTT entities
250
-
251
- `msg.payload` from the Node-RED node contains **~132 fields** — 11 more than the MQTT entities count. The "extra" payload fields are intentionally **not** exposed as individual HA entities; they exist for template/automation use inside Node-RED or HA Jinja:
252
-
253
- | Category | Fields (count) | Why no MQTT entity |
254
- |---|---|---|
255
- | Bulk array data | `applicable_rates`, `electricity_export_rate`, `completed_dispatches`, `flex_planned_dispatches` (4) | Each is an array of 48 half-hour slots or N dispatches. Exposing each row as an MQTT entity would clutter the registry. The `_count` summary entity exists; consume the full array via templates / `apexcharts-card` for visualisation. |
256
- | Pending controls | `pending_limit`, `pending_time` (2) | The number/select control entities (`Target Charge`, `Ready By`) render the pending value through their own `value_template`. No separate sensor entity needed. |
257
- | Import rate adjacency | `applicable_rates_prev_pence`, `_prev_gbp`, `_prev_to`, `_next_pence`, `_next_gbp`, `_next_from` (6) | Available in `msg.payload` for templates / dashboards. Export equivalents (`electricity_export_rate_prev_*` / `_next_*`) ARE exposed as MQTT entities — the inconsistency is intentional pending v1.4 promotion. |
258
- | Cost placeholders | `electricity_consumption_cost`, `gas_consumption_cost` (2) | Reserved for future cost-calculation feature (consumption × rate). Always `null` in v1.3. |
259
- | Vestigial | `saving_session_points` (1) | Octopus moved loyalty points out of saving sessions into the Octoplus query. The payload field remains for backward compatibility but is always `null`; use `binary_sensor.octopus_intelligent_octopus_octoplus_loyalty_points` instead. |
260
-
261
- **Implication for HA users:** every value you might want to display is reachable. Direct values use the MQTT entity. Adjacent-slot import rates require an MQTT template sensor reading from `applicable_rates_prev_pence` etc. (or use the Node-RED debug node to inspect the full payload).
262
-
263
- **Why the import / export asymmetry?** Phase 2 of v1.3.0 added the full export rate ecosystem as new MQTT entities. The pre-existing import prev/next fields were added in v1.0 as payload-only and weren't promoted at the time. Promoting them is straightforward but was descoped from v1.3 to keep release scope tight; tracked for v1.4.
264
-
265
- ### Controls
266
-
267
- Interactive entities that accept commands. **Timezone** and **Smart Charging** still carry the HA `entity_category: config` flag (they ARE user-configurable, so the category is semantically correct).
268
-
269
- | Name | Description |
270
- |---|---|
271
- | Octopus Target Charge | Slider (50–100%) — set desired battery charge level; shows the pending value until applied |
272
- | Octopus Ready Time | Dropdown (04:00–11:00) — time by which the car must be ready |
273
- | Octopus Apply Changes | Submit pending limit/time changes to the Octopus API |
274
- | Octopus Refresh API | Force an immediate API refresh (30-second cooldown enforced) |
275
- | Timezone | Display timezone for all slot and window times — 15 IANA options; persists across Node-RED restarts |
276
- | Smart Charging | Enable (unsuspend) or disable (suspend) Octopus intelligent charging |
277
-
278
- ### Binary Sensors
279
-
280
- | Name | Description |
281
- |---|---|
282
- | Octopus Charging Now | `ON` while the EV is actively inside a dispatch charging slot |
283
- | Octopus Saving Session Available | `ON` if a saving session is upcoming or joinable |
284
- | Octopus Free Electricity Active | `ON` while a free electricity window is in progress right now |
285
- | Octopus Free Electricity Available | `ON` if a free electricity window is scheduled in the future |
286
- | Octopus Octoplus Enrolled | `ON` if the account is enrolled in Octoplus |
287
- | Octopus Octoplus Loyalty Points | `ON` if the account participates in Octoplus loyalty points (boolean flag from the API) |
288
-
289
- ### Main Sensors — EV Charging
290
-
291
- | Name | Description |
292
- |---|---|
293
- | Octopus Confirmed Charge Limit | API-confirmed target charge percentage — last setting accepted by Octopus |
294
- | Octopus Confirmed Ready Time | API-confirmed ready time — last setting accepted by Octopus |
295
- | Octopus Next Charge Time | Start time of the next planned charging slot (display timezone) |
296
- | Octopus Total Planned Energy | Total kWh across all upcoming planned dispatch slots |
297
- | Octopus Next Slot Energy | Energy (kWh) scheduled for the next individual slot |
298
- | Octopus Charge Source | Source of next charge: `smart-charge` (scheduled by Octopus algorithm) or `bump-charge` (car plugged in outside schedule) |
299
- | Octopus Slot 1 Start | Start time of planned slot 1 |
300
- | Octopus Slot 1 End | End time of planned slot 1 |
301
- | Octopus Slot 2 Start | Start time of planned slot 2 (`null` if fewer than 2 slots) |
302
- | Octopus Slot 2 End | End time of planned slot 2 |
303
- | Octopus Slot 3 Start | Start time of planned slot 3 (`null` if fewer than 3 slots) |
304
- | Octopus Slot 3 End | End time of planned slot 3 |
305
- | Octopus Overall Window Start | Start of the first planned slot — when the charging window opens |
306
- | Octopus Overall Window End | End of the last planned slot — when the charging window closes |
307
- | Octopus Completed Dispatches | Count of completed intelligent dispatch sessions on record |
308
- | Octopus Flex Planned Dispatches | Count of upcoming flex dispatch slots |
309
-
310
- ### Main Sensors — Electricity (Import)
311
-
312
- | Name | Description |
313
- |---|---|
314
- | Octopus Electricity Standing Charge | Daily electricity standing charge (p/day) from current tariff |
315
- | Octopus Electricity Consumption | Electricity consumed in the previous day (kWh) from the import meter |
316
- | Octopus Current Electricity Rate | Live unit rate (p/kWh) from the 24h applicable rates schedule — use this on half-hourly tariffs (e.g. Intelligent Octopus Go) instead of Electricity Unit Rate |
317
- | Octopus Electricity Rate | Live unit rate in GBP/kWh — measurement state class, ready for the HA Energy Dashboard |
318
- | Octopus Electricity Unit Rate | Fixed unit rate (p/kWh) — `null` on half-hourly tariffs |
319
- | Octopus Electricity Tariff Code | Current import tariff product code |
320
- | Octopus Electricity Tariff Valid From / Valid To | Validity window of the current import tariff (`Valid To` is `null` for open-ended tariffs) |
321
-
322
- ### Main Sensors — Electricity (Export)
323
-
324
- | Name | Description |
325
- |---|---|
326
- | Octopus Electricity Export Standing Charge | Daily export standing charge (p/day) — typically `0` for Agile Outgoing |
327
- | Octopus Electricity Export Consumption | Electricity exported to the grid in the previous day (kWh) from the export meter |
328
- | Octopus Current Electricity Export Rate | Live export rate (p/kWh) for the current half-hour slot |
329
- | Octopus Electricity Export Rate | Live export rate (GBP/kWh) — measurement state class |
330
- | Octopus Electricity Export Unit Rate | Fixed unit rate — `null` on half-hourly export tariffs (e.g. Agile Outgoing) |
331
- | Octopus Electricity Export Tariff Code | Current export tariff product code (e.g. `AGILE-OUTGOING-19-05-13`) |
332
- | Octopus Electricity Export Tariff Valid From / Valid To | Validity window of the current export tariff |
333
-
334
- ### Main Sensors — Gas
335
-
336
- | Name | Description |
337
- |---|---|
338
- | Octopus Gas Standing Charge | Daily gas standing charge (p/day) from current tariff |
339
- | Octopus Gas Consumption | Gas consumed in the previous day (kWh) |
340
- | Octopus Gas Unit Rate | Gas unit rate (p/kWh) |
341
- | Octopus Gas Tariff Code | Gas product code |
342
- | Octopus Gas Tariff Valid From / Valid To | Validity window of the current gas tariff |
343
-
344
- ### Main Sensors — Account & Rewards
345
-
346
- | Name | Description |
347
- |---|---|
348
- | Octopus Account Balance | Current account credit or debit balance (£) |
349
- | Octopus Saving Session Joined | Whether you have joined the current saving session campaign |
350
- | Octopus WoF Electricity Spins | Wheel of Fortune electricity spins remaining (opt-in) |
351
- | Octopus WoF Gas Spins | Wheel of Fortune gas spins remaining (opt-in) |
352
-
353
- ### Main Sensors — Home Mini
354
-
355
- | Name | Description |
356
- |---|---|
357
- | Octopus Home Mini Demand | Real-time grid import in kW — requires Octopus Home Mini and opt-in checkbox in node config |
358
- | Octopus Home Mini Period Consumption | Energy consumed in the current half-hour period (kWh) |
359
-
360
- ### Main Sensors — Account, Octoplus, Rewards (continued)
361
-
362
- The following appear in the main device entity list (not the Diagnostics tab):
363
-
364
- | Name | Description |
365
- |---|---|
366
- | Octopus Octoplus Status | Octoplus enrollment status string (e.g. `ENROLLED`) |
367
- | Octopus Saving Session Start / End | Start and end of the next saving session (`null` outside October–March) |
368
- | Octopus Free Electricity Start / End | Start and end of the next free electricity window (`null` outside the active period) |
369
-
370
- ### Diagnostic Sensors
371
-
372
- Appears under the **Diagnostics** tab of the HA device card.
373
-
374
- #### Polling & Refresh
375
-
376
- | Name | Description |
377
- |---|---|
378
- | Octopus Next Poll Time | Timestamp of the next scheduled automatic API refresh |
379
- | Octopus Refresh Available At | Timestamp when the manual refresh cooldown expires (`null` = available now) |
380
-
381
- #### API Usage
382
-
383
- | Name | Description |
384
- |---|---|
385
- | Octopus API Requests (Last Hour) | Number of API calls made in the last 60 minutes |
386
- | Octopus API Complexity (Last Hour) | Total estimated GraphQL complexity used in the last hour |
387
- | Octopus API Complexity Usage | Percentage of the 50,000/hour GraphQL complexity limit consumed |
388
-
389
- #### Raw Timestamps (UTC)
390
-
391
- Exact UTC strings from the API, unaffected by timezone settings. Use these when you need unambiguous UTC values in automations.
392
-
393
- | Name | Description |
394
- |---|---|
395
- | Octopus Next Charge Time (Raw) | Next charge time — exact UTC string from API |
396
- | Octopus Next Poll Time (Raw) | Next poll time — exact UTC string |
397
- | Octopus Slot 1 Start (Raw) | Slot 1 start — exact UTC from API |
398
- | Octopus Slot 1 End (Raw) | Slot 1 end — exact UTC from API |
399
- | Octopus Slot 2 Start (Raw) | Slot 2 start — exact UTC from API |
400
- | Octopus Slot 2 End (Raw) | Slot 2 end — exact UTC from API |
401
- | Octopus Slot 3 Start (Raw) | Slot 3 start — exact UTC from API |
402
- | Octopus Slot 3 End (Raw) | Slot 3 end — exact UTC from API |
403
- | Octopus Overall Window Start (Raw) | Window start — exact UTC from API |
404
- | Octopus Overall Window End (Raw) | Window end — exact UTC from API |
405
-
406
- #### Server-Timezone Timestamps (Locale)
407
-
408
- Times in the Node-RED server's auto-detected timezone. Unlike display fields, these are never affected by the Timezone selector or `set_timezone` command.
409
-
410
- | Name | Description |
411
- |---|---|
412
- | Octopus Next Charge Time (Locale) | Next charge time in Node-RED server timezone |
413
- | Octopus Slot 1 Start (Locale) | Slot 1 start in server timezone |
414
- | Octopus Slot 1 End (Locale) | Slot 1 end in server timezone |
415
- | Octopus Slot 2 Start (Locale) | Slot 2 start in server timezone |
416
- | Octopus Slot 2 End (Locale) | Slot 2 end in server timezone |
417
- | Octopus Slot 3 Start (Locale) | Slot 3 start in server timezone |
418
- | Octopus Slot 3 End (Locale) | Slot 3 end in server timezone |
419
- | Octopus Overall Window Start (Locale) | Window start in server timezone |
420
- | Octopus Overall Window End (Locale) | Window end in server timezone |
421
- | Octopus Timezone Detected | IANA timezone auto-detected from the Node-RED server (e.g. `Europe/London`) |
422
- | Octopus Timezone Applied | Active timezone currently used for all display timestamp fields |
423
-
424
- #### Consumption Metadata
425
-
426
- | Name | Description |
427
- |---|---|
428
- | Octopus Electricity Consumption From | Start of the electricity (import) consumption measurement period |
429
- | Octopus Electricity Consumption To | End of the electricity (import) consumption measurement period |
430
- | Octopus Electricity Export Consumption From | Start of the export consumption measurement period |
431
- | Octopus Electricity Export Consumption To | End of the export consumption measurement period |
432
- | Octopus Gas Consumption From | Start of the gas consumption measurement period |
433
- | Octopus Gas Consumption To | End of the gas consumption measurement period |
434
-
435
- #### Applicable Rates — Import + Export
436
-
437
- | Name | Description |
438
- |---|---|
439
- | Octopus Applicable Rates Slots | Number of import rate slots in the current 24-hour window |
440
- | Octopus Electricity Export Rate Slots | Number of export rate slots in the current 24-hour window |
441
- | Octopus Electricity Export Rate Prev | Previous half-hour export rate (p/kWh) |
442
- | Octopus Electricity Export Rate Prev Ends | Timestamp when the previous export slot ended |
443
- | Octopus Electricity Export Rate Next | Next half-hour export rate (p/kWh) |
444
- | Octopus Electricity Export Rate Next From | Timestamp when the next export slot begins |
445
-
446
- #### Error & Detail Sensors
447
-
448
- `null` = healthy. Non-null = the last error message from that API category.
449
-
450
- | Name | Description |
451
- |---|---|
452
- | Octopus Electricity Rates Error | Last error fetching electricity rates |
453
- | Octopus Electricity Consumption Error | Last error fetching electricity consumption |
454
- | Octopus Gas Rates Error | Last error fetching gas rates |
455
- | Octopus Gas Consumption Error | Last error fetching gas consumption |
456
- | Octopus Applicable Rates Error | Last error fetching the import applicable rates schedule |
457
- | Octopus Electricity Export Rate Error | Last error fetching the export applicable rates schedule |
458
- | Octopus Account Balance (Pence) | Account balance in pence (raw integer) |
459
- | Octopus Account Error | Last error fetching account data |
460
- | Octopus Octoplus Error | Last error fetching Octoplus data |
461
- | Octopus WoF Electricity Max | Maximum Wheel of Fortune electricity spins allowed per period |
462
- | Octopus WoF Electricity Used | Wheel of Fortune electricity spins used this period |
463
- | Octopus WoF Gas Max | Maximum Wheel of Fortune gas spins allowed per period |
464
- | Octopus WoF Gas Used | Wheel of Fortune gas spins used this period |
465
- | Octopus WoF Error | Last error fetching Wheel of Fortune data |
466
- | Octopus Home Mini Reading Time | Timestamp of the most recent Home Mini telemetry reading |
467
- | Octopus Home Mini Error | Last error fetching Home Mini data |
468
- | Octopus Saving Sessions Error | Last error fetching saving sessions data |
469
- | Octopus Free Electricity Error | Last error fetching free electricity data |
470
- | Octopus Completed Dispatches Error | Last error fetching completed dispatch history |
471
- | Octopus Flex Planned Dispatches Error | Last error fetching flex planned dispatch schedule |
472
- | Octopus Intelligent Error | Last error from the intelligent charging (EV slots) query |
473
-
474
- ---
475
-
476
- ## 🆓 Free Electricity & Seasonal Sensors
477
-
478
- Octopus Energy runs free electricity sessions (typically June–October) and saving sessions (typically October–March). The node polls for both and exposes binary sensors for automation use.
479
-
480
- ### Free Electricity
481
- - **`binary_sensor.octopus_free_electricity_active`** — `ON` while a free window is in progress right now
482
- - **`binary_sensor.octopus_free_electricity_available`** — `ON` if an upcoming free window is scheduled
483
-
484
- Use these to automatically start charging your car or battery when electricity is free:
485
-
486
- ```yaml
487
- automation:
488
- - alias: "Charge during free electricity"
489
- trigger:
490
- platform: state
491
- entity_id: binary_sensor.octopus_free_electricity_active
492
- to: "on"
493
- action:
494
- service: switch.turn_on
495
- target:
496
- entity_id: switch.battery_charger
497
- ```
498
-
499
- ### Saving Sessions
500
- - **`binary_sensor.octopus_saving_session_available`** — `ON` if a saving session is upcoming
501
- - **`sensor.octopus_saving_session_start`** / **`sensor.octopus_saving_session_end`** — start and end times
502
-
503
- ### Why These Sensors Are Null Outside Season
504
-
505
- The Octopus API only returns free electricity and saving session data when those programmes are active. Outside their respective seasons the API returns an empty list (or in the case of saving sessions, the query itself is unavailable). The node handles this gracefully:
506
-
507
- - Binary sensors remain `OFF` (not `unavailable`)
508
- - Timestamp sensors (`saving_session_start`, `free_electricity_start`, etc.) return `null`
509
- - In Home Assistant, `null`-valued configuration sensors may show as **unavailable** — this is normal and expected
510
-
511
- ---
512
-
513
- ## 🌍 Timezone Configuration
514
-
515
- By default, slot and window times are converted to the **server's auto-detected timezone** (wherever Node-RED is running). Three ways to configure:
516
-
517
- ### Option 1: Node Config (static)
518
- Set a fixed IANA timezone in the node editor:
519
- - Open node → **Timezone** field → type `Australia/Sydney`
520
- - Leave blank to use server auto-detect
521
-
522
- ### Option 2: Home Assistant Select (dynamic, persists across restarts)
523
- Use the **Timezone** select entity in Home Assistant:
524
- - Home Assistant → Octopus Intelligent device → Timezone
525
- - Change takes effect on next poll
526
- - Persists across Node-RED restarts
527
-
528
- ### Option 3: `set_timezone` Input Command
529
- ```javascript
530
- msg.payload = { set_timezone: "Europe/London" };
531
- // Send to Octopus Intelligent node input
532
- ```
533
-
534
- ### Timestamp Tiers
535
- | Field suffix | Timezone | Configurable? |
536
- |---|---|---|
537
- | `*_raw` | Always UTC (exact API string) | Never |
538
- | `*_locale` | Server auto-detected | Never (always server TZ) |
539
- | Display fields (`slot1_start`, `window_start`, etc.) | Resolved TZ | Yes — via HA, config, or command |
540
-
541
- ### Supported Timezones (HA select)
542
- `Europe/London`, `Europe/Berlin`, `Europe/Madrid`, `Australia/Sydney`, `Australia/Melbourne`, `Australia/Brisbane`, `Australia/Perth`, `Australia/Adelaide`, `Pacific/Auckland`, `America/New_York`, `America/Chicago`, `America/Denver`, `America/Los_Angeles`, `Asia/Tokyo`, `UTC`
543
-
544
- Any valid IANA timezone works in the node config field or `set_timezone` command.
545
-
546
- ---
547
-
548
- ## 💡 Node-RED Usage
549
-
550
- ### Basic Monitoring
551
-
552
- ```
553
- [Inject: Every 5 min] → [Octopus Intelligent] → [Debug]
554
- ```
555
-
556
- ### Set Preferences from Flow
557
-
558
- ```javascript
559
- msg.payload = {
560
- set_limit: 85, // 85% charge
561
- set_time: "07:30" // Ready by 07:30
562
- };
563
- return msg;
564
- ```
565
-
566
- ### Set Timezone from Flow
567
-
568
- ```javascript
569
- msg.payload = { set_timezone: "Australia/Sydney" };
570
- return msg;
571
- ```
572
-
573
- ### Toggle Smart Charging from Flow
574
-
575
- ```javascript
576
- msg.payload = { set_smart_charging: true }; // enable (unsuspend)
577
- msg.payload = { set_smart_charging: false }; // disable (suspend)
578
- return msg;
579
- ```
580
-
581
- **Example: suspend charging when home battery is in use**
582
- ```
583
- [Inject: suspend] → [Function: set_smart_charging=false] → [Octopus Intelligent]
584
- [Inject: resume] → [Function: set_smart_charging=true] → [Octopus Intelligent]
585
- ```
586
-
587
- ### Output Format
588
-
589
- ```json
590
- {
591
- "payload": {
592
- "next_start": "2026-05-03 01:30:00+01:00",
593
- "total_energy": 42.5,
594
- "next_kwh": "15.20",
595
- "next_source": "smart-charge",
596
- "confirmed_limit": 80,
597
- "confirmed_time": "07:00",
598
- "pending_limit": 80,
599
- "pending_time": "07:00",
600
- "charging_now": false,
601
- "smart_charging": true,
602
- "next_poll": "2026-05-03T10:35:00Z",
603
- "refresh_available_at": null,
604
- "api_requests_hour": 12,
605
- "api_complexity_hour": 3600,
606
- "api_complexity_percent": 7.2,
607
- "slot1_start": "2026-05-03 01:30:00+01:00",
608
- "slot1_end": "2026-05-03 05:30:00+01:00",
609
- "slot2_start": null,
610
- "slot2_end": null,
611
- "slot3_start": null,
612
- "slot3_end": null,
613
- "window_start": "2026-05-03 01:30:00+01:00",
614
- "window_end": "2026-05-03 05:30:00+01:00",
615
- "timezone_detected": "Europe/London",
616
- "timezone_applied": "Europe/London",
617
- "next_start_locale": "2026-05-03 01:30:00+01:00",
618
- "slot1_start_locale": "2026-05-03 01:30:00+01:00",
619
- "slot1_end_locale": "2026-05-03 05:30:00+01:00",
620
- "window_start_locale": "2026-05-03 01:30:00+01:00",
621
- "window_end_locale": "2026-05-03 05:30:00+01:00",
622
- "completed_dispatches_count": 3,
623
- "completed_dispatches_error": null,
624
- "flex_planned_dispatches_count": 1,
625
- "flex_planned_dispatches_error": null,
626
- "intelligent_error": null,
627
- "electricity_unit_rate": null,
628
- "electricity_standing_charge": 53.94,
629
- "electricity_tariff_code": "E-1R-INTELLI-VAR-22-01-01-A",
630
- "electricity_valid_from": "2022-01-01T00:00:00Z",
631
- "electricity_valid_to": null,
632
- "electricity_consumption_kwh": 8.4,
633
- "electricity_consumption_from": "2026-05-02T00:00:00Z",
634
- "electricity_consumption_to": "2026-05-03T00:00:00Z",
635
- "electricity_rates_error": null,
636
- "electricity_consumption_error": null,
637
- "applicable_rates_count": 28,
638
- "applicable_rates_current_pence": 10.33,
639
- "applicable_rates_error": null,
640
- "gas_unit_rate": 6.24,
641
- "gas_standing_charge": 31.05,
642
- "gas_tariff_code": "G-1R-VAR-22-11-01-A",
643
- "gas_valid_from": "2022-11-01T00:00:00Z",
644
- "gas_valid_to": null,
645
- "gas_consumption_kwh": 12.1,
646
- "gas_consumption_from": "2026-05-02T00:00:00Z",
647
- "gas_consumption_to": "2026-05-03T00:00:00Z",
648
- "gas_rates_error": null,
649
- "gas_consumption_error": null,
650
- "account_balance_pence": 10900,
651
- "account_balance_pounds": 109,
652
- "account_error": null,
653
- "octoplus_enrolled": true,
654
- "octoplus_enrollment_status": "ENROLLED",
655
- "octoplus_loyalty_points_user": true,
656
- "octoplus_error": null,
657
- "wheel_of_fortune_electricity_spins": 2,
658
- "wheel_of_fortune_electricity_max": 3,
659
- "wheel_of_fortune_electricity_used": 1,
660
- "wheel_of_fortune_gas_spins": 1,
661
- "wheel_of_fortune_gas_max": 1,
662
- "wheel_of_fortune_gas_used": 0,
663
- "wheel_of_fortune_error": null,
664
- "mini_demand_kw": 0.082,
665
- "mini_consumption_delta_kwh": 0.002,
666
- "mini_read_at": "2026-05-03T10:00:00Z",
667
- "home_mini_error": null,
668
- "saving_session_available": false,
669
- "saving_session_start": null,
670
- "saving_session_end": null,
671
- "saving_session_joined": false,
672
- "saving_session_points": null,
673
- "saving_sessions_error": null,
674
- "free_electricity_active": false,
675
- "free_electricity_available": false,
676
- "free_electricity_start": null,
677
- "free_electricity_end": null,
678
- "free_electricity_error": null
679
- },
680
- "debug": {
681
- "success": true,
682
- "step": "complete",
683
- "apiCalls": [
684
- {"name": "authentication", "tokenObtained": true},
685
- {"name": "intelligent", "slotsFound": 1},
686
- {"name": "electricity_rates", "success": true},
687
- {"name": "electricity_consumption", "success": true},
688
- {"name": "gas_rates", "success": true},
689
- {"name": "gas_consumption", "success": true},
690
- {"name": "home_mini", "success": true},
691
- {"name": "account", "success": true}
692
- ]
693
- }
694
- }
695
- ```
696
-
697
- > **Note:** `electricity_unit_rate` is `null` for half-hourly tariffs (e.g. Intelligent Octopus Go). Use `applicable_rates_current_pence` for the live rate on HH tariffs.
698
-
699
- > **v1.3.0 additions:** The example above shows the v1.2.x payload shape for clarity. v1.3.0 adds ~14 additional fields covering electricity export (`electricity_export_unit_rate`, `electricity_export_tariff_code`, `electricity_export_consumption_kwh`, full `electricity_export_rate[]` half-hourly array with current/prev/next slot summaries) and import rate adjacency (`applicable_rates_prev_pence`, `_prev_gbp`, `_prev_to`, `_next_pence`, `_next_gbp`, `_next_from`). For the authoritative current set, inspect `msg.payload` in a Debug node after a real poll, or read `lib/payload.js` in the source.
700
-
701
- ---
702
-
703
- ## 🏡 Home Assistant Automation Examples
704
-
705
- ### Notify When Charging Starts
706
-
707
- ```yaml
708
- automation:
709
- - alias: "EV Charging Starting"
710
- trigger:
711
- platform: state
712
- entity_id: binary_sensor.octopus_charging_now
713
- to: "on"
714
- action:
715
- service: notify.mobile_app
716
- data:
717
- message: "EV charging started"
718
- ```
719
-
720
- ### Charge During Free Electricity Window
721
-
722
- ```yaml
723
- automation:
724
- - alias: "Start battery charge on free electricity"
725
- trigger:
726
- platform: state
727
- entity_id: binary_sensor.octopus_free_electricity_active
728
- to: "on"
729
- action:
730
- service: switch.turn_on
731
- target:
732
- entity_id: switch.battery_charger
733
- - alias: "Stop battery charge after free electricity"
734
- trigger:
735
- platform: state
736
- entity_id: binary_sensor.octopus_free_electricity_active
737
- to: "off"
738
- action:
739
- service: switch.turn_off
740
- target:
741
- entity_id: switch.battery_charger
742
- ```
743
-
744
- ### Run Dishwasher During Cheap Rate
745
-
746
- ```yaml
747
- automation:
748
- - alias: "Dishwasher During Cheap Window"
749
- trigger:
750
- platform: time_pattern
751
- minutes: "/5"
752
- condition:
753
- - condition: template
754
- value_template: >
755
- {% set start = as_timestamp(states('sensor.octopus_slot_1_start')) %}
756
- {% set end = as_timestamp(states('sensor.octopus_slot_1_end')) %}
757
- {% set now = as_timestamp(now()) %}
758
- {{ start <= now <= end }}
759
- action:
760
- service: switch.turn_on
761
- target:
762
- entity_id: switch.dishwasher
763
- ```
764
-
765
- ### Alert When Saving Session Available
766
-
767
- ```yaml
768
- automation:
769
- - alias: "Saving session alert"
770
- trigger:
771
- platform: state
772
- entity_id: binary_sensor.octopus_saving_session_available
773
- to: "on"
774
- action:
775
- service: notify.mobile_app
776
- data:
777
- message: >
778
- Saving session available:
779
- {{ states('sensor.octopus_saving_session_start') }}
780
- to {{ states('sensor.octopus_saving_session_end') }}
781
- ```
782
-
783
- ---
784
-
785
- ## 🔍 Troubleshooting
786
-
787
- ### No Data (All Sensors Null/0)
788
-
789
- Check `msg.debug` output in a Debug node:
790
-
791
- - Account format must include `A-` prefix
792
- - Invalid API key — regenerate at Octopus dashboard
793
- - Not on a recognised Octopus tariff (EV sensors require Intelligent Octopus Go)
794
- - Car not plugged in (no slots scheduled) — EV sensors null is normal when no charging is planned
795
-
796
- ### Authentication Failing
797
-
798
- Check `msg.debug.apiCalls[0].errors` for details. Regenerate your API key and update the node configuration.
799
-
800
- ### Sensors Unavailable in Home Assistant
801
-
802
- 1. Verify MQTT broker is running
803
- 2. Check Node-RED can connect to MQTT broker
804
- 3. Deploy the flow to trigger discovery
805
- 4. Confirm Home Assistant MQTT integration is enabled
806
-
807
- ### electricity_unit_rate Always Null
808
-
809
- This is expected on half-hourly tariffs like Intelligent Octopus Go. The tariff has no single unit rate — prices vary by half-hour slot. Use `applicable_rates_current_pence` for the live rate instead.
810
-
811
- ### Upgrading from v1.2.x — Sensors Look Different
812
-
813
- v1.3.0 adds ~70 new sensors but does not rename or remove any v1.2 sensors. Existing automations and dashboards continue working unchanged. New sensors appear automatically in Home Assistant after the first poll following upgrade.
814
-
815
- Two existing Octoplus booleans (`octoplus_enrolled` and `octoplus_loyalty_points_user`) move from the `sensor.` domain to `binary_sensor.` in v1.3 because they are boolean values and HA's sensor domain doesn't accept booleans cleanly. If you have automations referencing the old `sensor.` entity IDs, update them to the new `binary_sensor.` IDs after upgrade.
816
-
817
- ### Stale Entities After Early v1.3 Dev Build
818
-
819
- If you installed an early v2 build before final release, some entity IDs may have changed. To clean up stale entities:
820
-
821
- 1. In HA → **Settings → Devices & Services → MQTT**
822
- 2. Find each stale entity name in Developer Tools → MQTT
823
- 3. Publish an **empty retained payload** to its config topic:
824
- ```
825
- Topic: homeassistant/sensor/nodered_A-XXXX_<entity_id>/config
826
- Payload: (empty)
827
- Retain: ✓
828
- ```
829
- This removes the entity from the broker — HA drops it automatically.
830
-
831
- ### Home Mini Not Showing
832
-
833
- 1. Tick **Enable Home Mini** in node config
834
- 2. Verify your Octopus account has a smart meter registered (visible in the Octopus app)
835
- 3. Check `msg.payload.home_mini_error` in a debug node for the specific error
836
-
837
- ### New Category Sensors All Null After Deploy
838
-
839
- Account discovery runs once at startup. If it fails, check `msg.debug` for auth errors, verify your API key, and redeploy.
840
-
841
- ### Seasonal Sensors Show "Unavailable"
842
-
843
- Saving session sensors are only populated October–March. Free electricity sensors are only populated June–October. Outside season, `null` values cause these sensors to show as unavailable in HA — this is correct behaviour, not a bug.
844
-
845
- ### Changes Not Applying
846
-
847
- This is by design. Use the **Apply Changes** button to submit. This prevents API spam when making multiple adjustments.
848
-
849
- ---
850
-
851
- ## 🛠️ How It Works
852
-
853
- ### Startup — Account Discovery
854
-
855
- On first deploy, the node queries the Octopus API to detect which products are registered on your account:
856
-
857
- - **Electricity** — always enabled if an electricity agreement exists
858
- - **Gas** — enabled if a gas agreement exists
859
- - **Intelligent EV** — enabled if an EV device is registered (Intelligent Octopus Go)
860
- - **Home Mini** — enabled if a smart meter device is registered AND the Home Mini checkbox is ticked
861
- - **Wheel of Fortune / Saving Sessions / Account** — always polled if credentials are valid
862
-
863
- Discovery sets which categories are active. No manual configuration required.
864
-
865
- ### Category Scheduler
866
-
867
- Each data category polls on its own interval (configurable per category in the node editor). A 1-second clock-aligned scheduler checks which categories are due each tick. Categories poll independently — a slow gas API response does not delay your EV slot update.
868
-
869
- ### Authentication Flow
870
-
871
- 1. **Exchange API key** for a short-lived token
872
- 2. **Run category polls** in parallel — each category makes its own GraphQL query
873
- 3. **Merge results** into a single payload object
874
- 4. **Publish** to Node-RED output + MQTT state topic
875
-
876
- ### Exponential Backoff (preference changes)
877
-
878
- When changing charge limit or ready time:
879
-
880
- ```
881
- Mutation sent → Wait 15s → Validate
882
- ↓ Not confirmed yet?
883
- → Wait 30s → Validate
884
- ↓ Not confirmed yet?
885
- → Wait 60s → Validate
886
- ↓ Not confirmed yet?
887
- → Wait 120s → Final check
888
- ↓ Then normal interval resumes
889
- ```
890
-
891
- This prevents sensors becoming "unavailable" during updates.
892
-
893
- ### Debug Information
894
-
895
- Every message includes `msg.debug`:
896
-
897
- ```json
898
- {
899
- "timestamp": "2026-05-03T10:30:00Z",
900
- "success": true,
901
- "step": "complete",
902
- "apiCalls": [
903
- {"name": "authentication", "tokenObtained": true},
904
- {"name": "intelligent", "slotsFound": 1}
905
- ]
906
- }
907
- ```
908
-
909
- ---
910
-
911
- ## 📝 License
912
-
913
- MIT License - Copyright (c) 2025 Andrew Somerharju Neale
914
-
915
- See [LICENSE](LICENSE) file for full details.
916
-
917
- ---
918
-
919
- ## ⚠️ Disclaimer
920
-
921
- This is an **unofficial integration** and is not affiliated with, endorsed by, or connected to Octopus Energy Ltd.
922
-
923
- Use at your own risk. The Octopus Energy name and logo are trademarks of Octopus Energy Ltd.
924
-
925
- ---
926
-
927
- ## 🔗 Links
928
-
929
- - **npm**: https://www.npmjs.com/package/node-red-contrib-octopus-intelligent
930
- - **GitHub**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent
931
- - **Issues**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues
932
- - **Octopus Intelligent**: https://octopus.energy/intelligent/
933
- - **API Docs**: https://developer.octopus.energy/docs/api/
934
-
935
- ---
936
-
937
- ## 📜 Changelog
938
-
939
- See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
940
-
941
- ### v1.3.0 (2026-05-12)
942
-
943
- Major additive release — full consumer read coverage. No breaking changes; all v1.2.x entity IDs, payload fields, and automations continue working unchanged.
944
-
945
- **New read categories:**
946
- - **Electricity import** — live unit rate, standing charge, tariff code + validity dates, daily consumption, half-hourly applicable rates (current / prev / next), GBP/kWh rate for Energy Dashboard
947
- - **Electricity export** — full read parity with import: live export rate, standing charge, tariff code (e.g. `AGILE-OUTGOING-19-05-13`), validity dates, daily export consumption, half-hourly export rate slots (48 entries), prev / next slot rates and transition timestamps
948
- - **Gas** — unit rate, standing charge, tariff code + validity, daily consumption (account-conditional)
949
- - **Octopus Home Mini** — real-time grid demand (kW), half-hour consumption (kWh), last reading timestamp
950
- - **Saving sessions** — upcoming session start/end, joined status (now read from `api.backend.octopus.energy`)
951
- - **Free electricity** — upcoming/active session detection, binary sensors for automation
952
- - **Wheel of Fortune** — electricity and gas spin counts (now using non-deprecated `wheelOfFortuneSpinsAllowed` on backend endpoint)
953
- - **Account balance** — credit/debit in £ and pence
954
- - **Octoplus** — enrollment status (string) + enrolled and loyalty-points-user booleans
955
-
956
- **Bug fixes carried in alongside the additive work:**
957
- - **Import / export meter point selection** — meter point selection now uses the `direction` field, not array position. Earlier dev builds on accounts with both import + export meters could surface export data as if it were import (live "current rate" showing the export Agile rate instead of the import tariff). Fixed before release; no stable v1.x build was affected.
958
- - **MQTT transport** — added `User-Agent` header required by `api.backend.octopus.energy`. Without it the backend returns 403 at the edge, which surfaced as "WoF returns HTML" / saving sessions silently broken.
959
- - **MQTT discovery for boolean sensors** — `octoplus_enrolled` and `octoplus_loyalty_points_user` were previously published to the `sensor` MQTT domain; HA's sensor handler doesn't accept raw boolean values cleanly, so the entities never registered on some installs. Now published as `binary_sensor` — registers reliably.
960
- - **MQTT discovery for read-only info sensors** — removed `entity_category: config` from tariff codes, validity dates, etc. That category is intended for user-configurable entities; on read-only sensors HA's state handling caused them to stick at "unavailable". Moved to the main entity list.
961
-
962
- **Backwards compatibility:** zero breaking changes. New entities appear automatically after first poll following upgrade. Existing automations continue unchanged.
963
-
964
- ### v1.2.1 (2026-04-29)
965
- - **Deprecated API migration** — moved to current `devices` query and `setDevicePreferences` mutation
966
-
967
- ### v1.2.0 (2026-04-26)
968
- - **Smart Charging Toggle** — suspend/resume Octopus intelligent charging from Node-RED or Home Assistant
969
- - **HA MQTT Switch** — auto-discovered Smart Charging switch entity
970
- - **`smart_charging` payload field** — live state in every message
971
-
972
- ### v1.0.4 (2025-12-11)
973
- - **Manual Refresh Button** — Force API refresh via Home Assistant with 30s cooldown
974
- - **Next Poll Timer** — See when next automatic refresh occurs
975
- - **API Complexity Monitoring** — Track API usage against 50,000/hour limit
976
- - **Rate Limiting** — MQTT button (30s cooldown), Node-RED input (no limit)
977
-
978
- ---
979
-
980
- **Made with ⚡ for the Octopus Energy & Home Assistant communities**
1
+ # node-red-contrib-octopus-intelligent
2
+
3
+ > Node-RED integration for **Octopus Energy** with automatic Home Assistant MQTT discovery
4
+
5
+ Monitor electricity and gas rates (import + export), EV charging schedules, real-time home energy usage, account balance, saving sessions, and Wheel of Fortune spins. MQTT discovery sets them all up as Home Assistant entities.
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
+ ### 🎮 EV Smart Controls
52
+ - **Target Charge Slider** (5–100%) — Set your desired battery level
53
+ - **Ready Time Dropdown** (any half-hour slot, 00:00–23:30) — When your car needs to be ready. Matches the Octopus app; other values are rejected with an error and nothing is sent to Octopus.
54
+ - **Apply Changes Button** — In Home Assistant, press Apply Changes to send the new target and ready time. A command from a flow is sent at once.
55
+ - **Confirmed Values** — See your current API-validated settings
56
+ - **Smart Charging Toggle** — Suspend or resume Octopus intelligent charging from Node-RED or Home Assistant. Each charging poll reads the current state, so a change made in the Octopus app shows up too.
57
+
58
+ ### ⚡ Real-Time Charging Data
59
+ - **Next Charge Time** — When your next slot starts
60
+ - **Total Planned Energy** — Total kWh across all upcoming slots
61
+ - **Individual Slot Times** — Up to 3 slots with start/end times
62
+ - **Charging Window** — Overall window from first to last slot
63
+ - **Charge Source** — Smart-charge vs bump-charge indicator
64
+ - **Completed Dispatches** — History of completed intelligent charging sessions
65
+ - **Flex Planned Dispatches** — Upcoming flex dispatch schedule
66
+
67
+ ### 🔌 Electricity & Gas Rates
68
+ - **Live Unit Rate** — Current electricity rate (p/kWh) and gas rate (p/kWh)
69
+ - **Standing Charges** — Daily standing charges for electricity and gas
70
+ - **Tariff Code** — Your current tariff identifier and validity dates
71
+ - **Recent Consumption** — Previous day kWh for electricity (import + export) and gas
72
+ - **Current Rate Slot** — Live rate from your 24h applicable rates schedule
73
+ - **Previous / Next Rate** — Adjacent slot rates and transition timestamps
74
+ - **Energy Dashboard Rate** — Electricity rate in GBP/kWh, ready for HA's Energy Dashboard cost tracking
75
+
76
+ ### 🌞 Electricity Export (Solar / Battery)
77
+ - **Export Tariff** — Tariff code, standing charge, validity dates for the OUTGOING agreement
78
+ - **Export Half-Hourly Rates** — Full 48-slot schedule for variable export tariffs (e.g. Agile Outgoing)
79
+ - **Live Export Rate** — Current p/kWh and GBP/kWh
80
+ - **Previous / Next Export Rate** — Adjacent slot rates and transition timestamps
81
+ - **Export Consumption** — Previous day kWh exported to the grid (read from the export meter point)
82
+
83
+ ### 🏠 Home Energy (Octopus Home Mini)
84
+ - **Live Demand** — Real-time grid import in kW
85
+ - **Period Consumption** — Energy consumed in the last half-hour period (kWh)
86
+ - Requires Octopus Home Mini device registered to your account (opt-in)
87
+
88
+ ### 💰 Account & Rewards
89
+ - **Account Balance** — Current credit/debit balance in £
90
+ - **Saving Sessions** — Next session availability, start/end times, joined status, and Octopus Points
91
+ - **Free Electricity** — Upcoming free electricity window detection (active June–October)
92
+ - **Wheel of Fortune** — Remaining electricity and gas spins (opt-in)
93
+ - **Octoplus** — Enrollment status and loyalty points
94
+
95
+ ### 🚗 SmartFlex Vehicle and Inverter
96
+ - **Vehicle Details**: Make, model, battery size, charger power, and what Octopus says the device is doing
97
+ - **Charging Sessions**: Your last 5 sessions, with energy added, final charge, cost, and any problems
98
+ - **Boost Charge**: Start or cancel a boost with `set_boost`
99
+ - **Inverter Data (experimental)**: Solar, home battery, grid, and site power. Off by default.
100
+
101
+ ### 🔧 Advanced Features
102
+ - **Account Discovery** — Automatic product detection at startup; categories auto-enable based on registered products
103
+ - **Per-Category Polling** — Each data group polls on its own schedule. You set some intervals in the editor, and the rest are fixed.
104
+ - **Manual Refresh Button** — Force API refresh from Home Assistant (30s cooldown)
105
+ - **Next Poll Timer** — An estimate of the next automatic refresh
106
+ - **API Usage Tracking** — Monitor requests and complexity in diagnostics
107
+ - **Exponential Backoff** — Smart retry prevents sensor unavailability
108
+ - **Error Fields and Status** — Each data group has its own `*_error` field in `msg.payload`. The node status and the Node-RED log show the rest.
109
+
110
+ ### 🏡 Home Assistant Integration
111
+ - **Zero Configuration** — MQTT auto-discovery sets everything up
112
+ - **Two-Tier Entity Organisation** — Main entities (controls, live rates, consumption, tariff metadata, rewards) and Diagnostics (errors, raw timestamps, API metrics, locale timestamps)
113
+ - **Suggested Area** — Auto-suggests "Energy" area
114
+ - **Reference dashboard YAML** — `examples/ha-dashboard.yaml` covers all controls (including the Smart Charging, Charge Cap, and Boost Charge switches), live values, SmartFlex vehicle cards, and the error state binary sensors in a packed sections layout, ready to paste into HA's Raw Configuration Editor. A few diagnostic sensors and the experimental inverter entities are left out.
115
+ - **Node-RED Dashboard 2.0 example** — `examples/node-red-dashboard-flow.json` is an importable [@flowfuse/node-red-dashboard](https://github.com/FlowFuse/node-red-dashboard) flow whose Controls page has the target limit, all 48 ready-by times, the Smart Charging, Charge Cap, and Boost Charge switches, refresh, and the timezone override. Its Status page shows the SmartFlex vehicle and recent charging sessions.
116
+
117
+ ### 🌍 Timezone Support
118
+ - **Locale Timestamps** (`*_locale` fields) — always in server auto-detected timezone
119
+ - **Resolved Display Fields** — slot and window times in your configured timezone
120
+ - **HA Timezone Select** — change timezone from Home Assistant without redeploying
121
+ - **Node Config Override** — set IANA timezone directly in the node editor
122
+ - **Zero Dependencies** — native `Intl` API, no new packages
123
+
124
+ ---
125
+
126
+ ## 📸 Screenshots
127
+
128
+ ### Node Configuration
129
+
130
+ ![Node Configuration](images/examples/Octopus%20Intelligent%20Node.png)
131
+
132
+ Configure your account credentials, polling intervals, and MQTT broker in the node editor. The MQTT Broker dropdown connects directly to your Home Assistant Mosquitto instance. Per-category intervals set how often the node polls each data source. Electricity and gas rates update hourly by default, while Home Mini polls every minute for live demand.
133
+
134
+ ### Node-RED Flow Example
135
+
136
+ ![Node-RED Flow Example](images/examples/basic-monitoring-flow.png)
137
+
138
+ ### Home Assistant — Dashboard
139
+
140
+ `examples/ha-dashboard.yaml` is a Lovelace dashboard with all controls, live values, and error state binary sensors. A few diagnostic sensors and the experimental inverter entities are left out. Paste it into HA's Raw Configuration Editor to get the layout below. The layout uses HA's sections view and packs cards uniformly across up to 4 columns on wide screens. The EV controls card includes the Smart Charging, Charge Cap, and Boost Charge switches. The SmartFlex vehicle cards hide on accounts without a SmartFlex car or charge point. The screenshots below predate the Charge Cap and Boost Charge switches.
141
+
142
+ #### EV controls, electricity import & export
143
+
144
+ ![Dashboard — EV, electricity import + export](images/examples/home_assistant_dashboard_1_1-3-0.png)
145
+
146
+ EV target slider and ready-time dropdown at top, then live import rate / standing / today's kWh, full import tariff card, half-hourly applicable rates summary, and the same trio for export (live export rate, export tariff, export consumption, half-hourly Agile Outgoing rates).
147
+
148
+ #### Gas, account, rewards, Home Mini
149
+
150
+ ![Dashboard — gas, account, rewards, Home Mini](images/examples/home_assistant_dashboard_2_1-3-0.png)
151
+
152
+ Gas rate / standing / consumption + tariff. Account balance, Octoplus enrolment, Saving Sessions card, Free Electricity card, Wheel of Fortune spins, and the Home Mini live-demand gauge with current half-hour kWh.
153
+
154
+ #### Diagnostics — UTC timestamps, raw timestamps, errors
155
+
156
+ ![Dashboard — diagnostics](images/examples/home_assistant_dashboard_3_1-3-0.png)
157
+
158
+ UTC-class slot/window timestamps (HA renders them as relative "n hours ago"), raw API strings for verbatim debugging, timezone + API usage rows, and a consolidated error panel covering every category.
159
+
160
+ #### Gas — live data from a real account
161
+
162
+ ![Dashboard — gas live data](images/examples/home_assistant_dashboard_working_gas_1-3-0.png)
163
+
164
+ For accounts with a gas meter point, the gas card shows the live tariff code, unit rate (p/kWh), standing charge, daily consumption (kWh), and tariff validity dates. The screenshot shows v1.3.0 reading a real account on the Octopus standard variable gas tariff.
165
+
166
+ #### Seasonal / conditional entities — when they show "Unavailable"
167
+
168
+ | Sensor | Active period | Outside season / condition |
169
+ |---|---|---|
170
+ | Saving Session Start / End | October–March | `null` — no sessions scheduled |
171
+ | Free Electricity Start / End | typically June–October | `null` — no sessions scheduled |
172
+ | Electricity / Gas Tariff Valid To | When tariff has an end date | `null` — open-ended tariff |
173
+ | Gas entities | Only if account has a gas meter point | `null` — electricity-only accounts |
174
+ | Home Mini | Only if a Home Mini device is registered | Entities are still created and stay empty |
175
+ | Electricity Export entities | Only if account has an OUTGOING agreement | Entity values null without an export tariff |
176
+ | EV planned slots / dispatches | Only when a charge is scheduled | `null` between plug-in cycles |
177
+
178
+ This is normal. The node publishes the entity definitions so HA registers them, and the values fill in when the API returns data for that period.
179
+
180
+ ---
181
+
182
+ ## 📋 Requirements
183
+
184
+ - **Node-RED** v2.0+
185
+ - **Octopus Energy Account** — any electricity account works for rates/consumption/account data
186
+ - [Intelligent Octopus Go](https://octopus.energy/intelligent/) tariff required for EV charging features
187
+ - Octopus Home Mini device required for real-time consumption (opt-in)
188
+ - Wheel of Fortune is opt-in and requires an active electricity agreement
189
+ - **API Key** — [Generate here](https://octopus.energy/dashboard/new/accounts/personal-details/api-access)
190
+ - **MQTT Broker** (optional, for Home Assistant integration)
191
+ - **Home Assistant** (optional, for MQTT features)
192
+
193
+ ---
194
+
195
+ ## 🚀 Quick Start
196
+
197
+ ### 1. Install via Node-RED Palette
198
+
199
+ 1. Open Node-RED → **Menu** → **Manage Palette**
200
+ 2. **Install** tab → Search `node-red-contrib-octopus-intelligent`
201
+ 3. Click **Install**
202
+
203
+ ### 2. Get Your Credentials
204
+
205
+ **Account Number** (format: `A-XXXXXXXX`):
206
+ - Found at https://octopus.energy/dashboard/
207
+
208
+ **API Key** (format: `sk_live_...`):
209
+ - Get from https://octopus.energy/dashboard/new/accounts/personal-details/api-access
210
+ - Click "Generate API Key"
211
+
212
+ ### 3. Configure the Node
213
+
214
+ 1. Drag **Octopus Intelligent** into your flow
215
+ 2. Double-click to configure:
216
+ - Account Number (format: `A-XXXXXXXX`)
217
+ - API Key (stored securely)
218
+ - Intelligent (Min) sets the charging data poll interval. The default is 5 minutes.
219
+ - Intervals for electricity, gas, Wheel of Fortune, and Home Mini (all optional)
220
+ - Untick Electricity to stop the electricity rates and consumption polls. The node still polls applicable rates and free electricity while your account has an electricity meter.
221
+ - ☑ Enable Home Mini: tick if you have an Octopus Home Mini device
222
+ - ☑ Enable Wheel of Fortune: tick to track remaining spins
223
+ - ☐ Inverter (experimental): tick only if Octopus controls your solar inverter. Off by default.
224
+ - Tick Enable Home Assistant MQTT and choose a broker to publish to Home Assistant
225
+ 3. **Deploy** — account discovery runs automatically and enables categories based on your registered products
226
+
227
+ ### 4. Home Assistant (Optional)
228
+
229
+ If MQTT enabled:
230
+ 1. Wait ~5 seconds after deploy
231
+ 2. **Settings** → **Devices & Services** → **MQTT**
232
+ 3. Find "Octopus Intelligent" device
233
+ 4. The entities are already there. No YAML is needed.
234
+
235
+ ---
236
+
237
+ ## ⬆️ Upgrading to v1.7.0
238
+
239
+ v1.7.0 adds features. Existing flows, automations, and dashboards keep working, with one change for MQTT commands.
240
+
241
+ - The node now ignores retained messages on `submit_changes`, `refresh`, `set_smart_charging`, `set_charge_cap`, and `set_boost`, and logs one warning per topic. Home Assistant does not retain these commands, so its buttons and switches work as before. If your own flow publishes one of these commands with retain set, turn retain off. To clear an old retained message, publish an empty retained message to that topic.
242
+ - With a SmartFlex car or charge point, 11 new entities appear in Home Assistant: the Boost Charge switch and 10 vehicle entities. Octopus lists a charge point as an electric vehicle, so it gets the same entities. See Home Assistant Entities below for the counts.
243
+ - The experimental Inverter option is off, so nothing changes for inverters until you tick it.
244
+ - If you go back to an older version, the new entities stay in Home Assistant. The vehicle entities show Unavailable, and the Boost Charge switch keeps its last state and does nothing. The broker still holds their retained discovery config, so Home Assistant will not delete them one by one. To remove them, clear their retained discovery topics on the broker (`homeassistant/.../nodered_<account>_<id>/config`), for example with MQTT Explorer. Or delete the Octopus Intelligent device in Home Assistant: that clears the topics, but you lose the names and areas you set and any entity ids you changed. If you ticked Inverter, untick it and deploy before you go back, and the node removes the inverter entities for you.
245
+
246
+ ## ⬆️ Upgrading from v1.2.x
247
+
248
+ v1.3.0 only adds features and has no breaking changes. Existing flows, automations, and dashboards keep working.
249
+
250
+ **What happens on upgrade:**
251
+ - All existing entity IDs are preserved (HA's MQTT integration matches by `unique_id`, which is stable)
252
+ - All v1.2.x payload fields remain in the same positions
253
+ - About 70 new sensors appear in Home Assistant after the first poll. They cover electricity import and export tariffs and rates, gas tariff and consumption, Home Mini, Octoplus, saving sessions, free electricity, Wheel of Fortune, account balance, and applicable rates.
254
+ - New node config options (Home Mini, Wheel of Fortune) default to off
255
+ - Two existing Octoplus booleans (`octoplus_enrolled`, `octoplus_loyalty_points_user`) move from the `sensor.` to the `binary_sensor.` domain. A fresh install picks the right domain, but an upgrade may register both. Delete the old `sensor.` entries in Dev Tools if you want a tidy device card.
256
+
257
+ If you installed an early dev build of v1.3 and have stale entities in Home Assistant, see [Stale Entities After Early v1.3 Dev Build](#stale-entities-after-early-v13-dev-build) in the Troubleshooting section.
258
+
259
+ ---
260
+
261
+ ## 📊 Home Assistant Entities
262
+
263
+ **175 MQTT entities** are published under a single **Octopus Intelligent** device on a fresh install with a car or charge point Octopus smart-charges. Without one, the 10 vehicle entities and the Boost Charge switch are left out and the count is **164**. If you tick the experimental **Inverter** option and Octopus lists an inverter on your account, 14 more are added (**189** with a car). All entities are organised into two tiers: **Main** (controls, live data, tariff metadata, rewards) and **Diagnostics** (errors, raw timestamps, locale timestamps, API metrics).
264
+
265
+ If your device card shows more entities than these counts, the extras are likely leftovers from earlier installed versions or interrupted discovery. They can be deleted via Settings → Devices & Services → MQTT → Octopus Intelligent → entity → cog → "Delete from registry" without affecting current operation.
266
+
267
+ ### Node-RED payload vs MQTT entities
268
+
269
+ `msg.payload` from the Node-RED node contains more than 150 fields. Some payload fields are intentionally **not** exposed as individual HA entities; they exist for template/automation use inside Node-RED or HA Jinja:
270
+
271
+ | Category | Fields (count) | Why no MQTT entity |
272
+ |---|---|---|
273
+ | Bulk array data | `applicable_rates`, `electricity_export_rate`, `completed_dispatches`, `flex_planned_dispatches` (4) | Each is an array of 48 half-hour slots or N dispatches. Exposing each row as an MQTT entity would clutter the registry. The `_count` summary entity exists; consume the full array via templates / `apexcharts-card` for visualisation. |
274
+ | Pending controls | `pending_limit`, `pending_time` (2) | The number/select control entities (`Target Charge`, `Ready By`) render the pending value through their own `value_template`. No separate sensor entity needed. |
275
+ | Cost placeholders | `electricity_consumption_cost`, `gas_consumption_cost` (2) | Reserved for a future cost calculation (consumption × rate). Always `null`. |
276
+ | Vestigial | `saving_session_points` (1) | Octopus moved points to the Octoplus query. The field is always `null`. A sensor named Octopus Octopus Points still exists and is always empty. Use `octoplus_loyalty_points_user` for Octoplus. |
277
+
278
+ **Implication for HA users.** Every value you might want to show is reachable. Direct values use the MQTT entity. Previous and next import rates are available as diagnostic sensors.
279
+
280
+ ### Controls
281
+
282
+ These entities take commands. **Timezone**, **Smart Charging**, and **Charge Cap** carry the HA `entity_category: config` flag, because they are settings you change.
283
+
284
+ | Name | Description |
285
+ |---|---|
286
+ | Octopus Target Charge | Slider (5–100%) — set desired battery charge level; shows the pending value until applied |
287
+ | Octopus Ready Time | Dropdown (00:00–23:30, half-hour slots) — time by which the car must be ready. Other values are rejected with an error and nothing is sent to Octopus |
288
+ | Octopus Apply Changes | Submit pending limit/time changes to the Octopus API |
289
+ | Octopus Refresh API | Force an immediate API refresh (30-second cooldown enforced) |
290
+ | Timezone | Display timezone for all slot and window times, with 15 IANA options |
291
+ | Smart Charging | Enable (unsuspend) or disable (suspend) Octopus intelligent charging |
292
+ | Charge Cap | Limit smart charging to off-peak rates only (as in the Octopus app) |
293
+ | Boost Charge | Start charging now, outside the Octopus plan. Turn off to cancel the boost. Only published when Octopus lists a car or charger it controls |
294
+
295
+ ### Binary Sensors
296
+
297
+ | Name | Description |
298
+ |---|---|
299
+ | Octopus Charging Now | `ON` while the EV is inside a dispatch charging slot or a boost is running |
300
+ | Octopus Saving Session Available | `ON` if a saving session is upcoming or joinable |
301
+ | Octopus Free Electricity Active | `ON` while a free electricity window is in progress right now |
302
+ | Octopus Free Electricity Available | `ON` if a free electricity window is scheduled in the future |
303
+ | Octopus Octoplus Enrolled | `ON` if the account is enrolled in Octoplus |
304
+ | Octopus Octoplus Loyalty Points | `ON` if the account participates in Octoplus loyalty points (boolean flag from the API) |
305
+ | Octopus Saving Session Joined | On when you have joined the current saving session campaign |
306
+ | Octopus Saving Session Window Active | On while a saving session window is open, joined or not |
307
+ | Octopus Saving Session Active | On while a saving session window is open and you have joined |
308
+ | Octopus Last Charge Session Problem | `ON` if the latest finished charging session had a problem. Only with a SmartFlex car or charge point |
309
+
310
+ ### Main Sensors — EV Charging
311
+
312
+ | Name | Description |
313
+ |---|---|
314
+ | Octopus Confirmed Charge Limit | API-confirmed target charge percentage — last setting accepted by Octopus |
315
+ | Octopus Confirmed Ready Time | API-confirmed ready time — last setting accepted by Octopus |
316
+ | Octopus Next Charge Time | Start time of the next planned charging slot (display timezone) |
317
+ | Octopus Total Planned Energy | Total kWh across all upcoming planned dispatch slots |
318
+ | Octopus Next Slot Energy | Energy (kWh) scheduled for the next individual slot |
319
+ | Octopus Charge Source | Source of next charge: `smart-charge` (scheduled by Octopus algorithm) or `bump-charge` (car plugged in outside schedule) |
320
+ | Octopus Slot 1 Start | Start time of planned slot 1 |
321
+ | Octopus Slot 1 End | End time of planned slot 1 |
322
+ | Octopus Slot 2 Start | Start time of planned slot 2 (`null` if fewer than 2 slots) |
323
+ | Octopus Slot 2 End | End time of planned slot 2 |
324
+ | Octopus Slot 3 Start | Start time of planned slot 3 (`null` if fewer than 3 slots) |
325
+ | Octopus Slot 3 End | End time of planned slot 3 |
326
+ | Octopus Overall Window Start | Start of the first planned slot — when the charging window opens |
327
+ | Octopus Overall Window End | End of the last planned slot — when the charging window closes |
328
+ | Octopus Completed Dispatches | Count of completed intelligent dispatch sessions on record |
329
+ | Octopus Flex Planned Dispatches | Count of upcoming flex dispatch slots |
330
+
331
+ ### Main Sensors, SmartFlex Vehicle
332
+
333
+ Only published when Octopus lists a SmartFlex car or charge point on your account.
334
+
335
+ | Name | Description |
336
+ |---|---|
337
+ | Octopus Last Charge Session Energy | kWh added in the latest finished charging session. The last 5 sessions and the device alerts are attributes. Each new session starts a new total, so Home Assistant keeps statistics and you can add it to the Energy dashboard as an individual device |
338
+ | Octopus Last Charge Session Final Charge | Battery percentage at the end of the latest finished session |
339
+
340
+ ### Main Sensors — Electricity (Import)
341
+
342
+ | Name | Description |
343
+ |---|---|
344
+ | Octopus Electricity Standing Charge | Daily electricity standing charge (p/day) from current tariff |
345
+ | Octopus Electricity Consumption | Electricity consumed in the previous day (kWh) from the import meter |
346
+ | Octopus Current Electricity Rate | Live unit rate (p/kWh) from the 24h applicable rates schedule — use this on half-hourly tariffs (e.g. Intelligent Octopus Go) instead of Electricity Unit Rate |
347
+ | Octopus Electricity Rate | Live unit rate in GBP/kWh — measurement state class, ready for the HA Energy Dashboard |
348
+ | Octopus Electricity Unit Rate | Fixed unit rate (p/kWh) — `null` on half-hourly tariffs |
349
+ | Octopus Electricity Tariff Code | Current import tariff product code |
350
+ | Octopus Electricity Tariff Valid From / Valid To | Validity window of the current import tariff (`Valid To` is `null` for open-ended tariffs) |
351
+ | Octopus Electricity Day Rate | Day rate in p/kWh on tariffs with rate bands |
352
+ | Octopus Electricity Night Rate | Night rate in p/kWh on tariffs with rate bands |
353
+ | Octopus Electricity EV Peak Rate | EV peak rate in p/kWh on four-rate EV tariffs |
354
+ | Octopus Electricity EV Off-Peak Rate | EV off-peak rate in p/kWh on four-rate EV tariffs |
355
+
356
+ ### Main Sensors — Electricity (Export)
357
+
358
+ | Name | Description |
359
+ |---|---|
360
+ | Octopus Electricity Export Standing Charge | Daily export standing charge (p/day) — typically `0` for Agile Outgoing |
361
+ | Octopus Electricity Export Consumption | Electricity exported to the grid in the previous day (kWh) from the export meter |
362
+ | Octopus Current Electricity Export Rate | Live export rate (p/kWh) for the current half-hour slot |
363
+ | Octopus Electricity Export Rate | Live export rate (GBP/kWh) — measurement state class |
364
+ | Octopus Electricity Export Unit Rate | Fixed unit rate — `null` on half-hourly export tariffs (e.g. Agile Outgoing) |
365
+ | Octopus Electricity Export Tariff Code | Current export tariff product code (e.g. `AGILE-OUTGOING-19-05-13`) |
366
+ | Octopus Electricity Export Tariff Valid From / Valid To | Validity window of the current export tariff |
367
+
368
+ ### Main Sensors — Gas
369
+
370
+ | Name | Description |
371
+ |---|---|
372
+ | Octopus Gas Standing Charge | Daily gas standing charge (p/day) from current tariff |
373
+ | Octopus Gas Consumption | Gas consumed in the previous day (kWh) |
374
+ | Octopus Gas Unit Rate | Gas unit rate (p/kWh) |
375
+ | Octopus Gas Tariff Code | Gas product code |
376
+ | Octopus Gas Tariff Valid From / Valid To | Validity window of the current gas tariff |
377
+
378
+ ### Main Sensors — Account & Rewards
379
+
380
+ | Name | Description |
381
+ |---|---|
382
+ | Octopus Account Balance | Current account credit or debit balance (£) |
383
+ | Octopus WoF Electricity Spins | Wheel of Fortune electricity spins remaining (opt-in) |
384
+ | Octopus WoF Gas Spins | Wheel of Fortune gas spins remaining (opt-in) |
385
+
386
+ ### Main Sensors — Home Mini
387
+
388
+ | Name | Description |
389
+ |---|---|
390
+ | Octopus Home Mini Demand | Real-time grid import in kW — requires Octopus Home Mini and opt-in checkbox in node config |
391
+ | Octopus Home Mini Period Consumption | Energy consumed in the current half-hour period (kWh) |
392
+
393
+ ### Main Sensors — Account, Octoplus, Rewards (continued)
394
+
395
+ The following appear in the main device entity list (not the Diagnostics tab):
396
+
397
+ | Name | Description |
398
+ |---|---|
399
+ | Octopus Octoplus Status | Octoplus enrollment status string (e.g. `ENROLLED`) |
400
+ | Octopus Saving Session Start / End | Start and end of the next saving session (`null` outside October–March) |
401
+ | Octopus Free Electricity Start / End | Start and end of the next free electricity window (`null` outside the active period) |
402
+
403
+ ### Diagnostic Sensors
404
+
405
+ Appears under the **Diagnostics** tab of the HA device card.
406
+
407
+ #### Polling & Refresh
408
+
409
+ | Name | Description |
410
+ |---|---|
411
+ | Octopus Next Poll Time | Estimate of the next automatic API refresh |
412
+ | Octopus Refresh Available At | Timestamp when the manual refresh cooldown expires (`null` = available now) |
413
+
414
+ #### API Usage
415
+
416
+ | Name | Description |
417
+ |---|---|
418
+ | Octopus API Requests (Last Hour) | Number of API calls made in the last 60 minutes |
419
+ | Octopus API Complexity (Last Hour) | Total estimated GraphQL complexity used in the last hour |
420
+ | Octopus API Complexity Usage | Percentage of the 50,000/hour GraphQL complexity limit consumed |
421
+
422
+ #### Raw Timestamps (UTC)
423
+
424
+ Exact UTC strings from the API, unaffected by timezone settings. Use these when you need unambiguous UTC values in automations.
425
+
426
+ | Name | Description |
427
+ |---|---|
428
+ | Octopus Next Charge Time (Raw) | Next charge time — exact UTC string from API |
429
+ | Octopus Next Poll Time (Raw) | Next poll time — exact UTC string |
430
+ | Octopus Slot 1 Start (Raw) | Slot 1 start — exact UTC from API |
431
+ | Octopus Slot 1 End (Raw) | Slot 1 end — exact UTC from API |
432
+ | Octopus Slot 2 Start (Raw) | Slot 2 start — exact UTC from API |
433
+ | Octopus Slot 2 End (Raw) | Slot 2 end — exact UTC from API |
434
+ | Octopus Slot 3 Start (Raw) | Slot 3 start — exact UTC from API |
435
+ | Octopus Slot 3 End (Raw) | Slot 3 end — exact UTC from API |
436
+ | Octopus Overall Window Start (Raw) | Window start — exact UTC from API |
437
+ | Octopus Overall Window End (Raw) | Window end — exact UTC from API |
438
+
439
+ #### Server-Timezone Timestamps (Locale)
440
+
441
+ Times in the Node-RED server's auto-detected timezone. Unlike display fields, these are never affected by the Timezone selector or `set_timezone` command.
442
+
443
+ | Name | Description |
444
+ |---|---|
445
+ | Octopus Next Charge Time (Locale) | Next charge time in Node-RED server timezone |
446
+ | Octopus Slot 1 Start (Locale) | Slot 1 start in server timezone |
447
+ | Octopus Slot 1 End (Locale) | Slot 1 end in server timezone |
448
+ | Octopus Slot 2 Start (Locale) | Slot 2 start in server timezone |
449
+ | Octopus Slot 2 End (Locale) | Slot 2 end in server timezone |
450
+ | Octopus Slot 3 Start (Locale) | Slot 3 start in server timezone |
451
+ | Octopus Slot 3 End (Locale) | Slot 3 end in server timezone |
452
+ | Octopus Overall Window Start (Locale) | Window start in server timezone |
453
+ | Octopus Overall Window End (Locale) | Window end in server timezone |
454
+ | Octopus Timezone Detected | IANA timezone auto-detected from the Node-RED server (e.g. `Europe/London`) |
455
+ | Octopus Timezone Applied | Active timezone currently used for all display timestamp fields |
456
+
457
+ #### Consumption Metadata
458
+
459
+ | Name | Description |
460
+ |---|---|
461
+ | Octopus Electricity Consumption From | Start of the electricity (import) consumption measurement period |
462
+ | Octopus Electricity Consumption To | End of the electricity (import) consumption measurement period |
463
+ | Octopus Electricity Export Consumption From | Start of the export consumption measurement period |
464
+ | Octopus Electricity Export Consumption To | End of the export consumption measurement period |
465
+ | Octopus Gas Consumption From | Start of the gas consumption measurement period |
466
+ | Octopus Gas Consumption To | End of the gas consumption measurement period |
467
+
468
+ #### Applicable Rates — Import + Export
469
+
470
+ | Name | Description |
471
+ |---|---|
472
+ | Octopus Applicable Rates Slots | Number of import rate slots in the current 24-hour window |
473
+ | Octopus Electricity Export Rate Slots | Number of export rate slots in the current 24-hour window |
474
+ | Octopus Electricity Export Rate Prev | Previous half-hour export rate (p/kWh) |
475
+ | Octopus Electricity Export Rate Prev Ends | Timestamp when the previous export slot ended |
476
+ | Octopus Electricity Export Rate Next | Next half-hour export rate (p/kWh) |
477
+ | Octopus Electricity Export Rate Next From | Timestamp when the next export slot begins |
478
+ | Octopus Applicable Rates Min / Max / Median / Avg | Lowest, highest, median, and average import rate in the next 24 hours (p/kWh) |
479
+ | Octopus Electricity Export Rate Min / Max / Median / Avg | The same four values for export (p/kWh) |
480
+ | Octopus Applicable Rate Prev / Next | Previous and next import rate (p/kWh) |
481
+ | Octopus Applicable Rate Prev (GBP) / Next (GBP) | Previous and next import rate in pounds per kWh |
482
+ | Octopus Applicable Rate Prev Ends / Next From | When the previous slot ends and the next slot starts |
483
+ | Octopus Electricity Export Rate Prev (GBP) / Next (GBP) | Previous and next export rate in pounds per kWh |
484
+
485
+ #### Error & Detail Sensors
486
+
487
+ `null` = healthy. Non-null = the last error message from that API category.
488
+
489
+ | Name | Description |
490
+ |---|---|
491
+ | Octopus Electricity Rates Error | Last error fetching electricity rates |
492
+ | Octopus Electricity Consumption Error | Last error fetching electricity consumption |
493
+ | Octopus Gas Rates Error | Last error fetching gas rates |
494
+ | Octopus Gas Consumption Error | Last error fetching gas consumption |
495
+ | Octopus Applicable Rates Error | Last error fetching the import applicable rates schedule |
496
+ | Octopus Electricity Export Rate Error | Last error fetching the export applicable rates schedule. The same text is in `applicable_rates_export_error` in `msg.payload`. |
497
+ | Octopus Account Balance (Pence) | Account balance in pence (raw integer) |
498
+ | Octopus Account Error | Last error fetching account data |
499
+ | Octopus Octoplus Error | Last error fetching Octoplus data |
500
+ | Octopus WoF Electricity Max | Always empty. Octopus no longer provides it. Use the Spins sensor. |
501
+ | Octopus WoF Electricity Used | Always empty. Octopus no longer provides it. Use the Spins sensor. |
502
+ | Octopus WoF Gas Max | Always empty. Octopus no longer provides it. Use the Spins sensor. |
503
+ | Octopus WoF Gas Used | Always empty. Octopus no longer provides it. Use the Spins sensor. |
504
+ | Octopus WoF Error | Last error fetching Wheel of Fortune data |
505
+ | Octopus Home Mini Reading Time | Timestamp of the most recent Home Mini telemetry reading |
506
+ | Octopus Home Mini Error | Last error fetching Home Mini data |
507
+ | Octopus Saving Sessions Error | Last error fetching saving sessions data |
508
+ | Octopus Free Electricity Error | Last error fetching free electricity data |
509
+ | Octopus Completed Dispatches Error | Last error fetching completed dispatch history |
510
+ | Octopus Flex Planned Dispatches Error | Always empty today. Flex dispatch errors appear in Intelligent Error. |
511
+ | Octopus Intelligent Error | Last error from the intelligent charging (EV slots) query. A short text with the Octopus code, for example `KT-CT-4340: Unable to fetch planned dispatches`. |
512
+
513
+ The `... Error State` binary sensors (15, plus SmartFlex Vehicle Error State with a car or charge point and SmartFlex Inverter Error State with the Inverter option) turn on when the matching error field has a value. They turn off when it is empty.
514
+
515
+ #### SmartFlex Vehicle
516
+
517
+ Only published when Octopus lists a SmartFlex car or charge point on your account.
518
+
519
+ | Name | Description |
520
+ |---|---|
521
+ | Octopus Vehicle Make | Make of the car Octopus controls. For a charge point, this is the charger's make |
522
+ | Octopus Vehicle Model | Model of the car. For a charge point, this is the charger's model |
523
+ | Octopus Vehicle Battery Size | Battery size in kWh |
524
+ | Octopus Charger Power | Charger power output in kW |
525
+ | Octopus Vehicle Device State | What Octopus says the device is doing, for example `SMART_CONTROL_IN_PROGRESS` |
526
+ | Octopus SmartFlex Vehicle Error | Last error from the vehicle query. `null` means healthy |
527
+
528
+ #### Update
529
+
530
+ | Name | Description |
531
+ |---|---|
532
+ | Octopus Intelligent Node (Update entity) | Shows when a newer version of this node is on npm. It only tells you. Install from Node-RED Palette Manager. |
533
+ | Octopus Installed Version | Version of this node that is running |
534
+ | Octopus Latest Version | Newest version found on npm |
535
+ | Octopus Update Check At | When the node last checked for a new version |
536
+ | Octopus Update Check Error | Last error from the update check |
537
+
538
+ #### SmartFlex Inverter (experimental)
539
+
540
+ These entities exist only when the **Inverter** option is ticked and Octopus lists an inverter on your account. They are on the same device. Unticking the option removes them.
541
+
542
+ | Name | Description |
543
+ |---|---|
544
+ | Octopus Solar Power | Solar generation in kW |
545
+ | Octopus Home Battery Power | Home battery power in kW |
546
+ | Octopus Home Battery Charge | Home battery charge in % |
547
+ | Octopus Grid Power | Grid power in kW |
548
+ | Octopus Site Consumption | Site consumption in kW |
549
+ | Octopus Site Export | Site export in kW |
550
+ | Octopus Inverter Power | Inverter power in kW |
551
+ | Octopus Inverter Online | `ON` when Octopus reports the inverter as connected |
552
+ | Octopus Inverter Make / Model | Diagnostic. Inverter make and model |
553
+ | Octopus Solar Peak Power | Diagnostic. Peak solar power in kW |
554
+ | Octopus Inverter Connection Status | Diagnostic. Connection status text from Octopus |
555
+ | Octopus SmartFlex Inverter Error | Diagnostic. Last error from the inverter query |
556
+ | Octopus SmartFlex Inverter Error State | Diagnostic. `ON` when the error field has a value |
557
+
558
+ ---
559
+
560
+ ## 🚗 SmartFlex Vehicle Data
561
+
562
+ If Octopus controls your electric car or charge point, the node reads its details and recent charging sessions. This runs when the node discovers an EV or charge point on your account, and then every 30 minutes. If Octopus lists more than one, the node uses the one Octopus says is live, or the first if none is. You do not need to turn it on. If no device is found, the fields stay `null` or empty and Home Assistant gets no vehicle entities.
563
+
564
+ The fields land in `msg.payload`.
565
+
566
+ | Field | Type | Description |
567
+ |---|---|---|
568
+ | `vehicle_make` | string or null | Make of the car or charge point |
569
+ | `vehicle_model` | string or null | Model |
570
+ | `vehicle_battery_kwh` | number or null | Battery size in kWh |
571
+ | `charger_power_kw` | number or null | Charger power output in kW |
572
+ | `device_state` | string or null | What Octopus says the device is doing, for example `SMART_CONTROL_IN_PROGRESS`, `BOOSTING`, or `LOST_CONNECTION`. Read by the charging poll, so it updates every refresh interval and always agrees with `boosting` |
573
+ | `device_alerts` | array | Octopus alerts as `[{ message, published_at }]`, the 10 newest first. Each message is cut to 250 characters |
574
+ | `last_session` | object or null | The latest finished session |
575
+ | `charging_sessions` | array | Your last 5 sessions, newest first |
576
+ | `last_session_kwh` | number or null | kWh added in the latest finished session |
577
+ | `last_session_soc_final` | number or null | Final charge % of the latest finished session |
578
+ | `last_session_problem` | boolean or null | `true` if the latest finished session had a problem |
579
+ | `smartflex_vehicle_error` | string or null | The last error, or `null` |
580
+
581
+ Each session has `start`, `end`, `kwh_added`, `soc_change`, `soc_final`, `type`, `cost`, and `problems`. `cost` is `{ amount, currency }` or `null`. `problems` is a list of problem names.
582
+
583
+ ```json
584
+ {
585
+ "vehicle_make": "Tesla",
586
+ "vehicle_model": "Model 3",
587
+ "vehicle_battery_kwh": 75,
588
+ "charger_power_kw": 7.4,
589
+ "device_state": "SMART_CONTROL_IN_PROGRESS",
590
+ "device_alerts": [],
591
+ "last_session": {
592
+ "start": "2026-10-06T00:30:00Z",
593
+ "end": "2026-10-06T04:30:00Z",
594
+ "kwh_added": 24.1,
595
+ "soc_change": 32,
596
+ "soc_final": 80,
597
+ "type": "SMART",
598
+ "cost": { "amount": 1.81, "currency": "GBP" },
599
+ "problems": []
600
+ },
601
+ "charging_sessions": [],
602
+ "last_session_kwh": 24.1,
603
+ "last_session_soc_final": 80,
604
+ "last_session_problem": false,
605
+ "smartflex_vehicle_error": null
606
+ }
607
+ ```
608
+
609
+ `charging_sessions` holds up to 5 objects shaped like `last_session`. The example leaves it empty to stay short. If a poll fails, `smartflex_vehicle_error` holds a short error with the Octopus code, and the other fields keep their last values. If Octopus returns only part of the data, for example the sessions fail but the rest comes back, the node uses what came back, keeps the last values for the rest, sets `smartflex_vehicle_error`, and logs a warning.
610
+
611
+ Home Assistant gets these entities. If Octopus lists devices but none is a car or charge point, the node removes them. If Octopus lists no devices at all (this can happen for a moment), the node leaves them as they are. When Octopus sends no value, a number sensor shows unknown, and Vehicle Make, Vehicle Model and Vehicle Device State show Unavailable. If you go back to an older version, these entities stay in Home Assistant and show Unavailable, not a problem. To remove them, delete them in Home Assistant.
612
+
613
+ - Last Charge Session Energy and Last Charge Session Final Charge (main sensors)
614
+ - Last Charge Session Problem (binary sensor)
615
+ - Vehicle Make, Vehicle Model, Vehicle Battery Size, Charger Power, Vehicle Device State, and SmartFlex Vehicle Error (diagnostic sensors)
616
+ - SmartFlex Vehicle Error State (diagnostic binary sensor)
617
+
618
+ The session list and the alerts are attributes of the Last Charge Session Energy sensor. That sensor has state class `total`, and its last reset is the end of the session. So Home Assistant adds each finished session's kWh to its statistics once.
619
+
620
+ ## ☀️ SmartFlex Inverter Data (experimental)
621
+
622
+ > **Not yet verified on a real inverter.** The field names come from the Octopus schema, but no inverter was available to test with. If the values look wrong, please open an issue.
623
+
624
+ This is off by default. To turn it on, tick **Inverter** in the node settings and deploy. The node then reads inverter data every 5 minutes.
625
+
626
+ Octopus must list a SmartFlex inverter on your account. That means an inverter Octopus controls itself, for example through Intelligent Octopus Flux. Inverters from other brands, or inverters Octopus does not control, will not appear. If Octopus lists no inverter, the node reads nothing.
627
+
628
+ | Field | Type | Description |
629
+ |---|---|---|
630
+ | `inverter_make` | string or null | Inverter make |
631
+ | `inverter_model` | string or null | Inverter model |
632
+ | `solar_peak_kw` | number or null | Peak solar power in kW |
633
+ | `inverter_power_kw` | number or null | Inverter power in kW |
634
+ | `inverter_connection_status` | string or null | Connection status from Octopus |
635
+ | `inverter_online` | boolean or null | `true` when the status is `CONNECTED` or `ONLINE` |
636
+ | `home_battery_power_kw` | number or null | Home battery power in kW |
637
+ | `home_battery_soc` | number or null | Home battery charge in % |
638
+ | `solar_power_kw` | number or null | Solar generation in kW |
639
+ | `grid_power_kw` | number or null | Grid power in kW |
640
+ | `site_consumption_kw` | number or null | Site consumption in kW |
641
+ | `site_export_kw` | number or null | Site export in kW |
642
+ | `smartflex_inverter_error` | string or null | The last error, or `null` |
643
+
644
+ ```json
645
+ {
646
+ "inverter_make": "ExampleMake",
647
+ "inverter_model": "ExampleModel",
648
+ "solar_peak_kw": 4,
649
+ "inverter_power_kw": 2.1,
650
+ "inverter_connection_status": "CONNECTED",
651
+ "inverter_online": true,
652
+ "home_battery_power_kw": -1.2,
653
+ "home_battery_soc": 64,
654
+ "solar_power_kw": 3.3,
655
+ "grid_power_kw": 0.2,
656
+ "site_consumption_kw": 1.9,
657
+ "site_export_kw": 0,
658
+ "smartflex_inverter_error": null
659
+ }
660
+ ```
661
+
662
+ The values above are made up to show the shape. Home Assistant gets 14 extra entities, listed in the entity tables above. Unticking the option removes them.
663
+
664
+ ---
665
+
666
+ ## 🆓 Free Electricity & Seasonal Sensors
667
+
668
+ Octopus Energy runs free electricity sessions (typically June–October) and saving sessions (typically October–March). The node polls for both and exposes binary sensors for automation use.
669
+
670
+ ### Free Electricity
671
+ - **`binary_sensor.octopus_intelligent_octopus_free_electricity_active`** — `ON` while a free window is in progress right now
672
+ - **`binary_sensor.octopus_intelligent_octopus_free_electricity_available`** — `ON` if an upcoming free window is scheduled
673
+
674
+ Use these to automatically start charging your car or battery when electricity is free:
675
+
676
+ ```yaml
677
+ automation:
678
+ - alias: "Charge during free electricity"
679
+ trigger:
680
+ platform: state
681
+ entity_id: binary_sensor.octopus_intelligent_octopus_free_electricity_active
682
+ to: "on"
683
+ action:
684
+ service: switch.turn_on
685
+ target:
686
+ entity_id: switch.battery_charger
687
+ ```
688
+
689
+ ### Saving Sessions
690
+ - **`binary_sensor.octopus_intelligent_octopus_saving_session_available`** — `ON` if a saving session is upcoming
691
+ - **`sensor.octopus_intelligent_octopus_saving_session_start`** / **`sensor.octopus_intelligent_octopus_saving_session_end`** — start and end times
692
+
693
+ ### Why These Sensors Are Null Outside Season
694
+
695
+ The Octopus API only returns free electricity and saving session data when those programmes are active. Outside their seasons the API returns an empty list (or for saving sessions, the query itself is unavailable). When that happens:
696
+
697
+ - Binary sensors stay `OFF` (not `unavailable`)
698
+ - Timestamp sensors (`saving_session_start`, `free_electricity_start`, etc.) are `null`
699
+ - In Home Assistant, sensors with a `null` value may show as **unavailable**. This is normal.
700
+
701
+ ---
702
+
703
+ ## 🌍 Timezone Configuration
704
+
705
+ The runtime timezone changes slot and window display times. Daily consumption is always grouped by the Timezone field in the node editor. If that field is blank, the node uses UTC.
706
+
707
+ By default, slot and window times are converted to the **server's auto-detected timezone** (wherever Node-RED is running). Three ways to configure:
708
+
709
+ ### Option 1: Node Config (static)
710
+ Set a fixed IANA timezone in the node editor:
711
+ - Open node → **Timezone** field → type `Australia/Sydney`
712
+ - Leave blank to use server auto-detect
713
+
714
+ ### Option 2: Home Assistant Select (dynamic, persists across restarts)
715
+ Use the **Timezone** select entity in Home Assistant:
716
+ - Home Assistant → Octopus Intelligent device → Timezone
717
+ - Change takes effect on next poll
718
+ - The node keeps the value in node context. It survives a restart only if you set a persistent context store in `settings.js`.
719
+
720
+ ### Option 3: `set_timezone` Input Command
721
+ ```javascript
722
+ msg.payload = { set_timezone: "Europe/London" };
723
+ // Send to Octopus Intelligent node input
724
+ ```
725
+
726
+ ### Timestamp Tiers
727
+ | Field suffix | Timezone | Configurable? |
728
+ |---|---|---|
729
+ | `*_raw` | Always UTC (exact API string) | Never |
730
+ | `*_locale` | Server auto-detected | Never (always server TZ) |
731
+ | Display fields (`slot1_start`, `window_start`, etc.) | Resolved TZ | Yes — via HA, config, or command |
732
+
733
+ ### Supported Timezones (HA select)
734
+ `Europe/London`, `Europe/Berlin`, `Europe/Madrid`, `Australia/Sydney`, `Australia/Melbourne`, `Australia/Brisbane`, `Australia/Perth`, `Australia/Adelaide`, `Pacific/Auckland`, `America/New_York`, `America/Chicago`, `America/Denver`, `America/Los_Angeles`, `Asia/Tokyo`, `UTC`
735
+
736
+ Use an IANA name such as `Europe/London`, of up to 64 characters. The node checks the name. A name it does not know writes an error to the Node-RED log, and the timezone is not changed. Changing the timezone with `set_timezone` does not update the Timezone select in Home Assistant.
737
+
738
+ ---
739
+
740
+ ## 💡 Node-RED Usage
741
+
742
+ ### Basic Monitoring
743
+
744
+ ```
745
+ [Octopus Intelligent] → [Debug]
746
+ ```
747
+
748
+ The node polls on its own after deploy. Connect a Debug node to see the output. Add an Inject node only when you want to force a refresh.
749
+
750
+ ### Set Preferences from Flow
751
+
752
+ ```javascript
753
+ msg.payload = {
754
+ set_limit: 85, // 85% charge
755
+ set_time: "07:30" // Ready by 07:30
756
+ };
757
+ return msg;
758
+ ```
759
+
760
+ The ready-by time can be any half-hour slot from 00:00 to 23:30, as in the Octopus app. Any other value gives a node error and nothing is sent to Octopus. The node clamps the charge limit to between 5 and 100 and rounds it to the nearest 5. A limit that is not a number above 0, such as `set_limit: 0`, gives a node error.
761
+
762
+ ### Set Timezone from Flow
763
+
764
+ ```javascript
765
+ msg.payload = { set_timezone: "Australia/Sydney" };
766
+ return msg;
767
+ ```
768
+
769
+ ### Refresh from a Flow
770
+
771
+ Send any message without a command to refresh the charging data right away. An empty inject works. So does `{ refresh: true }`.
772
+
773
+ - There is no cooldown on this input. Add your own limit in the flow if you need one.
774
+ - A message that carries a command never starts a refresh.
775
+ - A refresh updates the charging data only. It does not refresh rates, gas, or account data.
776
+
777
+ ### Toggle Smart Charging from Flow
778
+
779
+ ```javascript
780
+ msg.payload = { set_smart_charging: true }; // enable (unsuspend)
781
+ msg.payload = { set_smart_charging: false }; // disable (suspend)
782
+ return msg;
783
+ ```
784
+
785
+ **Example: suspend charging when home battery is in use**
786
+ ```
787
+ [Inject: suspend] → [Function: set_smart_charging=false] → [Octopus Intelligent]
788
+ [Inject: resume] → [Function: set_smart_charging=true] → [Octopus Intelligent]
789
+ ```
790
+
791
+ ### `set_charge_cap`
792
+
793
+ ```js
794
+ msg.payload = { set_charge_cap: true }; // limit smart charging to off-peak rates only
795
+ msg.payload = { set_charge_cap: false };
796
+ ```
797
+
798
+ The node ignores any value other than `true` or `false`. The **Charge Cap** switch in Home Assistant does the same job.
799
+
800
+ ### `set_boost`
801
+
802
+ ```js
803
+ msg.payload = { set_boost: true }; // charge now, outside the Octopus plan
804
+ msg.payload = { set_boost: false }; // cancel the boost
805
+ ```
806
+
807
+ Only `true` and `false` work. Any other value, such as `"true"` or `1`, gives a node error and sends nothing. The **Boost Charge** switch in Home Assistant does the same job.
808
+
809
+ This is not the same as `set_smart_charging`, which pauses or resumes Octopus control. Octopus can refuse a boost, for example when the car is unplugged. The node logs the Octopus error (for example `Boost request failed: KT-CT-xxxx: message`) and does not retry. If Octopus refuses the same choice 3 times in 10 minutes, the node ignores that choice for the next 10 minutes and logs one warning. This stops a flow that asks again after each refusal from calling Octopus all day. A request Octopus accepts ends the pause.
810
+
811
+ The node sends one boost request at a time, at least 5 seconds apart. If you change your mind while one is being sent, only your last choice is sent next. A repeat of a choice Octopus has just accepted is dropped. After a failure, the same choice is sent again once the 5 seconds have passed. If Octopus does not answer a boost request within 75 seconds, the node gives up on it, sets `boost_error` and polls Octopus to check. Later requests are then sent as normal.
812
+
813
+ When Octopus accepts a boost or a cancel, the node polls Octopus soon after. That poll waits if 3 planned-dispatch queries have already gone out in the last minute. Octopus can take a moment to show the new state, so the switch shows what you asked for until Octopus agrees, for up to 2 minutes. After a refusal the node does not poll, because nothing changed. If the answer is not clear, for example an error on the part Octopus reads back, the node leaves the switch as it was, sets no `boost_error` and polls to check.
814
+
815
+ Payload fields:
816
+
817
+ - `boosting`: `true` while a boost runs, `false` when not, `null` until known. It goes back to `null` if no charging poll has confirmed it for twice the refresh interval, for example during an Octopus outage. `charging_now` then follows the plan again, and the Boost Charge switch shows unknown.
818
+ - `boost_error`: the error from the last `set_boost` that failed. It is sent as soon as the request fails. A boost that works clears it, and so does the first charging poll that reads the device state a minute or more later.
819
+ - `charging_now`: a boost counts as charging, so this is `true` during a boost even with no planned slot.
820
+
821
+ ### Combining commands
822
+
823
+ One message can carry several commands, and the node applies each one separately.
824
+
825
+ ```js
826
+ msg.payload = { set_limit: 90, set_time: "06:30", set_charge_cap: true };
827
+ ```
828
+
829
+ The node sends `set_limit` and `set_time` to Octopus together, so a bad value in either one stops both. The other commands in the same message still apply. A message with only one of them sends the last confirmed value for the other. To change both values, send them in one message.
830
+
831
+ `set_smart_charging` and `set_charge_cap` need `true` or `false`. Any other value is ignored with no error. The text `"true"` does not count. `set_timezone` needs a timezone name such as `Europe/London`. An empty value is ignored. A bad `set_limit`, `set_time` or `set_timezone` value writes an error to the Node-RED log.
832
+
833
+ ### Example Flows
834
+
835
+ The `examples/` folder has flows you can import. In Node-RED, open **Menu** → **Import** → **Examples** → **node-red-contrib-octopus-intelligent**. The folder also has `basic-monitoring.json`, `set-preferences.json`, `mqtt-integration.json`, `node-red-dashboard-flow.json`, and the Home Assistant `ha-dashboard.yaml`.
836
+
837
+ These four flows each open on their own tab, with a Read me comment that explains the settings:
838
+
839
+ - **`boost-on-cheap-or-surplus.json`**: starts a boost when the import rate is at or below a price you set, or when you export more than a set number of kW. It cancels the boost when that ends. Set the limits in the **Decide boost** function. The price rule needs a half-hourly rate schedule. The export rule needs the experimental Inverter option or your own reading.
840
+ - **`charging-and-error-alerts.json`**: sends a short alert when charging or a boost starts or stops, when any `*_error` field gets a value, changes, or clears, and when Octopus posts a new alert for your car or charge point. Replace the debug node with your notifier.
841
+ - **`cheapest-window-planner.json`**: each evening, finds the cheapest run of half hours for an appliance that must finish by a set time. It sends a second message when that window starts, which you can wire to a smart plug.
842
+ - **`daily-charging-summary.json`**: sends a morning summary of the charging sessions that ended in the last 24 hours, and a short message when a session finishes. It needs a car or charge point under Octopus SmartFlex control.
843
+
844
+ #### Wiring an example to your node
845
+
846
+ These four flows have no Octopus Intelligent node of their own. Use the node you already have. Each node polls Octopus by itself, so a second node on the same account doubles your API use.
847
+
848
+ 1. Add a **link out** node after your Octopus Intelligent node, and wire the node's output to it.
849
+ 2. Open the link out node and tick **From Octopus node** on the example's tab.
850
+ 3. Only `boost-on-cheap-or-surplus.json` sends commands back. For that flow, add a **link in** node and wire it to your node's input. Then open **To Octopus node** on the example's tab and tick that link in.
851
+
852
+ If your node is on the same tab as the example, you can delete the link nodes and wire it directly.
853
+
854
+ ### Output Format
855
+
856
+ ```json
857
+ {
858
+ "payload": {
859
+ "next_start": "2026-05-03 01:30:00+01:00",
860
+ "total_energy": 42.5,
861
+ "next_kwh": "15.20",
862
+ "next_source": "smart-charge",
863
+ "confirmed_limit": 80,
864
+ "confirmed_time": "07:00",
865
+ "pending_limit": 80,
866
+ "pending_time": "07:00",
867
+ "charging_now": false,
868
+ "smart_charging": true,
869
+ "charge_cap": false,
870
+ "boosting": false,
871
+ "boost_error": null,
872
+ "next_poll": "2026-05-03T10:35:00Z",
873
+ "refresh_available_at": null,
874
+ "api_requests_hour": 12,
875
+ "api_complexity_hour": 3600,
876
+ "api_complexity_percent": 7.2,
877
+ "slot1_start": "2026-05-03 01:30:00+01:00",
878
+ "slot1_end": "2026-05-03 05:30:00+01:00",
879
+ "slot2_start": null,
880
+ "slot2_end": null,
881
+ "slot3_start": null,
882
+ "slot3_end": null,
883
+ "window_start": "2026-05-03 01:30:00+01:00",
884
+ "window_end": "2026-05-03 05:30:00+01:00",
885
+ "timezone_detected": "Europe/London",
886
+ "timezone_applied": "Europe/London",
887
+ "next_start_locale": "2026-05-03 01:30:00+01:00",
888
+ "slot1_start_locale": "2026-05-03 01:30:00+01:00",
889
+ "slot1_end_locale": "2026-05-03 05:30:00+01:00",
890
+ "window_start_locale": "2026-05-03 01:30:00+01:00",
891
+ "window_end_locale": "2026-05-03 05:30:00+01:00",
892
+ "completed_dispatches_count": 3,
893
+ "completed_dispatches_error": null,
894
+ "flex_planned_dispatches_count": 1,
895
+ "flex_planned_dispatches_error": null,
896
+ "intelligent_error": null,
897
+ "electricity_unit_rate": null,
898
+ "electricity_standing_charge": 53.94,
899
+ "electricity_tariff_code": "E-1R-INTELLI-VAR-22-01-01-A",
900
+ "electricity_valid_from": "2022-01-01T00:00:00Z",
901
+ "electricity_valid_to": null,
902
+ "electricity_consumption_kwh": 8.4,
903
+ "electricity_consumption_from": "2026-05-02T00:00:00Z",
904
+ "electricity_consumption_to": "2026-05-03T00:00:00Z",
905
+ "electricity_rates_error": null,
906
+ "electricity_consumption_error": null,
907
+ "applicable_rates_count": 28,
908
+ "applicable_rates_current_pence": 10.33,
909
+ "applicable_rates_error": null,
910
+ "gas_unit_rate": 6.24,
911
+ "gas_standing_charge": 31.05,
912
+ "gas_tariff_code": "G-1R-VAR-22-11-01-A",
913
+ "gas_valid_from": "2022-11-01T00:00:00Z",
914
+ "gas_valid_to": null,
915
+ "gas_consumption_kwh": 12.1,
916
+ "gas_consumption_from": "2026-05-02T00:00:00Z",
917
+ "gas_consumption_to": "2026-05-03T00:00:00Z",
918
+ "gas_rates_error": null,
919
+ "gas_consumption_error": null,
920
+ "account_balance_pence": 10900,
921
+ "account_balance_pounds": 109,
922
+ "account_error": null,
923
+ "octoplus_enrolled": true,
924
+ "octoplus_enrollment_status": "ENROLLED",
925
+ "octoplus_loyalty_points_user": true,
926
+ "octoplus_error": null,
927
+ "wheel_of_fortune_electricity_spins": 2,
928
+ "wheel_of_fortune_electricity_max": null,
929
+ "wheel_of_fortune_electricity_used": null,
930
+ "wheel_of_fortune_gas_spins": 1,
931
+ "wheel_of_fortune_gas_max": null,
932
+ "wheel_of_fortune_gas_used": null,
933
+ "wheel_of_fortune_error": null,
934
+ "mini_demand_kw": 0.082,
935
+ "mini_consumption_delta_kwh": 0.002,
936
+ "mini_read_at": "2026-05-03T10:00:00Z",
937
+ "home_mini_error": null,
938
+ "saving_session_available": false,
939
+ "saving_session_start": null,
940
+ "saving_session_end": null,
941
+ "saving_session_joined": false,
942
+ "saving_session_points": null,
943
+ "saving_sessions_error": null,
944
+ "free_electricity_active": false,
945
+ "free_electricity_available": false,
946
+ "free_electricity_start": null,
947
+ "free_electricity_end": null,
948
+ "free_electricity_error": null,
949
+ "vehicle_make": "Tesla",
950
+ "vehicle_model": "Model 3",
951
+ "vehicle_battery_kwh": 75,
952
+ "charger_power_kw": 7.4,
953
+ "device_state": "SMART_CONTROL_IN_PROGRESS",
954
+ "device_alerts": [],
955
+ "last_session": null,
956
+ "charging_sessions": [],
957
+ "last_session_kwh": null,
958
+ "last_session_soc_final": null,
959
+ "last_session_problem": null,
960
+ "smartflex_vehicle_error": null
961
+ }
962
+ }
963
+ ```
964
+
965
+ > **Note:** `electricity_unit_rate` is `null` for half-hourly tariffs (e.g. Intelligent Octopus Go). Use `applicable_rates_current_pence` for the live rate on HH tariffs.
966
+
967
+ > **v1.7.0 additions:** The SmartFlex vehicle fields are at the end of the example. See SmartFlex Vehicle Data above. With the Inverter option ticked, the payload also carries the inverter fields. See SmartFlex Inverter Data above.
968
+
969
+ > **v1.3.0 additions:** The example above shows the v1.2.x payload shape for clarity. v1.3.0 adds ~14 additional fields covering electricity export (`electricity_export_unit_rate`, `electricity_export_tariff_code`, `electricity_export_consumption_kwh`, full `electricity_export_rate[]` half-hourly array with current/prev/next slot summaries) and import rate adjacency (`applicable_rates_prev_pence`, `_prev_gbp`, `_prev_to`, `_next_pence`, `_next_gbp`, `_next_from`). For the authoritative current set, inspect `msg.payload` in a Debug node after a real poll, or read `lib/payload.js` in the source.
970
+
971
+ ---
972
+
973
+ ## 🏡 Home Assistant Automation Examples
974
+
975
+ The entity ids below are the ones Home Assistant gives on a fresh install: the device name, then the entity name, for example `binary_sensor.octopus_intelligent_octopus_charging_now`. If you renamed the device or have two accounts, yours can differ. Check them in **Settings** → **Entities**.
976
+
977
+ ### Notify When Charging Starts
978
+
979
+ ```yaml
980
+ automation:
981
+ - alias: "EV Charging Starting"
982
+ trigger:
983
+ platform: state
984
+ entity_id: binary_sensor.octopus_intelligent_octopus_charging_now
985
+ to: "on"
986
+ action:
987
+ service: notify.mobile_app
988
+ data:
989
+ message: "EV charging started"
990
+ ```
991
+
992
+ ### Charge During Free Electricity Window
993
+
994
+ ```yaml
995
+ automation:
996
+ - alias: "Start battery charge on free electricity"
997
+ trigger:
998
+ platform: state
999
+ entity_id: binary_sensor.octopus_intelligent_octopus_free_electricity_active
1000
+ to: "on"
1001
+ action:
1002
+ service: switch.turn_on
1003
+ target:
1004
+ entity_id: switch.battery_charger
1005
+ - alias: "Stop battery charge after free electricity"
1006
+ trigger:
1007
+ platform: state
1008
+ entity_id: binary_sensor.octopus_intelligent_octopus_free_electricity_active
1009
+ to: "off"
1010
+ action:
1011
+ service: switch.turn_off
1012
+ target:
1013
+ entity_id: switch.battery_charger
1014
+ ```
1015
+
1016
+ ### Run Dishwasher During Cheap Rate
1017
+
1018
+ ```yaml
1019
+ automation:
1020
+ - alias: "Dishwasher During Cheap Window"
1021
+ trigger:
1022
+ platform: time_pattern
1023
+ minutes: "/5"
1024
+ condition:
1025
+ - condition: template
1026
+ value_template: >
1027
+ {% set start = as_timestamp(states('sensor.octopus_intelligent_octopus_slot_1_start')) %}
1028
+ {% set end = as_timestamp(states('sensor.octopus_intelligent_octopus_slot_1_end')) %}
1029
+ {% set now = as_timestamp(now()) %}
1030
+ {{ start <= now <= end }}
1031
+ action:
1032
+ service: switch.turn_on
1033
+ target:
1034
+ entity_id: switch.dishwasher
1035
+ ```
1036
+
1037
+ ### Alert When Saving Session Available
1038
+
1039
+ ```yaml
1040
+ automation:
1041
+ - alias: "Saving session alert"
1042
+ trigger:
1043
+ platform: state
1044
+ entity_id: binary_sensor.octopus_intelligent_octopus_saving_session_available
1045
+ to: "on"
1046
+ action:
1047
+ service: notify.mobile_app
1048
+ data:
1049
+ message: >
1050
+ Saving session available:
1051
+ {{ states('sensor.octopus_intelligent_octopus_saving_session_start') }}
1052
+ to {{ states('sensor.octopus_intelligent_octopus_saving_session_end') }}
1053
+ ```
1054
+
1055
+ ---
1056
+
1057
+ ## 🔍 Troubleshooting
1058
+
1059
+ ### No Data (All Sensors Null/0)
1060
+
1061
+ Check the `*_error` fields in `msg.payload`, the node status, and the Node-RED log.
1062
+
1063
+ - Account format must include `A-` prefix
1064
+ - Invalid API key: generate a new one in the Octopus dashboard
1065
+ - Not on a recognised Octopus tariff (EV sensors need Intelligent Octopus Go)
1066
+ - Car not plugged in (no slots scheduled): null EV sensors are normal when no charging is planned
1067
+
1068
+ ### Authentication Failing
1069
+
1070
+ Look at the node status and the Node-RED log for the login error. Regenerate your API key and update the node configuration.
1071
+
1072
+ ### Sensors Unavailable in Home Assistant
1073
+
1074
+ 1. Verify MQTT broker is running
1075
+ 2. Check Node-RED can connect to MQTT broker
1076
+ 3. Deploy the flow to trigger discovery
1077
+ 4. Confirm Home Assistant MQTT integration is enabled
1078
+
1079
+ ### electricity_unit_rate Always Null
1080
+
1081
+ This is expected on half-hourly tariffs like Intelligent Octopus Go. The tariff has no single unit rate, because prices vary by half-hour slot. Use `applicable_rates_current_pence` for the live rate instead.
1082
+
1083
+ ### Upgrading from v1.2.x — Sensors Look Different
1084
+
1085
+ v1.3.0 adds about 70 new sensors but does not rename or remove any v1.2 sensors. Existing automations and dashboards keep working. The new sensors appear in Home Assistant after the first poll following the upgrade.
1086
+
1087
+ Two existing Octoplus booleans (`octoplus_enrolled` and `octoplus_loyalty_points_user`) move from the `sensor.` domain to `binary_sensor.` in v1.3 because they are boolean values and HA's sensor domain doesn't accept booleans cleanly. If you have automations referencing the old `sensor.` entity IDs, update them to the new `binary_sensor.` IDs after upgrade.
1088
+
1089
+ ### Stale Entities After Early v1.3 Dev Build
1090
+
1091
+ If you installed an early v1.3 dev build before the final release, some entity IDs may have changed. To clean up stale entities:
1092
+
1093
+ 1. In HA → **Settings → Devices & Services → MQTT**
1094
+ 2. Find each stale entity name in Developer Tools → MQTT
1095
+ 3. Publish an **empty retained payload** to its config topic:
1096
+ ```
1097
+ Topic: homeassistant/sensor/nodered_A-XXXX_<sensor_id>/config
1098
+ Payload: (empty)
1099
+ Retain: ✓
1100
+ ```
1101
+ This removes the entity config from the broker, and HA then drops the entity.
1102
+
1103
+ ### Home Mini Not Showing
1104
+
1105
+ 1. Tick **Enable Home Mini** in node config
1106
+ 2. Verify your Octopus account has a smart meter registered (visible in the Octopus app)
1107
+ 3. Check `msg.payload.home_mini_error` in a debug node for the specific error
1108
+
1109
+ ### New Category Sensors All Null After Deploy
1110
+
1111
+ Account discovery runs at startup. If it fails, the node tries again after 30 seconds, 1 minute, and 2 minutes, then every 5 minutes. The node status shows the retry. If it keeps failing, check the Node-RED log for login errors and verify your API key.
1112
+
1113
+ ### Seasonal Sensors Show "Unavailable"
1114
+
1115
+ Saving session sensors only have values from October to March, and free electricity sensors from June to October. Outside those months their values are `null`, so HA shows them as unavailable. This is expected.
1116
+
1117
+ ### Changes Not Applying
1118
+
1119
+ In Home Assistant, the Target Charge slider and Ready Time dropdown only change the pending values. Press **Apply Changes** to send them to Octopus. This saves API calls when you make several changes.
1120
+
1121
+ ---
1122
+
1123
+ ## 🛠️ How It Works
1124
+
1125
+ ### Startup — Account Discovery
1126
+
1127
+ On first deploy, the node queries the Octopus API to detect which products are registered on your account:
1128
+
1129
+ - **Electricity** — enabled if an electricity agreement exists. Untick Electricity in the editor to stop the electricity rates and consumption polls.
1130
+ - **Gas** — enabled if a gas agreement exists, unless you untick Gas in the editor
1131
+ - **Intelligent EV** — enabled if an EV device is registered (Intelligent Octopus Go)
1132
+ - **Home Mini** — enabled if a smart meter device is registered AND the Home Mini checkbox is ticked
1133
+ - **Saving Sessions / Account / Octoplus** — always polled if credentials are valid
1134
+ - **Wheel of Fortune** — polled only when the Wheel of Fortune checkbox is ticked
1135
+
1136
+ Discovery sets which categories are active, so there is nothing to configure by hand.
1137
+
1138
+ ### Category Scheduler
1139
+
1140
+ You set the charging, electricity, gas, Wheel of Fortune, and Home Mini intervals in the editor. Import and export applicable rates use the electricity rates interval. Free electricity is checked every 30 minutes. Saving sessions, account, Octoplus, and charging history are checked every 60 minutes. SmartFlex vehicle data is checked every 30 minutes, and the experimental SmartFlex inverter every 5 minutes when its option is ticked. The update check runs once a day.
1141
+
1142
+ A 1-second clock-aligned scheduler checks which groups are due each tick. Due groups run one after another in a single tick, with one login. The charging poll runs first. A slow call delays the groups after it.
1143
+
1144
+ Polls run on the clock. A 5-minute interval runs at :00, :05, :10, and so on. It does not run 5 minutes after deploy. Next Poll Time is an estimate.
1145
+
1146
+ The node sends a message whenever any group was due in a tick. It also sends one when `charging_now` changes, and when a saving session, free electricity window, or rate slot starts or ends.
1147
+
1148
+ ### MQTT Topics
1149
+
1150
+ The node publishes state to `nodered_octopus/<account>/status` and reads commands from `nodered_octopus/<account>/<command>`. The commands are `set_limit`, `set_time`, `submit_changes`, `refresh`, `set_timezone`, `set_smart_charging`, `set_charge_cap`, and `set_boost`.
1151
+
1152
+ The node ignores retained messages on `submit_changes`, `refresh`, `set_smart_charging`, `set_charge_cap`, and `set_boost`, and logs one warning per topic. The broker would replay a retained command on every restart, so a retained `ON` on `set_boost` would boost again each time. To clear one, publish an empty retained message to that topic. Home Assistant does not retain these commands.
1153
+
1154
+ ### Authentication Flow
1155
+
1156
+ 1. **Exchange API key** for a short-lived token
1157
+ 2. **Run category polls** one after another, charging first. Each group makes its own GraphQL query.
1158
+ 3. **Merge results** into a single payload object
1159
+ 4. **Publish** to Node-RED output + MQTT state topic
1160
+
1161
+ ### Charging Poll Errors and Retries
1162
+
1163
+ Every request to Octopus gives up after 30 seconds with no answer. If a poll is still running after 10 minutes, the next poll starts anyway and the Node-RED log shows a warning.
1164
+
1165
+ When the charging poll fails, the node keeps the known plan and the charging timers. If the error is `KT-CT-4340` (planned dispatches) or `KT-CT-4339` (charging preferences), it tries again after 30 seconds, 1 minute, and 2 minutes, then every 2 minutes, until it works or the next normal poll is due. A retry waits if 3 planned-dispatch queries have already gone out in the last minute. Other errors wait for the next normal poll. `intelligent_error` and the node status show a short error with the Octopus code.
1166
+
1167
+ Each failed attempt writes a warning to the Node-RED log, for example `Charging poll failed: KT-CT-4340 Unable to fetch planned dispatches (retry 2 in 60s)`. One line follows when it works again, for example `Charging poll recovered after 4m 30s`.
1168
+
1169
+ If only the charging preferences fail (`KT-CT-4339`), the poll still works. The node keeps the last confirmed target and ready-by time and logs a warning.
1170
+
1171
+ The check 30 seconds before a slot also handles an Octopus error. It logs a warning and starts the slot on time from the known plan.
1172
+
1173
+ ### Exponential Backoff (preference changes)
1174
+
1175
+ When changing charge limit or ready time:
1176
+
1177
+ ```
1178
+ Mutation sent → Wait 15s → Validate
1179
+ ↓ Not confirmed yet?
1180
+ → Wait 30s → Validate
1181
+ ↓ Not confirmed yet?
1182
+ → Wait 60s → Validate
1183
+ ↓ Not confirmed yet?
1184
+ → Wait 120s → Final check
1185
+ ↓ Then normal interval resumes
1186
+ ```
1187
+
1188
+ Each step polls the charging data. The node stops early once Octopus confirms the new values, and the node status shows the progress.
1189
+
1190
+ ### Debug Information
1191
+
1192
+ Poll messages carry only `msg.payload`. Check the `*_error` fields, the node status, and the Node-RED log.
1193
+
1194
+ When `charging_now` changes, the node sends an extra message. That message also carries a `msg.debug` object with `timestamp`, `trigger` (`charging_state_change`), `previous_state`, and `new_state`.
1195
+
1196
+ When a saving session, free electricity window, or rate slot starts or ends, the node also sends an extra message. Its `msg.debug` has `timestamp`, `trigger` (`active_fields_change`), and `changed`, the list of fields that changed.
1197
+
1198
+ When a `set_boost` request fails, the node sends an extra message with `boost_error` set. Its `msg.debug` has `timestamp`, `trigger` (`boost_failed`), `request` (`BOOST` or `CANCEL`), and `error`.
1199
+
1200
+ ---
1201
+
1202
+ ## 📝 License
1203
+
1204
+ MIT License - Copyright (c) 2025 Andrew Somerharju Neale
1205
+
1206
+ See [LICENSE](LICENSE) file for full details.
1207
+
1208
+ ---
1209
+
1210
+ ## ⚠️ Disclaimer
1211
+
1212
+ This is an **unofficial integration** and is not affiliated with, endorsed by, or connected to Octopus Energy Ltd.
1213
+
1214
+ Use at your own risk. The Octopus Energy name and logo are trademarks of Octopus Energy Ltd.
1215
+
1216
+ ---
1217
+
1218
+ ## 🔗 Links
1219
+
1220
+ - **npm**: https://www.npmjs.com/package/node-red-contrib-octopus-intelligent
1221
+ - **GitHub**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent
1222
+ - **Issues**: https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues
1223
+ - **Octopus Intelligent**: https://octopus.energy/intelligent/
1224
+ - **API Docs**: https://developer.octopus.energy/docs/api/
1225
+
1226
+ ---
1227
+
1228
+ ## 📜 Changelog
1229
+
1230
+ See [CHANGELOG.md](CHANGELOG.md) for the full history.
1231
+
1232
+ ---
1233
+
1234
+ **Made with ⚡ for the Octopus Energy & Home Assistant communities**