node-red-contrib-octopus-intelligent 1.2.1 → 1.3.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.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # node-red-contrib-octopus-intelligent
2
2
 
3
- > Node-RED integration for **Octopus Energy Intelligent Octopus Go** with automatic Home Assistant MQTT discovery
3
+ > Node-RED integration for **Octopus Energy** with automatic Home Assistant MQTT discovery
4
4
 
5
- Monitor your EV charging slots, control charge limits, and manage ready times directly from Home Assistant - all automatically configured via MQTT discovery.
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
6
 
7
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
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -48,39 +48,64 @@ If this project has helped you!
48
48
 
49
49
  ## ✨ Features
50
50
 
51
- ### 🎮 Smart Controls
52
- - **Target Charge Slider** (50-100%) - Set your desired battery level
53
- - **Ready Time Dropdown** (04:00-11:00) - When your car needs to be ready
54
- - **Apply Changes Button** - Prevents API spam while adjusting settings
55
- - **Confirmed Values** - See your current API-validated settings
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
56
57
 
57
58
  ### ⚡ Real-Time Charging Data
58
- - **Next Charge Time** - When your next slot starts
59
- - **Total Planned Energy** - Total kWh across all upcoming slots
60
- - **Individual Slot Times** - Up to 3 slots with start/end times
61
- - **Charging Window** - Overall window from first to last slot
62
- - **Charge Source** - Smart-charge vs bump-charge indicator
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
63
94
 
64
95
  ### 🔧 Advanced Features
65
- - **Manual Refresh Button** - Force API refresh from Home Assistant (30s cooldown)
66
- - **Next Poll Timer** - See when the next automatic refresh will occur
67
- - **API Usage Tracking** - Monitor requests and complexity in diagnostics
68
- - **Raw Timestamps** - Exact API responses in Diagnostics section
69
- - **Exponential Backoff** - Smart retry prevents sensor unavailability
70
- - **Comprehensive Debugging** - Full API call tracking in msg.debug
71
- - **Active Slot Detection** - Shows currently running sessions
72
- - **Entity Categories** - Organized Controls, Sensors, and Diagnostics
73
-
74
- ### 🏠 Home Assistant Integration
75
- - **Zero Configuration** - MQTT auto-discovery sets everything up
76
- - **Clean Organization** - Controls, sensors, and diagnostics neatly grouped
77
- - **Professional Layout** - Organized entity categories in device card
78
- - **Suggested Area** - Auto-suggests "Energy" area
79
-
80
- ### ⚡ Smart Charging Control
81
- - **Smart Charging Toggle** — suspend or resume Octopus intelligent charging from Node-RED or Home Assistant
82
- - **HA MQTT Switch** — "Smart Charging" switch entity auto-discovered in Home Assistant
83
- - **`smart_charging` field** — live state in every payload (`true` = active, `false` = suspended, `null` = unknown)
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
84
109
 
85
110
  ### 🌍 Timezone Support
86
111
  - **Locale Timestamps** (`*_locale` fields) — always in server auto-detected timezone
@@ -93,89 +118,68 @@ If this project has helped you!
93
118
 
94
119
  ## 📸 Screenshots
95
120
 
96
- ### Node-RED Flow Examples
121
+ ### Node Configuration
97
122
 
98
- #### Basic Monitoring & Control
99
- ![Node-RED Flow Examples](https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/basic-monitoring-flow.png)
123
+ ![Node Configuration](images/examples/Octopus%20Intelligent%20Node.png)
100
124
 
101
- This example flow demonstrates three key usage patterns:
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.
102
126
 
103
- 1. **Basic Monitoring**
104
- - The Octopus Intelligent Node automaticaly refreshes every 5 minutes
105
- - Octopus Intelligent node fetches latest charging data
106
- - Debug node displays all charging slots and settings
127
+ ### Node-RED Flow Example
107
128
 
108
- 2. **Setting Preferences**
109
- - Inject node with JSON payload: `{"set_limit": 85, "set_time": "07:30"}` ommit a key:value if you don't want to change it
110
- - Sends charge limit +/ ready time to the node
111
- - Debug shows confirmed values from API
129
+ ![Node-RED Flow Example](images/examples/basic-monitoring-flow.png)
112
130
 
