node-red-contrib-octopus-intelligent 1.4.0 → 1.6.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 +487 -408
- package/README.md +1004 -980
- package/examples/basic-monitoring.json +1 -1
- package/examples/ha-dashboard.yaml +602 -486
- package/examples/mqtt-integration.json +1 -1
- package/examples/node-red-dashboard-flow.json +1287 -0
- package/examples/set-preferences.json +1 -1
- package/lib/api-metrics.js +31 -31
- package/lib/auth.js +20 -20
- package/lib/categories/account.js +32 -32
- package/lib/categories/applicable-rates.js +127 -91
- package/lib/categories/completed-dispatches.js +35 -35
- package/lib/categories/electricity.js +146 -133
- package/lib/categories/flex-planned-dispatches.js +36 -36
- package/lib/categories/free-electricity.js +61 -61
- package/lib/categories/gas.js +95 -95
- package/lib/categories/home-mini.js +37 -37
- package/lib/categories/intelligent.js +155 -124
- package/lib/categories/octoplus.js +32 -32
- package/lib/categories/saving-sessions.js +64 -64
- package/lib/categories/wheel-of-fortune.js +49 -49
- package/lib/commands.js +47 -0
- package/lib/discovery-retry.js +13 -0
- package/lib/discovery.js +92 -85
- package/lib/graphql-errors.js +18 -0
- package/lib/graphql.js +44 -44
- package/lib/http-get-json.js +22 -0
- package/lib/payload.js +89 -77
- package/lib/poll-tick.js +44 -44
- package/lib/preferences.js +32 -0
- package/lib/scheduler.js +47 -47
- package/lib/sensor-definitions.js +219 -0
- package/lib/timezone.js +49 -49
- package/lib/update-check.js +38 -0
- package/octopus-intelligent.html +218 -205
- package/octopus-intelligent.js +1687 -1685
- package/package.json +54 -54
package/octopus-intelligent.html
CHANGED
|
@@ -1,205 +1,218 @@
|
|
|
1
|
-
<script type="text/javascript">
|
|
2
|
-
RED.nodes.registerType('octopus-intelligent', {
|
|
3
|
-
category: 'Octopus',
|
|
4
|
-
color: '#E8146F', // Octopus Energy brand pink
|
|
5
|
-
defaults: {
|
|
6
|
-
name: { value: "Octopus Intelligent" },
|
|
7
|
-
accountNumber: { value: "", required: true },
|
|
8
|
-
broker: { type: "mqtt-broker", required: false },
|
|
9
|
-
refreshInterval: { value: 5, validate: RED.validators.number() },
|
|
10
|
-
enableMqtt: { value: true },
|
|
11
|
-
timezoneOverride: { value: "" },
|
|
12
|
-
// Electricity
|
|
13
|
-
electricityEnabled: { value: true },
|
|
14
|
-
electricityRatesInterval: { value: 60, validate: RED.validators.number() },
|
|
15
|
-
electricityConsumptionInterval: { value: 60, validate: RED.validators.number() },
|
|
16
|
-
// Gas
|
|
17
|
-
gasEnabled: { value: true },
|
|
18
|
-
gasRatesInterval: { value: 60, validate: RED.validators.number() },
|
|
19
|
-
gasConsumptionInterval: { value: 60, validate: RED.validators.number() },
|
|
20
|
-
// Wheel of Fortune
|
|
21
|
-
enableWheelOfFortune: { value: false },
|
|
22
|
-
wheelOfFortuneInterval: { value: 60, validate: RED.validators.number() },
|
|
23
|
-
// Home Mini
|
|
24
|
-
enableHomeMini: { value: false },
|
|
25
|
-
homeMiniInterval: { value: 1, validate: RED.validators.number() }
|
|
26
|
-
},
|
|
27
|
-
credentials: {
|
|
28
|
-
apiKey: { type: "password" }
|
|
29
|
-
},
|
|
30
|
-
inputs: 1,
|
|
31
|
-
outputs: 1,
|
|
32
|
-
icon: "font-awesome/fa-bolt",
|
|
33
|
-
label: function() {
|
|
34
|
-
return this.name || "Octopus Intelligent";
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<script type="text/html" data-template-name="octopus-intelligent">
|
|
40
|
-
<div class="form-row">
|
|
41
|
-
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
42
|
-
<input type="text" id="node-input-name" placeholder="Name">
|
|
43
|
-
</div>
|
|
44
|
-
<div class="form-row">
|
|
45
|
-
<label for="node-input-accountNumber"><i class="fa fa-id-card"></i> Account No</label>
|
|
46
|
-
<input type="text" id="node-input-accountNumber" placeholder="A-12345678">
|
|
47
|
-
</div>
|
|
48
|
-
<div class="form-row">
|
|
49
|
-
<label for="node-input-apiKey"><i class="fa fa-key"></i> API Key</label>
|
|
50
|
-
<input type="password" id="node-input-apiKey" placeholder="sk_live_...">
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<hr>
|
|
54
|
-
|
|
55
|
-
<div class="form-row">
|
|
56
|
-
<label for="node-input-refreshInterval"><i class="fa fa-bolt"></i> Intelligent (Min)</label>
|
|
57
|
-
<input type="number" id="node-input-refreshInterval" placeholder="5" style="width:70px;">
|
|
58
|
-
<span style="margin-left:6px;font-size:0.85em;color:#888;">Charging slots poll interval</span>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<div class="form-row">
|
|
62
|
-
<label for="node-input-timezoneOverride"><i class="fa fa-globe"></i> Timezone</label>
|
|
63
|
-
<input type="text" id="node-input-timezoneOverride" placeholder="Europe/London">
|
|
64
|
-
</div>
|
|
65
|
-
<div class="form-row">
|
|
66
|
-
<div style="margin-left: 106px; font-size: 0.85em; color: #888;">
|
|
67
|
-
Leave blank to use server timezone (auto-detected)
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
|
|
71
|
-
<div class="form-row">
|
|
72
|
-
<label for="node-input-enableMqtt"><i class="fa fa-rss"></i> HA Discovery</label>
|
|
73
|
-
<input type="checkbox" id="node-input-enableMqtt" style="display: inline-block; width: auto; vertical-align: top;">
|
|
74
|
-
<label for="node-input-enableMqtt" style="width: 70%;">Enable Home Assistant MQTT</label>
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
<div class="form-row">
|
|
78
|
-
<label for="node-input-broker"><i class="fa fa-globe"></i> MQTT Broker</label>
|
|
79
|
-
<input type="text" id="node-input-broker">
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<hr>
|
|
83
|
-
|
|
84
|
-
<div class="form-row">
|
|
85
|
-
<label style="width:100%;font-weight:bold;color:#555;margin-bottom:2px;">
|
|
86
|
-
<i class="fa fa-clock-o"></i> API Polling Intervals (minutes)
|
|
87
|
-
</label>
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
91
|
-
<label for="node-input-electricityEnabled" style="width:120px;flex-shrink:0;">
|
|
92
|
-
<i class="fa fa-bolt"></i> Electricity
|
|
93
|
-
</label>
|
|
94
|
-
<input type="checkbox" id="node-input-electricityEnabled" style="width:auto;">
|
|
95
|
-
<span style="font-size:0.85em;color:#555;margin-left:6px;">Rates:</span>
|
|
96
|
-
<input type="number" id="node-input-electricityRatesInterval" style="width:55px;" placeholder="60">
|
|
97
|
-
<span style="font-size:0.85em;color:#555;">Consumption:</span>
|
|
98
|
-
<input type="number" id="node-input-electricityConsumptionInterval" style="width:55px;" placeholder="60">
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
102
|
-
<label for="node-input-gasEnabled" style="width:120px;flex-shrink:0;">
|
|
103
|
-
<i class="fa fa-fire"></i> Gas
|
|
104
|
-
</label>
|
|
105
|
-
<input type="checkbox" id="node-input-gasEnabled" style="width:auto;">
|
|
106
|
-
<span style="font-size:0.85em;color:#555;margin-left:6px;">Rates:</span>
|
|
107
|
-
<input type="number" id="node-input-gasRatesInterval" style="width:55px;" placeholder="60">
|
|
108
|
-
<span style="font-size:0.85em;color:#555;">Consumption:</span>
|
|
109
|
-
<input type="number" id="node-input-gasConsumptionInterval" style="width:55px;" placeholder="60">
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
113
|
-
<label for="node-input-enableWheelOfFortune" style="width:120px;flex-shrink:0;">
|
|
114
|
-
<i class="fa fa-star"></i> Wheel of Fortune
|
|
115
|
-
</label>
|
|
116
|
-
<input type="checkbox" id="node-input-enableWheelOfFortune" style="width:auto;">
|
|
117
|
-
<span style="font-size:0.85em;color:#666;margin-left:4px;">Octoplus only</span>
|
|
118
|
-
<span style="font-size:0.85em;color:#555;margin-left:6px;">Every:</span>
|
|
119
|
-
<input type="number" id="node-input-wheelOfFortuneInterval" style="width:55px;" placeholder="60">
|
|
120
|
-
<span style="font-size:0.85em;color:#888;">min</span>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
124
|
-
<label for="node-input-enableHomeMini" style="width:120px;flex-shrink:0;">
|
|
125
|
-
<i class="fa fa-home"></i> Home Mini
|
|
126
|
-
</label>
|
|
127
|
-
<input type="checkbox" id="node-input-enableHomeMini" style="width:auto;">
|
|
128
|
-
<span style="font-size:0.85em;color:#666;margin-left:4px;">requires hardware</span>
|
|
129
|
-
<span style="font-size:0.85em;color:#555;margin-left:6px;">Every:</span>
|
|
130
|
-
<input type="number" id="node-input-homeMiniInterval" style="width:55px;" placeholder="1">
|
|
131
|
-
<span style="font-size:0.85em;color:#888;">min</span>
|
|
132
|
-
</div>
|
|
133
|
-
</script>
|
|
134
|
-
|
|
135
|
-
<script type="text/html" data-help-name="octopus-intelligent">
|
|
136
|
-
<p>This node integrates with the <strong>Octopus Energy Intelligent Octopus Go</strong> API to retrieve planned charging slots and preferences.</p>
|
|
137
|
-
<p>Configure your Account Number and API Key, then deploy the flow. The node will fetch data at regular intervals and output charging information.</p>
|
|
138
|
-
<p>Enable MQTT to automatically configure Home Assistant entities via auto-discovery.</p>
|
|
139
|
-
|
|
140
|
-
<h3>Examples</h3>
|
|
141
|
-
|
|
142
|
-
<h4>1. Basic Monitoring</h4>
|
|
143
|
-
<p>Monitor your charging slots every 5 minutes:</p>
|
|
144
|
-
<pre>[{"id":"1","type":"inject","name":"Every 5 min","props":[{"p":"payload"}],"repeat":"300","crontab":"","once":true,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":false,"x":340,"y":80,"wires":[["3"]]},{"id":"3","type":"debug","name":"Debug Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":80,"wires":[]}]</pre>
|
|
145
|
-
|
|
146
|
-
<h4>2. Set Preferences from Flow</h4>
|
|
147
|
-
<p>Control charge limit and ready time programmatically:</p>
|
|
148
|
-
<pre>[{"id":"1","type":"inject","name":"Set 85% by 07:30","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"{\"set_limit\":85,\"set_time\":\"07:30\"}","payloadType":"json","x":150,"y":140,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":true,"mqttBroker":"mqtt-broker","x":380,"y":140,"wires":[["3"]]},{"id":"3","type":"debug","name":"Confirmation","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":140,"wires":[]}]</pre>
|
|
149
|
-
|
|
150
|
-
<
|
|
151
|
-
|
|
152
|
-
<
|
|
153
|
-
|
|
154
|
-
<
|
|
155
|
-
<p
|
|
156
|
-
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
<
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<p
|
|
164
|
-
<
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
<
|
|
168
|
-
<
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
"
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
</
|
|
1
|
+
<script type="text/javascript">
|
|
2
|
+
RED.nodes.registerType('octopus-intelligent', {
|
|
3
|
+
category: 'Octopus',
|
|
4
|
+
color: '#E8146F', // Octopus Energy brand pink
|
|
5
|
+
defaults: {
|
|
6
|
+
name: { value: "Octopus Intelligent" },
|
|
7
|
+
accountNumber: { value: "", required: true },
|
|
8
|
+
broker: { type: "mqtt-broker", required: false },
|
|
9
|
+
refreshInterval: { value: 5, validate: RED.validators.number() },
|
|
10
|
+
enableMqtt: { value: true },
|
|
11
|
+
timezoneOverride: { value: "" },
|
|
12
|
+
// Electricity
|
|
13
|
+
electricityEnabled: { value: true },
|
|
14
|
+
electricityRatesInterval: { value: 60, validate: RED.validators.number() },
|
|
15
|
+
electricityConsumptionInterval: { value: 60, validate: RED.validators.number() },
|
|
16
|
+
// Gas
|
|
17
|
+
gasEnabled: { value: true },
|
|
18
|
+
gasRatesInterval: { value: 60, validate: RED.validators.number() },
|
|
19
|
+
gasConsumptionInterval: { value: 60, validate: RED.validators.number() },
|
|
20
|
+
// Wheel of Fortune
|
|
21
|
+
enableWheelOfFortune: { value: false },
|
|
22
|
+
wheelOfFortuneInterval: { value: 60, validate: RED.validators.number() },
|
|
23
|
+
// Home Mini
|
|
24
|
+
enableHomeMini: { value: false },
|
|
25
|
+
homeMiniInterval: { value: 1, validate: RED.validators.number() }
|
|
26
|
+
},
|
|
27
|
+
credentials: {
|
|
28
|
+
apiKey: { type: "password" }
|
|
29
|
+
},
|
|
30
|
+
inputs: 1,
|
|
31
|
+
outputs: 1,
|
|
32
|
+
icon: "font-awesome/fa-bolt",
|
|
33
|
+
label: function() {
|
|
34
|
+
return this.name || "Octopus Intelligent";
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<script type="text/html" data-template-name="octopus-intelligent">
|
|
40
|
+
<div class="form-row">
|
|
41
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
42
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
43
|
+
</div>
|
|
44
|
+
<div class="form-row">
|
|
45
|
+
<label for="node-input-accountNumber"><i class="fa fa-id-card"></i> Account No</label>
|
|
46
|
+
<input type="text" id="node-input-accountNumber" placeholder="A-12345678">
|
|
47
|
+
</div>
|
|
48
|
+
<div class="form-row">
|
|
49
|
+
<label for="node-input-apiKey"><i class="fa fa-key"></i> API Key</label>
|
|
50
|
+
<input type="password" id="node-input-apiKey" placeholder="sk_live_...">
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<hr>
|
|
54
|
+
|
|
55
|
+
<div class="form-row">
|
|
56
|
+
<label for="node-input-refreshInterval"><i class="fa fa-bolt"></i> Intelligent (Min)</label>
|
|
57
|
+
<input type="number" id="node-input-refreshInterval" placeholder="5" style="width:70px;">
|
|
58
|
+
<span style="margin-left:6px;font-size:0.85em;color:#888;">Charging slots poll interval</span>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="form-row">
|
|
62
|
+
<label for="node-input-timezoneOverride"><i class="fa fa-globe"></i> Timezone</label>
|
|
63
|
+
<input type="text" id="node-input-timezoneOverride" placeholder="Europe/London">
|
|
64
|
+
</div>
|
|
65
|
+
<div class="form-row">
|
|
66
|
+
<div style="margin-left: 106px; font-size: 0.85em; color: #888;">
|
|
67
|
+
Leave blank to use server timezone (auto-detected)
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div class="form-row">
|
|
72
|
+
<label for="node-input-enableMqtt"><i class="fa fa-rss"></i> HA Discovery</label>
|
|
73
|
+
<input type="checkbox" id="node-input-enableMqtt" style="display: inline-block; width: auto; vertical-align: top;">
|
|
74
|
+
<label for="node-input-enableMqtt" style="width: 70%;">Enable Home Assistant MQTT</label>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div class="form-row">
|
|
78
|
+
<label for="node-input-broker"><i class="fa fa-globe"></i> MQTT Broker</label>
|
|
79
|
+
<input type="text" id="node-input-broker">
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<hr>
|
|
83
|
+
|
|
84
|
+
<div class="form-row">
|
|
85
|
+
<label style="width:100%;font-weight:bold;color:#555;margin-bottom:2px;">
|
|
86
|
+
<i class="fa fa-clock-o"></i> API Polling Intervals (minutes)
|
|
87
|
+
</label>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
91
|
+
<label for="node-input-electricityEnabled" style="width:120px;flex-shrink:0;">
|
|
92
|
+
<i class="fa fa-bolt"></i> Electricity
|
|
93
|
+
</label>
|
|
94
|
+
<input type="checkbox" id="node-input-electricityEnabled" style="width:auto;">
|
|
95
|
+
<span style="font-size:0.85em;color:#555;margin-left:6px;">Rates:</span>
|
|
96
|
+
<input type="number" id="node-input-electricityRatesInterval" style="width:55px;" placeholder="60">
|
|
97
|
+
<span style="font-size:0.85em;color:#555;">Consumption:</span>
|
|
98
|
+
<input type="number" id="node-input-electricityConsumptionInterval" style="width:55px;" placeholder="60">
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
102
|
+
<label for="node-input-gasEnabled" style="width:120px;flex-shrink:0;">
|
|
103
|
+
<i class="fa fa-fire"></i> Gas
|
|
104
|
+
</label>
|
|
105
|
+
<input type="checkbox" id="node-input-gasEnabled" style="width:auto;">
|
|
106
|
+
<span style="font-size:0.85em;color:#555;margin-left:6px;">Rates:</span>
|
|
107
|
+
<input type="number" id="node-input-gasRatesInterval" style="width:55px;" placeholder="60">
|
|
108
|
+
<span style="font-size:0.85em;color:#555;">Consumption:</span>
|
|
109
|
+
<input type="number" id="node-input-gasConsumptionInterval" style="width:55px;" placeholder="60">
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
113
|
+
<label for="node-input-enableWheelOfFortune" style="width:120px;flex-shrink:0;">
|
|
114
|
+
<i class="fa fa-star"></i> Wheel of Fortune
|
|
115
|
+
</label>
|
|
116
|
+
<input type="checkbox" id="node-input-enableWheelOfFortune" style="width:auto;">
|
|
117
|
+
<span style="font-size:0.85em;color:#666;margin-left:4px;">Octoplus only</span>
|
|
118
|
+
<span style="font-size:0.85em;color:#555;margin-left:6px;">Every:</span>
|
|
119
|
+
<input type="number" id="node-input-wheelOfFortuneInterval" style="width:55px;" placeholder="60">
|
|
120
|
+
<span style="font-size:0.85em;color:#888;">min</span>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div class="form-row" style="display:flex;align-items:center;flex-wrap:wrap;gap:6px;">
|
|
124
|
+
<label for="node-input-enableHomeMini" style="width:120px;flex-shrink:0;">
|
|
125
|
+
<i class="fa fa-home"></i> Home Mini
|
|
126
|
+
</label>
|
|
127
|
+
<input type="checkbox" id="node-input-enableHomeMini" style="width:auto;">
|
|
128
|
+
<span style="font-size:0.85em;color:#666;margin-left:4px;">requires hardware</span>
|
|
129
|
+
<span style="font-size:0.85em;color:#555;margin-left:6px;">Every:</span>
|
|
130
|
+
<input type="number" id="node-input-homeMiniInterval" style="width:55px;" placeholder="1">
|
|
131
|
+
<span style="font-size:0.85em;color:#888;">min</span>
|
|
132
|
+
</div>
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<script type="text/html" data-help-name="octopus-intelligent">
|
|
136
|
+
<p>This node integrates with the <strong>Octopus Energy Intelligent Octopus Go</strong> API to retrieve planned charging slots and preferences.</p>
|
|
137
|
+
<p>Configure your Account Number and API Key, then deploy the flow. The node will fetch data at regular intervals and output charging information.</p>
|
|
138
|
+
<p>Enable MQTT to automatically configure Home Assistant entities via auto-discovery.</p>
|
|
139
|
+
|
|
140
|
+
<h3>Examples</h3>
|
|
141
|
+
|
|
142
|
+
<h4>1. Basic Monitoring</h4>
|
|
143
|
+
<p>Monitor your charging slots every 5 minutes:</p>
|
|
144
|
+
<pre>[{"id":"1","type":"inject","name":"Every 5 min","props":[{"p":"payload"}],"repeat":"300","crontab":"","once":true,"topic":"","payload":"","payloadType":"date","x":130,"y":80,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":false,"x":340,"y":80,"wires":[["3"]]},{"id":"3","type":"debug","name":"Debug Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":80,"wires":[]}]</pre>
|
|
145
|
+
|
|
146
|
+
<h4>2. Set Preferences from Flow</h4>
|
|
147
|
+
<p>Control charge limit and ready time programmatically:</p>
|
|
148
|
+
<pre>[{"id":"1","type":"inject","name":"Set 85% by 07:30","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"{\"set_limit\":85,\"set_time\":\"07:30\"}","payloadType":"json","x":150,"y":140,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":true,"mqttBroker":"mqtt-broker","x":380,"y":140,"wires":[["3"]]},{"id":"3","type":"debug","name":"Confirmation","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":140,"wires":[]}]</pre>
|
|
149
|
+
|
|
150
|
+
<p>Ready-by time: any half-hour slot from 00:00 to 23:30 (matches the Octopus app). Other values are rejected with an error and nothing is sent to Octopus. Charge limit values clamp to 5–100 and round to 5; non-numeric values and <code>set_limit: 0</code> are rejected.</p>
|
|
151
|
+
|
|
152
|
+
<h4>Charge Cap</h4>
|
|
153
|
+
<p>Limit smart charging to off-peak rates only (as in the Octopus app). Non-boolean values are ignored. Also available as the <strong>Charge Cap</strong> switch in Home Assistant:</p>
|
|
154
|
+
<pre>msg.payload = { set_charge_cap: true };</pre>
|
|
155
|
+
<p>The <code>charge_cap</code> payload field is <code>true</code>/<code>false</code> when Charge Cap is on/off, and <code>null</code> when not applicable to the device.</p>
|
|
156
|
+
|
|
157
|
+
<h4>Combining commands</h4>
|
|
158
|
+
<p>One message can carry several commands, and each is applied independently:</p>
|
|
159
|
+
<pre>msg.payload = { set_limit: 90, set_time: "06:30", set_charge_cap: true };</pre>
|
|
160
|
+
<p><code>set_limit</code> and <code>set_time</code> are sent to Octopus together, so an invalid value in either rejects both; other commands in the same message still apply.</p>
|
|
161
|
+
|
|
162
|
+
<h4>3. Home Assistant MQTT Integration</h4>
|
|
163
|
+
<p>Automatically create Home Assistant entities via MQTT discovery:</p>
|
|
164
|
+
<pre>[{"id":"1","type":"inject","name":"Every 5 min","props":[{"p":"payload"}],"repeat":"300","crontab":"","once":true,"topic":"","payload":"","payloadType":"date","x":130,"y":200,"wires":[["2"]]},{"id":"2","type":"octopus-intelligent","name":"Octopus Intelligent","account":"A-XXXXXXXX","apiKey":"sk_live_...","refreshInterval":"5","enableMqtt":true,"mqttBroker":"mqtt-broker","x":340,"y":200,"wires":[["3"]]},{"id":"3","type":"debug","name":"Debug Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":200,"wires":[]},{"id":"mqtt-broker","type":"mqtt-broker","name":"Home Assistant MQTT","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]</pre>
|
|
165
|
+
|
|
166
|
+
<h3>Visual Examples</h3>
|
|
167
|
+
<p><strong>Node-RED Flow Examples:</strong></p>
|
|
168
|
+
<img src="https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/basic-monitoring-flow.png" alt="Node-RED Flow Examples" style="max-width: 100%; border: 1px solid #ddd; border-radius: 4px;">
|
|
169
|
+
<p style="margin-top: 8px;"><em>Reads by default, manually refreshable from a button, pass in commands to change charge time and percentage</em></p>
|
|
170
|
+
|
|
171
|
+
<p style="margin-top: 16px;"><strong>MQTT Integration:</strong></p>
|
|
172
|
+
<img src="https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/mqtt-integration-flow.png" alt="MQTT Integration Flow" style="max-width: 100%; border: 1px solid #ddd; border-radius: 4px;">
|
|
173
|
+
<p style="margin-top: 8px;"><em>Complete MQTT integration with Home Assistant</em></p>
|
|
174
|
+
|
|
175
|
+
<p style="margin-top: 16px;"><strong>Home Assistant Device:</strong></p>
|
|
176
|
+
<img src="https://raw.githubusercontent.com/ASomerN/node-red-contrib-octopus-intelligent/master/images/examples/homeassistant-device.png" alt="Home Assistant Device" style="max-width: 100%; border: 1px solid #ddd; border-radius: 4px;">
|
|
177
|
+
<p style="margin-top: 8px;"><em>Octopus Intelligent device with all controls and sensors automatically configured</em></p>
|
|
178
|
+
|
|
179
|
+
<h3>Output Format</h3>
|
|
180
|
+
<p>The node outputs a message with the following structure:</p>
|
|
181
|
+
<pre>{
|
|
182
|
+
"payload": {
|
|
183
|
+
"next_start": "2025-11-29T01:30:00Z",
|
|
184
|
+
"total_energy": 42.5,
|
|
185
|
+
"next_kwh": "15.20",
|
|
186
|
+
"next_source": "smart-charge",
|
|
187
|
+
"confirmed_limit": 80,
|
|
188
|
+
"confirmed_time": "07:00",
|
|
189
|
+
"charging_now": false,
|
|
190
|
+
"charge_cap": false,
|
|
191
|
+
"slot1_start": "2025-11-29T01:30:00Z",
|
|
192
|
+
"slot1_end": "2025-11-29T05:30:00Z"
|
|
193
|
+
},
|
|
194
|
+
"debug": {
|
|
195
|
+
"success": true,
|
|
196
|
+
"step": "complete",
|
|
197
|
+
"apiCalls": [...]
|
|
198
|
+
}
|
|
199
|
+
}</pre>
|
|
200
|
+
|
|
201
|
+
<h3>Home Assistant Integration</h3>
|
|
202
|
+
<p>When MQTT is enabled, the node automatically creates:</p>
|
|
203
|
+
<ul>
|
|
204
|
+
<li><strong>Controls:</strong> Target charge slider, ready time selector, apply changes button, Charge Cap switch</li>
|
|
205
|
+
<li><strong>Sensors:</strong> Next charge time, total energy, charging status, individual slots</li>
|
|
206
|
+
<li><strong>Binary Sensor:</strong> Charging now indicator (ON/OFF)</li>
|
|
207
|
+
</ul>
|
|
208
|
+
<p>All entities appear under a single "Octopus Intelligent" device in Home Assistant.</p>
|
|
209
|
+
|
|
210
|
+
<h3>Requirements</h3>
|
|
211
|
+
<ul>
|
|
212
|
+
<li>Octopus Energy account with Intelligent Octopus Go tariff</li>
|
|
213
|
+
<li>API key from <a href="https://octopus.energy/dashboard/new/accounts/personal-details/api-access" target="_blank">Octopus dashboard</a></li>
|
|
214
|
+
<li>MQTT broker (optional, for Home Assistant integration)</li>
|
|
215
|
+
</ul>
|
|
216
|
+
|
|
217
|
+
<p>See the <a href="https://github.com/ASomerN/node-red-contrib-octopus-intelligent/blob/master/README.md" target="_blank">full documentation</a> for details.</p>
|
|
218
|
+
</script>
|