node-red-contrib-octopus-intelligent 1.0.3 → 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
@@ -5,6 +5,70 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
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
+
8
72
  ## [1.0.3] - 2025-12-04
9
73
 
10
74
  ### Added