113
- **How to use:** Import any of these flows, configure your Account Number and API Key in the Octopus Intelligent node, and deploy!
131
+ ### Home Assistant — Dashboard
114
132
 
115
- #### MQTT Integration with Home Assistant
116
- ![MQTT Integration Flow](https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/mqtt-integration-flow.png)
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.
117
134
 
118
- This flow shows the complete MQTT setup:
135
+ #### EV controls, electricity import & export
119
136
 
120
- - **MQTT Broker Configuration**: Connected to Home Assistant (localhost:1883)
121
- - **Enable MQTT toggle**: Activated in node settings
122
- - **Auto-Discovery**: Node automatically creates all entities in Home Assistant on first run
123
- - **Real-time Updates**: Every 5 minutes, charging data is published to MQTT and updates HA sensors
137
+ ![Dashboard — EV, electricity import + export](images/examples/home_assistant_dashboard_1_1-3-0.png)
124
138
 
125
- **What you get in Home Assistant:** All controls and sensors appear automatically - no manual YAML configuration needed!
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).
126
140
 
127
- ### Home Assistant Auto-Configured Entities
141
+ #### Gas, account, rewards, Home Mini
128
142
 
129
- ![Home Assistant Device](https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/homeassistant-device-v1.0.4.png)
143
+ ![Dashboard — gas, account, rewards, Home Mini](images/examples/home_assistant_dashboard_2_1-3-0.png)
130
144
 
131
- After enabling MQTT in the Node-RED node, Home Assistant automatically creates:
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.
132
146
 
133
- ### Home Assistant Controls Configuration
147
+ #### Diagnostics — UTC timestamps, raw timestamps, errors
134
148
 
135
- ![Home Assistant Controls Configuration](https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/configuration.png)
149
+ ![Dashboard — diagnostics](images/examples/home_assistant_dashboard_3_1-3-0.png)
136
150
 
137
- The Controls section of the device card includes the **Timezone** select and the new **Smart Charging** toggle, letting you suspend or resume intelligent charging directly from Home Assistant.
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.
138
152
 
139
- #### Controls (Top Section)
140
- - **Target Charge** - Number slider (50-100%) to set desired battery level
141
- - **Ready Time** - Dropdown selector (04:00-11:00) for when car needs to be ready
142
- - **Apply Changes** - Button to submit new settings (prevents API spam while adjusting)
143
- - **Refresh API** - Button to force manual refresh (30-second cooldown prevents spam)
144
- - **Timezone** — Select entity for choosing display timezone (15 IANA options, persists across restarts)
145
- - **Smart Charging** — Switch to suspend or resume Octopus intelligent charging
153
+ #### Gas — live data from a real account
146
154
 
147
- #### Sensors (Main Section)
148
- - **Confirmed Charge Limit** - Current API-validated charge limit
149
- - **Confirmed Ready Time** - Current API-validated ready time
150
- - **Next Charge Time** - When your next charging slot starts (formatted for your timezone)
151
- - **Next Poll Time** - When the next automatic refresh will occur
152
- - **Total Planned Energy** - Total kWh across all upcoming slots
153
- - **Slot 1, 2, 3 Start/End** - Individual charging slot times
154
- - **Overall Window Start/End** - First slot start to last slot end
155
- - **Slot 1, 2, 3 Start/End (Locale)** — Same slots in server auto-detected timezone
156
- - **Overall Window Start/End (Locale)** — Window times in server auto-detected timezone
157
- - **Next Charge Time (Locale)** — Next charge start in server auto-detected timezone
158
- - **Charging Now** - Binary sensor (ON/OFF) showing if actively charging
155
+ ![Dashboard — gas live data](images/examples/home_assistant_dashboard_working_gas_1-3-0.png)
159
156
 
