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

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,12 @@ 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.7.1] — 2026-12-05
9
+
10
+ ### Changed
11
+ - **New Octopus API address.** Octopus is moving its API from `api.octopus.energy` to `api.oegb-kraken.energy`, and the old address has started adding a "This API address has changed" message to some replies. The node now sends its main requests to the new address. Saving sessions and Wheel of Fortune stay on Octopus's backend address, because those queries only exist there. Octopus has said that address isn't changing. (Issue #4)
12
+ - **The version is in every log line.** Each line the node writes to the Node-RED log now starts with the version, for example `v1.7.1: Charging poll recovered after 5m 0s`, and the node logs `v1.7.1: starting` when it starts. A log excerpt in a bug report now says which version wrote it. Status text in the editor is unchanged.
13
+
8
14
  ## [1.7.0] — 2026-10-16
9
15
 
10
16
  ### Added
package/lib/graphql.js CHANGED
@@ -45,7 +45,15 @@ function isPlainObject(v) {
45
45
  return v !== null && typeof v === 'object' && !Array.isArray(v);
46
46
  }
47
47
 
48
- function graphqlPost(body, token, hostname = 'api.octopus.energy') {
48
+ // Octopus moved the main API from api.octopus.energy to api.oegb-kraken.energy (announced
49
+ // 29 Sep 2026); the old host answers some queries with DOMAIN_MIGRATED ("This API address
50
+ // has changed", issue #4) and is to be retired. savingSessions and wheelOfFortune exist only
51
+ // on the backend host, which has no oegb-kraken.energy equivalent (live probe 2 Dec 2026:
52
+ // the new host returns 400 "Cannot query field"), so those categories pass BACKEND_HOST.
53
+ const MAIN_HOST = 'api.oegb-kraken.energy';
54
+ const BACKEND_HOST = 'api.backend.octopus.energy';
55
+
56
+ function graphqlPost(body, token, hostname = MAIN_HOST) {
49
57
  return new Promise((resolve, reject) => {
50
58
  // Settle exactly once: error, close, timeout and end can all arrive for one request.
51
59
  let settled = false;
@@ -138,4 +146,4 @@ function graphqlPost(body, token, hostname = 'api.octopus.energy') {
138
146
  });
139
147
  }
140
148
 
141
- module.exports = { graphqlPost, snippet, retryAfterMs, REQUEST_TIMEOUT_MS, MAX_RESPONSE_BYTES };
149
+ module.exports = { graphqlPost, MAIN_HOST, BACKEND_HOST, snippet, retryAfterMs, REQUEST_TIMEOUT_MS, MAX_RESPONSE_BYTES };
@@ -60,10 +60,14 @@ module.exports = function (RED) {
60
60
  const short = (m) => truncate(m, 300);
61
61
  // The JSON published to the MQTT state topic, with keys and tokens masked.
62
62
  const stateJson = (state) => JSON.stringify(maskSecretsDeep(state, [apiKey]));
63
+ // Every log, warn and error line starts with the package version, so a log excerpt in a
64
+ // bug report says which build wrote it. Status text is not prefixed (it is shown in the editor).
65
+ const VERSION_PREFIX = `v${require('./package.json').version}: `;
66
+ const tag = (m) => (typeof m === 'string' ? VERSION_PREFIX + clean(m) : m);
63
67
  const rawLog = node.log, rawWarn = node.warn, rawError = node.error, rawStatus = node.status;
64
- node.log = function (m, ...rest) { return rawLog.call(node, clean(m), ...rest); };
65
- node.warn = function (m, ...rest) { return rawWarn.call(node, clean(m), ...rest); };
66
- node.error = function (m, ...rest) { return rawError.call(node, clean(m), ...rest); };
68
+ node.log = function (m, ...rest) { return rawLog.call(node, tag(m), ...rest); };
69
+ node.warn = function (m, ...rest) { return rawWarn.call(node, tag(m), ...rest); };
70
+ node.error = function (m, ...rest) { return rawError.call(node, tag(m), ...rest); };
67
71
  node.status = function (s, ...rest) {
68
72
  const masked = s && typeof s === 'object' && typeof s.text === 'string' ? Object.assign({}, s, { text: clean(s.text) }) : clean(s);
69
73
  return rawStatus.call(node, masked, ...rest);
@@ -645,6 +649,7 @@ module.exports = function (RED) {
645
649
  // Last known full state - prevents sensors going unknown when controls change
646
650
  let lastKnownState = buildDefaultPayload({ confirmedLimit, confirmedTime, pendingLimit, pendingTime, chargingNow, smartChargingSuspended });
647
651
  lastKnownState.installed_version = require('./package.json').version;
652
+ node.log('starting');
648
653
 
649
654
  // V2 category registry — populated after discovery
650
655
  let categories = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-octopus-intelligent",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Node-RED integration for Octopus Energy Intelligent Octopus Go with Home Assistant MQTT discovery",
5
5
  "main": "octopus-intelligent.js",
6
6
  "scripts": {