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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,118 +1,209 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [1.0.2] - 2025-11-30
9
-
10
- ### Changed
11
- - Updated flow example description in Node-RED help panel for better clarity
12
- - Improved explanation of default behavior: reads by default, manually refreshable, and accepts commands
13
-
14
- ## [1.0.1] - 2025-11-30
15
-
16
- ### Added
17
- - **Node.js and Node-RED version requirements** in package.json engines field
18
- - Minimum Node.js: >=14.0.0
19
- - Minimum Node-RED: >=2.0.0
20
- - Addresses Flow Library scorecard requirements
21
- - **Comprehensive example flows** in Node-RED help panel
22
- - Basic monitoring flow (inject every 5 min)
23
- - Set preferences from flow (JSON payload with set_limit/set_time)
24
- - Home Assistant MQTT integration example
25
- - **Visual documentation** with screenshots
26
- - Node-RED flow examples showing monitoring, preferences, and preset buttons
27
- - MQTT integration flow example
28
- - Home Assistant device page with all entities
29
- - **Visual Examples section** in Node-RED help panel with embedded GitHub-hosted images
30
- - **Screenshots section** in README.md showing real-world usage
31
-
32
- ### Changed
33
- - Updated README.md with Screenshots section after Features
34
- - Updated .npmignore to exclude images/ folder (keeps npm package lightweight)
35
- - Updated .gitignore to exclude local documentation files
36
-
37
- ### Fixed
38
- - Flow Library scorecard now shows supported Node-RED and Node.js versions
39
- - Flow Library scorecard "Nodes have examples" requirement now satisfied
40
-
41
- ## [1.0.0] - 2025-11-30
42
-
43
- ### Added
44
- - Initial public release
45
- - **Octopus Energy GraphQL API integration**
46
- - Authentication via API key
47
- - Fetch planned charging dispatches (smart-charge and bump-charge slots)
48
- - Query vehicle charging preferences (target SOC and ready time)
49
- - Update charging preferences via GraphQL mutations
50
- - **Home Assistant MQTT auto-discovery**
51
- - Number entity: Target charge limit (50-100%)
52
- - Select entity: Ready time (04:00-11:00)
53
- - Button entity: Apply changes
54
- - Sensor entities: Confirmed settings, next charge time, total energy, slot times
55
- - Binary sensor: Charging now (ON/OFF)
56
- - Organized into Controls, Sensors, and Diagnostics categories
57
- - **Real-time charging slot detection**
58
- - Detects currently active charging slots
59
- - Calculates next charging start time
60
- - Provides individual slot start/end times (up to 3 slots)
61
- - Calculates overall charging window
62
- - Shows charge source (smart-charge vs bump-charge)
63
- - **Exponential backoff validation**
64
- - Smart retry mechanism when updating preferences
65
- - Prevents sensors from becoming "unavailable" during API updates
66
- - Validates changes at 15s, 30s, 60s, 120s intervals
67
- - **Comprehensive debugging**
68
- - Full API call tracking in msg.debug
69
- - Success/failure status for each operation
70
- - Detailed error messages
71
- - **Node-RED flow control**
72
- - Accept input messages to set preferences programmatically
73
- - Output payload with all charging data
74
- - 5-minute default refresh interval (configurable)
75
- - **Octopus Energy branding**
76
- - Professional pink theme (#E8146F)
77
- - Device branded as "Octopus Intelligent" in Home Assistant
78
- - Suggested "Energy" area in Home Assistant
79
- - **Unit test coverage**
80
- - Data processing tests (10 tests)
81
- - Timer management tests (10 tests)
82
- - Mock API responses for consistent testing
83
-
84
- ### Security
85
- - API key stored securely as Node-RED credential (not exposed in flows)
86
- - Account numbers sanitized in MQTT topics and entity IDs
87
-
88
- ### Documentation
89
- - Comprehensive README.md with:
90
- - Feature list and capabilities
91
- - Installation instructions (npm and palette manager)
92
- - Configuration guide
93
- - Home Assistant setup instructions
94
- - Node-RED usage examples
95
- - Home Assistant automation examples
96
- - Troubleshooting section
97
- - Support options (GitHub Star, Sponsor, PayPal donate)
98
- - MIT License
99
- - GitHub repository with issue tracking
100
-
101
- ## Release Notes
102
-
103
- ### Version Numbering
104
- This project follows [Semantic Versioning](https://semver.org/):
105
- - **MAJOR** version (X.0.0): Breaking changes
106
- - **MINOR** version (1.X.0): New features (backwards compatible)
107
- - **PATCH** version (1.0.X): Bug fixes (backwards compatible)
108
-
109
- ### Links
110
- - [npm Package](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
111
- - [GitHub Repository](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
112
- - [Node-RED Flow Library](https://flows.nodered.org/node/node-red-contrib-octopus-intelligent)
113
- - [Issues & Bug Reports](https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues)
114
-
115
- ### Support
116
- - ⭐ [Star on GitHub](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
117
- - 💖 [Become a Sponsor](https://github.com/sponsors/ASomerN)
118
- - ☕ [Donate via PayPal](https://www.paypal.com/donate?hosted_button_id=A2B8ZFEJBE2S6)
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.4] - 2025-12-11
9
+
10
+ ### Added
11
+ - **Manual Refresh Button (MQTT)** - "Octopus Refresh API" button in Home Assistant
12
+ - Hardcoded 30-second rate limiting to prevent API spam
13
+ - Shows warning in Node-RED when rate limited
14
+ - Publishes refresh cooldown state to MQTT
15
+ - **Refresh Available At Sensor** - Diagnostic timestamp sensor
16
+ - Shows ISO timestamp when manual refresh becomes available
17
+ - Displays as countdown in Home Assistant ("in 25 seconds")
18
+ - Automatically clears to `null` after 30 seconds
19
+ - Leverages Home Assistant's native timestamp handling
20
+ - **Next Poll Time Sensors** - Shows when next automatic poll will occur
21
+ - `sensor.octopus_next_poll_time` - Main sensor (timestamp class)
22
+ - `sensor.octopus_next_poll_time_raw` - Diagnostic raw timestamp
23
+ - Updates after each successful poll
24
+ - **API Complexity Tracking** - Monitor API usage against 50,000 hourly limit
25
+ - `sensor.octopus_api_requests_hour` - Count of requests (last 60 min)
26
+ - `sensor.octopus_api_complexity_hour` - Total complexity used
27
+ - `sensor.octopus_api_complexity_usage` - Percentage of limit used
28
+ - Estimated complexity: Regular poll (300), Mutation (250), Pre-validation (200)
29
+ - All API complexity sensors in Diagnostics section
30
+ - **Enhanced Debug Output** - `msg.debug` now includes:
31
+ - `responseHeaders` - Full HTTP response headers from API
32
+ - `extensions` - GraphQL extensions field (if present)
33
+ - `api_usage` - Comprehensive API usage metrics per request
34
+ - **Comprehensive Test Coverage** - Added 5 new tests
35
+ - Tests for MQTT refresh button rate limiting
36
+ - Tests for countdown expiry behavior
37
+ - Validates countdown doesn't go negative
38
+ - Tests timer cleanup and MQTT message structure
39
+
40
+ ### Changed
41
+ - **Rate Limiting Strategy** - Different behavior for MQTT vs Node-RED
42
+ - MQTT Button: Hardcoded 30-second cooldown (enforced)
43
+ - Node-RED Input: No rate limiting (programmers control this)
44
+ - Timestamp-based cooldown (not seconds counter)
45
+ - **State Output** - Node-RED now outputs state on every poll
46
+ - Previously only output on changes
47
+ - Now outputs full `statusPayload` every poll cycle
48
+ - Better for automations and monitoring
49
+ - **Global Setter** - Updated `NodeRed_Global_Setter.js` with new fields:
50
+ - `octopus_next_poll`
51
+ - `octopus_refresh_available_at`
52
+ - `octopus_api_requests_hour`
53
+ - `octopus_api_complexity_hour`
54
+ - `octopus_api_complexity_percent`
55
+
56
+ ### Fixed
57
+ - **Cooldown Timer Expiry** - Properly publishes `null` at 30 seconds
58
+ - Prevents countdown showing negative values in Home Assistant
59
+ - Timer cleanup prevents memory leaks
60
+ - Exactly 2 MQTT messages per refresh (start + expiry)
61
+
62
+ ### Technical Details
63
+ - **API Complexity Estimation** - Since Octopus API doesn't provide actual complexity:
64
+ - Uses estimated values based on query types
65
+ - Tracks rolling 60-minute window
66
+ - If actual complexity becomes available, will use it automatically
67
+ - **Timestamp-Based Cooldown** - Uses ISO timestamps instead of seconds
68
+ - Home Assistant handles countdown display automatically
69
+ - Zero MQTT spam during countdown
70
+ - Clean `null` state when ready
71
+
72
+ ## [1.0.3] - 2025-12-04
73
+
74
+ ### Added
75
+ - **State reconciliation loop** for charging detection (every 10 seconds)
76
+ - Automatically detects charging state based on cached slot timestamps
77
+ - No API calls - uses local data only
78
+ - Handles imminent/immediate slots when car is plugged in
79
+ - Self-healing: corrects state if timers miss edge cases
80
+ - **Flow Library scorecard compliance**
81
+ - Added `version` field to `node-red` section in package.json (>=2.0.0)
82
+ - Added `examples/` folder with 3 demonstration flows
83
+ - Satisfies Node-RED Flow Library requirements
84
+
85
+ ### Fixed
86
+ - **Home Assistant sensors going "unknown"** when adjusting controls
87
+ - Sensors now maintain last known values while editing pending preferences
88
+ - Only update when fresh data arrives from API
89
+ - Added `lastKnownState` cache and state merging in `publishCurrentState()`
90
+ - **Charging state not updating** for imminent/immediate slots
91
+ - Fixed edge case where slots starting <30s after poll were not detected
92
+ - Reconciliation loop catches these within 10 seconds
93
+ - Ensures accurate "Charging Now" sensor in Home Assistant
94
+
95
+ ### Changed
96
+ - Improved charging state management with redundant detection methods
97
+ - Enhanced MQTT state publishing to preserve sensor data during control updates
98
+
99
+ ## [1.0.2] - 2025-11-30
100
+
101
+ ### Changed
102
+ - Updated flow example description in Node-RED help panel for better clarity
103
+ - Improved explanation of default behavior: reads by default, manually refreshable, and accepts commands
104
+
105
+ ## [1.0.1] - 2025-11-30
106
+
107
+ ### Added
108
+ - **Node.js and Node-RED version requirements** in package.json engines field
109
+ - Minimum Node.js: >=14.0.0
110
+ - Minimum Node-RED: >=2.0.0
111
+ - Addresses Flow Library scorecard requirements
112
+ - **Comprehensive example flows** in Node-RED help panel
113
+ - Basic monitoring flow (inject every 5 min)
114
+ - Set preferences from flow (JSON payload with set_limit/set_time)
115
+ - Home Assistant MQTT integration example
116
+ - **Visual documentation** with screenshots
117
+ - Node-RED flow examples showing monitoring, preferences, and preset buttons
118
+ - MQTT integration flow example
119
+ - Home Assistant device page with all entities
120
+ - **Visual Examples section** in Node-RED help panel with embedded GitHub-hosted images
121
+ - **Screenshots section** in README.md showing real-world usage
122
+
123
+ ### Changed
124
+ - Updated README.md with Screenshots section after Features
125
+ - Updated .npmignore to exclude images/ folder (keeps npm package lightweight)
126
+ - Updated .gitignore to exclude local documentation files
127
+
128
+ ### Fixed
129
+ - Flow Library scorecard now shows supported Node-RED and Node.js versions
130
+ - Flow Library scorecard "Nodes have examples" requirement now satisfied
131
+
132
+ ## [1.0.0] - 2025-11-30
133
+
134
+ ### Added
135
+ - Initial public release
136
+ - **Octopus Energy GraphQL API integration**
137
+ - Authentication via API key
138
+ - Fetch planned charging dispatches (smart-charge and bump-charge slots)
139
+ - Query vehicle charging preferences (target SOC and ready time)
140
+ - Update charging preferences via GraphQL mutations
141
+ - **Home Assistant MQTT auto-discovery**
142
+ - Number entity: Target charge limit (50-100%)
143
+ - Select entity: Ready time (04:00-11:00)
144
+ - Button entity: Apply changes
145
+ - Sensor entities: Confirmed settings, next charge time, total energy, slot times
146
+ - Binary sensor: Charging now (ON/OFF)
147
+ - Organized into Controls, Sensors, and Diagnostics categories
148
+ - **Real-time charging slot detection**
149
+ - Detects currently active charging slots
150
+ - Calculates next charging start time
151
+ - Provides individual slot start/end times (up to 3 slots)
152
+ - Calculates overall charging window
153
+ - Shows charge source (smart-charge vs bump-charge)
154
+ - **Exponential backoff validation**
155
+ - Smart retry mechanism when updating preferences
156
+ - Prevents sensors from becoming "unavailable" during API updates
157
+ - Validates changes at 15s, 30s, 60s, 120s intervals
158
+ - **Comprehensive debugging**
159
+ - Full API call tracking in msg.debug
160
+ - Success/failure status for each operation
161
+ - Detailed error messages
162
+ - **Node-RED flow control**
163
+ - Accept input messages to set preferences programmatically
164
+ - Output payload with all charging data
165
+ - 5-minute default refresh interval (configurable)
166
+ - **Octopus Energy branding**
167
+ - Professional pink theme (#E8146F)
168
+ - Device branded as "Octopus Intelligent" in Home Assistant
169
+ - Suggested "Energy" area in Home Assistant
170
+ - **Unit test coverage**
171
+ - Data processing tests (10 tests)
172
+ - Timer management tests (10 tests)
173
+ - Mock API responses for consistent testing
174
+
175
+ ### Security
176
+ - API key stored securely as Node-RED credential (not exposed in flows)
177
+ - Account numbers sanitized in MQTT topics and entity IDs
178
+
179
+ ### Documentation
180
+ - Comprehensive README.md with:
181
+ - Feature list and capabilities
182
+ - Installation instructions (npm and palette manager)
183
+ - Configuration guide
184
+ - Home Assistant setup instructions
185
+ - Node-RED usage examples
186
+ - Home Assistant automation examples
187
+ - Troubleshooting section
188
+ - Support options (GitHub Star, Sponsor, PayPal donate)
189
+ - MIT License
190
+ - GitHub repository with issue tracking
191
+
192
+ ## Release Notes
193
+
194
+ ### Version Numbering
195
+ This project follows [Semantic Versioning](https://semver.org/):
196
+ - **MAJOR** version (X.0.0): Breaking changes
197
+ - **MINOR** version (1.X.0): New features (backwards compatible)
198
+ - **PATCH** version (1.0.X): Bug fixes (backwards compatible)
199
+
200
+ ### Links
201
+ - [npm Package](https://www.npmjs.com/package/node-red-contrib-octopus-intelligent)
202
+ - [GitHub Repository](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
203
+ - [Node-RED Flow Library](https://flows.nodered.org/node/node-red-contrib-octopus-intelligent)
204
+ - [Issues & Bug Reports](https://github.com/ASomerN/node-red-contrib-octopus-intelligent/issues)
205
+
206
+ ### Support
207
+ - ⭐ [Star on GitHub](https://github.com/ASomerN/node-red-contrib-octopus-intelligent)
208
+ - 💖 [Become a Sponsor](https://github.com/sponsors/ASomerN)
209
+ - ☕ [Donate via PayPal](https://www.paypal.com/donate?hosted_button_id=A2B8ZFEJBE2S6)