160
- #### Diagnostics (Raw timestamps and monitoring)
161
- - **Refresh Available At** - Countdown timestamp showing when manual refresh becomes available
162
- - **API Requests (Last Hour)** - Number of API calls in the last 60 minutes
163
- - **API Complexity (Last Hour)** - Total complexity used (max 50,000/hour)
164
- - **API Complexity Usage** - Percentage of hourly API limit used
165
- - **Timezone Detected** — Server's auto-detected timezone (e.g. `Europe/London`)
166
- - **Timezone Applied** — Active timezone used for display fields
167
- - **Raw timestamp sensors** - Exact API responses for all sensors
168
- - Useful for debugging, advanced automations, and monitoring API usage
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.
169
158
 
170
- **All entities are automatically organized under a single "Octopus Intelligent" device!**
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.
171
172
 
172
173
  ---
173
174
 
174
175
  ## 📋 Requirements
175
176
 
176
177
  - **Node-RED** v2.0+
177
- - **Octopus Energy Account** with [Intelligent Octopus Go](https://octopus.energy/intelligent/) tariff
178
- - **API Key** - [Generate here](https://octopus.energy/dashboard/new/accounts/personal-details/api-access)
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)
179
183
  - **MQTT Broker** (optional, for Home Assistant integration)
180
184
  - **Home Assistant** (optional, for MQTT features)
181
185
 
@@ -202,11 +206,14 @@ The Controls section of the device card includes the **Timezone** select and the
202
206
 
203
207
  1. Drag **Octopus Intelligent** into your flow
204
208
  2. Double-click to configure:
205
- - Account Number
209
+ - Account Number (format: `A-XXXXXXXX`)
206
210
  - API Key (stored securely)
207
- - Refresh Interval (default: 5 min)
208
- - Enable MQTT if using Home Assistant
209
- 3. **Deploy**
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
210
217
 
211
218
  ### 4. Home Assistant (Optional)
212
219
 
@@ -214,65 +221,293 @@ If MQTT enabled:
214
221
  1. Wait ~5 seconds after deploy
215
222
  2. **Settings** → **Devices & Services** → **MQTT**
216
223
  3. Find "Octopus Intelligent" device
217
- 4. All entities created automatically!
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.
218
240
 
219
241
  ---
220
242
 
221
243
  ## 📊 Home Assistant Entities
222
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
+
223
265
  ### Controls
224
- ```
225
- number.octopus_target_charge Battery charge limit (50-100%)
226
- select.octopus_ready_time Ready by time (04:00-11:00)
227
- button.octopus_apply_changes Submit changes to API
228
- button.octopus_refresh_api Manual refresh (30s cooldown)
229
- select.octopus_timezone Display timezone (15 IANA options)
230
- switch.octopus_smart_charging Enable/disable smart charging
231
- ```
232
266
 
233
- ### Main Sensors
234
- ```
235
- sensor.octopus_confirmed_charge_limit API-confirmed charge limit
236
- sensor.octopus_confirmed_ready_time API-confirmed ready time
237
- sensor.octopus_next_charge_time Next charging slot start
238
- sensor.octopus_next_poll_time Next automatic refresh time
239
- sensor.octopus_total_planned_energy Total kWh planned
240
- sensor.octopus_next_slot_energy Energy in next slot
241
- sensor.octopus_charge_source smart-charge/bump-charge
242
- sensor.octopus_slot_[1-3]_start Individual slot starts
243
- sensor.octopus_slot_[1-3]_end Individual slot ends
244
- sensor.octopus_overall_window_start First slot start
245
- sensor.octopus_overall_window_end Last slot end
246
- sensor.octopus_next_charge_locale Next charge start (server TZ)
247
- sensor.octopus_slot_[1-3]_start_locale Individual slot starts (server TZ)
248
- sensor.octopus_slot_[1-3]_end_locale Individual slot ends (server TZ)
249
- sensor.octopus_overall_window_start_locale Window start (server TZ)
250
- sensor.octopus_overall_window_end_locale Window end (server TZ)
251
- ```
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 |
252
473
 
253
- ### Diagnostics (Raw Timestamps & Monitoring)
254
- ```
255
- # Refresh & Polling
256
- sensor.octopus_refresh_available_at When manual refresh becomes available
257
- sensor.octopus_next_poll_time_raw Raw next poll timestamp
258
-
259
- # API Usage Tracking
260
- sensor.octopus_api_requests_hour API calls in last 60 minutes
261
- sensor.octopus_api_complexity_hour Total complexity used
262
- sensor.octopus_api_complexity_usage Percentage of 50,000/hour limit
263
-
264
- # Raw Timestamps
265
- sensor.octopus_next_charge_time_raw Exact API timestamp
266
- sensor.octopus_slot_[1-3]_start_raw Raw slot start times
267
- sensor.octopus_slot_[1-3]_end_raw Raw slot end times
268
- sensor.octopus_overall_window_start_raw Raw window start
269
- sensor.octopus_overall_window_end_raw Raw window end
270
-
271
- # Timezone Diagnostics
272
- sensor.octopus_timezone_detected Server auto-detected timezone
273
- sensor.octopus_timezone_applied Active timezone used for display fields
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
274
497
  ```
275
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
+
276
511
  ---
277
512
 
278
513
  ## 🌍 Timezone Configuration
@@ -282,7 +517,6 @@ By default, slot and window times are converted to the **server's auto-detected
282
517
  ### Option 1: Node Config (static)
283
518
  Set a fixed IANA timezone in the node editor:
284
519
  - Open node → **Timezone** field → type `Australia/Sydney`
285
- - Applies to all display fields (`slot1_start`, `window_start`, etc.)
286
520
  - Leave blank to use server auto-detect
287
521
 
288
522
  ### Option 2: Home Assistant Select (dynamic, persists across restarts)
@@ -296,11 +530,10 @@ Use the **Timezone** select entity in Home Assistant:
296
530
  msg.payload = { set_timezone: "Europe/London" };
297
531
  // Send to Octopus Intelligent node input
298
532
  ```
299
- Saved to node context, applies on next poll.
300
533
 
301
534
  ### Timestamp Tiers
302
535
  | Field suffix | Timezone | Configurable? |
303
- |-------------|----------|---------------|
536
+ |---|---|---|
304
537
  | `*_raw` | Always UTC (exact API string) | Never |
305
538
  | `*_locale` | Server auto-detected | Never (always server TZ) |
306
539
  | Display fields (`slot1_start`, `window_start`, etc.) | Resolved TZ | Yes — via HA, config, or command |
@@ -339,30 +572,24 @@ return msg;
339
572
 
340
573
  ### Toggle Smart Charging from Flow
341
574
 
342
- Send a boolean to enable or disable Octopus intelligent charging:
343
-
344
575
  ```javascript
345
576
  msg.payload = { set_smart_charging: true }; // enable (unsuspend)
346
577
  msg.payload = { set_smart_charging: false }; // disable (suspend)
347
578
  return msg;
348
579
  ```
349
580
 
350
- Wire an **Inject node** with a JSON payload, or build this in a function node and connect it to the Octopus Intelligent node's input. Non-boolean values are silently ignored.
351
-
352
581
  **Example: suspend charging when home battery is in use**
353
582
  ```
354
583
  [Inject: suspend] → [Function: set_smart_charging=false] → [Octopus Intelligent]
355
584
  [Inject: resume] → [Function: set_smart_charging=true] → [Octopus Intelligent]
356
585
  ```
357
586
 
358
- The node fetches your device ID at startup — if it hasn't been fetched yet (first few seconds after deploy), the command will log a warning and be ignored. The current smart charging state is always available in `msg.payload.smart_charging` (`true` = active, `false` = suspended, `null` = startup pending).
359
-
360
587
  ### Output Format
361
588
 
362
589
  ```json
363
590
  {
364
591
  "payload": {
365
- "next_start": "2025-11-29 01:30:00+00:00",
592
+ "next_start": "2026-05-03 01:30:00+01:00",
366
593
  "total_energy": 42.5,
367
594
  "next_kwh": "15.20",
368
595
  "next_source": "smart-charge",
@@ -371,44 +598,106 @@ The node fetches your device ID at startup — if it hasn't been fetched yet (fi
371
598
  "pending_limit": 80,
372
599
  "pending_time": "07:00",
373
600
  "charging_now": false,
374
- "next_poll": "2025-11-29T10:35:00Z",
601
+ "smart_charging": true,
602
+ "next_poll": "2026-05-03T10:35:00Z",
375
603
  "refresh_available_at": null,
376
604
  "api_requests_hour": 12,
377
605
  "api_complexity_hour": 3600,
378
606
  "api_complexity_percent": 7.2,
379
- "slot1_start": "2025-11-29 01:30:00+00:00",
380
- "slot1_end": "2025-11-29 05:30:00+00:00",
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",
381
615
  "timezone_detected": "Europe/London",
382
616
  "timezone_applied": "Europe/London",
383
- "smart_charging": true,
384
- "next_start_locale": "2025-11-29 01:30:00+00:00",
385
- "slot1_start_locale": "2025-11-29 01:30:00+00:00",
386
- "slot1_end_locale": "2025-11-29 05:30:00+00:00",
387
- "window_start_locale": "2025-11-29 01:30:00+00:00",
388
- "window_end_locale": "2025-11-29 05:30:00+00:00"
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
389
679
  },
390
680
  "debug": {
391
681
  "success": true,
392
682
  "step": "complete",
393
683
  "apiCalls": [
394
- {
395
- "name": "data_query",
396
- "responseHeaders": {...},
397
- "extensions": null
398
- }
399
- ],
400
- "api_usage": {
401
- "requests_last_hour": 12,
402
- "complexity_last_hour": 3600,
403
- "complexity_percent_used": "7.2",
404
- "api_limit_hourly": 50000,
405
- "request_complexity": 300,
406
- "complexity_source": "estimated"
407
- }
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
+ ]
408
693
  }
409
694
  }
410
695
  ```
411
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
+
412
701
  ---
413
702
 
414
703
  ## 🏡 Home Assistant Automation Examples
@@ -420,14 +709,36 @@ automation:
420
709
  - alias: "EV Charging Starting"
421
710
  trigger:
422
711
  platform: state
423
- entity_id: sensor.octopus_next_charge_time
424
- condition:
425
- condition: template
426
- value_template: "{{ trigger.to_state.state != 'None' }}"
712
+ entity_id: binary_sensor.octopus_charging_now
713
+ to: "on"
427
714
  action:
428
715
  service: notify.mobile_app
429
716
  data:
430
- message: "EV charging at {{ states('sensor.octopus_next_charge_time') }}"
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
431
742
  ```
432
743
 
433
744
  ### Run Dishwasher During Cheap Rate
@@ -441,8 +752,8 @@ automation:
441
752
  condition:
442
753
  - condition: template
443
754
  value_template: >
444
- {% set start = as_timestamp(states('sensor.octopus_slot1_start')) %}
445
- {% set end = as_timestamp(states('sensor.octopus_slot1_end')) %}
755
+ {% set start = as_timestamp(states('sensor.octopus_slot_1_start')) %}
756
+ {% set end = as_timestamp(states('sensor.octopus_slot_1_end')) %}
446
757
  {% set now = as_timestamp(now()) %}
447
758
  {{ start <= now <= end }}
448
759
  action:
@@ -451,68 +762,128 @@ automation:
451
762
  entity_id: switch.dishwasher
452
763
  ```
453
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
+
454
783
  ---
455
784
 
456
785
  ## 🔍 Troubleshooting
457
786
 
458
787
  ### No Data (All Sensors Null/0)
459
788
 
460
- **Check `msg.debug` output** in a Debug node:
789
+ Check `msg.debug` output in a Debug node:
461
790
 
462
- Common issues:
463
- - ❌ Account format must include `A-` prefix
464
- - ❌ Invalid API key - regenerate at Octopus dashboard
465
- - ❌ Not on Intelligent Octopus tariff
466
- - ❌ Car not plugged in (no slots scheduled)
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
467
795
 
468
796
  ### Authentication Failing
469
797
 
470
- Check `msg.debug.apiCalls[0].errors` for details.
471
-
472
- **Solution:** Regenerate API key and update node configuration.
798
+ Check `msg.debug.apiCalls[0].errors` for details. Regenerate your API key and update the node configuration.
473
799
 
474
800
  ### Sensors Unavailable in Home Assistant
475
801
 
476
802
  1. Verify MQTT broker is running
477
- 2. Check Node-RED can connect to MQTT
803
+ 2. Check Node-RED can connect to MQTT broker
478
804
  3. Deploy the flow to trigger discovery
479
805
  4. Confirm Home Assistant MQTT integration is enabled
480
806
 
481
- ### Raw Sensors Not in Diagnostics
807
+ ### electricity_unit_rate Always Null
482
808
 
483
- If entities existed before v1.0:
484
- 1. Delete "Octopus Intelligent" device in Home Assistant
485
- 2. Redeploy Node-RED flow
486
- 3. Entities will be rediscovered with proper categories
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.
487
810
 
488
- ### Changes Not Applying
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.
489
814
 
490
- **Working as designed!** Use the **Apply Changes** button to submit.
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.
491
816
 
492
- This prevents API spam when making multiple adjustments.
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.
493
848
 
494
849
  ---
495
850
 
496
851
  ## 🛠️ How It Works
497
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
+
498
869
  ### Authentication Flow
499
870
 
500
- 1. **Get Token** - Exchange API key for token
501
- 2. **Fetch Data** - Query planned dispatches & preferences
502
- 3. **Process** - Filter active/future slots, calculate totals
503
- 4. **Publish** - Send to Node-RED + MQTT
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
504
875
 
505
- ### Exponential Backoff
876
+ ### Exponential Backoff (preference changes)
506
877
 
507
- When changing preferences:
878
+ When changing charge limit or ready time:
508
879
 
509
880
  ```
510
881
  Mutation sent → Wait 15s → Validate
511
- ↓ If not confirmed
882
+ ↓ Not confirmed yet?
512
883
  → Wait 30s → Validate
513
- ↓ If not confirmed
884
+ ↓ Not confirmed yet?
514
885
  → Wait 60s → Validate
515
- ↓ If not confirmed
886
+ ↓ Not confirmed yet?
516
887
  → Wait 120s → Final check
517
888
  ↓ Then normal interval resumes
518
889
  ```
@@ -525,12 +896,12 @@ Every message includes `msg.debug`:
525
896
 
526
897
  ```json
527
898
  {
528
- "timestamp": "2025-11-29T10:30:00Z",
899
+ "timestamp": "2026-05-03T10:30:00Z",
529
900
  "success": true,
530
901
  "step": "complete",
531
902
  "apiCalls": [
532
903
  {"name": "authentication", "tokenObtained": true},
533
- {"name": "data_query", "slotsFound": 3}
904
+ {"name": "intelligent", "slotsFound": 1}
534
905
  ]
535
906
  }
536
907
  ```
@@ -567,26 +938,42 @@ Use at your own risk. The Octopus Energy name and logo are trademarks of Octopus
567
938
 
568
939
  See [CHANGELOG.md](CHANGELOG.md) for detailed version history and release notes.
569
940
 
570
- ### Latest Release: v1.2.0 (2026-04-26)
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)
571
968
  - **Smart Charging Toggle** — suspend/resume Octopus intelligent charging from Node-RED or Home Assistant
572
969
  - **HA MQTT Switch** — auto-discovered Smart Charging switch entity
573
970
  - **`smart_charging` payload field** — live state in every message
574
971
 
575
- ### Previous Release: v1.0.5 (2025-12-31)
576
- - **Documentation Fix** - Corrected misleading "branded device cards" claim in README
577
-
578
- ### Previous Release: v1.0.4 (2025-12-11)
579
- - **Manual Refresh Button** - Force API refresh via Home Assistant with 30s cooldown
580
- - **Next Poll Timer** - See when next automatic refresh occurs
581
- - **API Complexity Monitoring** - Track API usage against 50,000/hour limit
582
- - **Enhanced State Output** - Every poll outputs full state to Node-RED
583
- - **Rate Limiting** - MQTT button (30s cooldown), Node-RED input (no limit)
584
- - **Improved Debugging** - Response headers and extensions captured
585
-
586
- ### Previous Release: v1.0.3 (2025-12-04)
587
- - State reconciliation loop for charging detection
588
- - Fixed Home Assistant sensors going "unknown"
589
- - Flow Library scorecard compliance
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)
590
977
 
591
978
  ---
592
979