-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathoctopus.html
133 lines (127 loc) · 6.32 KB
/
octopus.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<script type="text/x-red" data-template-name="octopus in">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="octopus">
</div>
<div class="form-row">
<label for="node-input-region"><i class="fa fa-tag"></i> Energy Region</label>
<select id="node-input-region" style="width:180px;">
<option value="A">_A - East England</option>
<option value="B">_B - East Midlands</option>
<option value="C">_C - London</option>
<option value="D">_D - North Wales, Merseyside and Cheshire</option>
<option value="E">_E - West Midlands</option>
<option value="F">_F - North East England</option>
<option value="G">_G - North West England</option>
<option value="H">_H - Southern England</option>
<option value="J">_J - South East England</option>
<option value="K">_K - South Wales</option>
<option value="L">_L - South West England</option>
<option value="M">_M - Yorkshire</option>
<option value="N">_N - South Scotland</option>
<option value="P">_P - North Scotland</option>
</select>
</div>
<div class="form-row">
<label for="node-input-numblocks"><i class="fa fa-globe"></i> Period length</label>
<input type="text" id="node-input-numblocks">
</div>
<!-- <div class="form-row">
<label for="node-config-input-apikey"><i class="fa fa-tasks"></i> API key</label>
<input type="text" id="node-config-input-apikey">
</div> -->
<div class="form-tips">The <b>Period length</b> is the number of 30 minute blocks to average to find cheapest period of that length (e.g. 2,4 for 60 min and 120min periods).</div>
</script>
<script type="text/x-red" data-help-name="octopus in">
<h3>Inputs</h3>
<dl class="message-properties">
<dt>inject
<span class="property-type">any</span>
</dt>
<dd>An injection to trigger node. Recommend this is done once every 30 minutes. Node will only fire once during a
data period to protect. Input should be a timestamp. If a non-numeric value is injected, the flow will run immediately
(for testing purposes)
</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Raw Data
<dl class="message-properties">
<dt>payload <span class="property-type">object</span></dt>
<dd>The raw data from the API call</dd>
</dl>
</li>
<li>Processed Data
<dl class="message-properties">
<dt>payload <span class="property-type">string</span></dt>
<dd>the standard error of the command.</dd>
<dt>payload.current_price<span class="property-type">float</span></dt>
<dd>Current period price</dd>
<dt>payload.next_price<span class="property-type">float</span></dt>
<dd>Next period price</dd>
<dt>payload.min_price_inc_vat<span class="property-type">float</span></dt>
<dd>Minimum Price within available data</dd>
<dt>payload.max_price_inc_vat<span class="property-type">float</span></dt>
<dd>Maximum Price within available data</dd>
<dt>min_blocks<span class="property-type">Array</span></dt>
<dd>An array of minimum price blocks</dd>
<ul>
<dt>min Block Price<span class="property-type">float</span></dt>
<dd>Block Price (average over periods)</dd>
<dt>min Block valid From<span class="property-type">ISO Date</span></dt>
<dd>Valid from (when block period starts)</dd>
<dt>min_block_size_mins<span class="property-type">integer</span></dt>
<dd>Length of block in minutes</dd>
</ul>
</dl>
</li>
<li>InfluxDB Formatted Data (influxdb out node)
<dl class="message-properties">
<dt>payload<span class="property-type">array</span></dt>
<dd>Array of data pairs of value and time. The 'source' is set to 'Agile'</dd>
<dt>measurement<span class="property-type">string</span></dt>
<dd>A value for the InfluxDB measurement value (default OctopusPrice).
Can be overwritten in the InfluxDB input node</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p>Query the Octopus Agile API for future pricing.
<p>The pricing data is broken up into 30 min periods. The data for the next 24Hrs (23:00Z - 23:00Z) is released
at approximately 16:00Z. The request is set to obtain all data available from now so the number of data periods
returned by the API varies between approximately 15 and 63.
<p>This node has 3 outputs; the raw data, a set of processed data most likely to be useful to the user and a preformatted output for InfluxDB.
<p>The API is queried once per 30 minute period as close to the boundary as possible. To force the node to
request the data, the flow must be re-deployed.
<h3>References</h3>
<ul>
<li><a href="https://developer.octopus.energy/docs/api/">Octopus API docs</a> </li>
</ul>
</script>
<script type="text/javascript">
RED.nodes.registerType('octopus in',{
category: 'input',
color:"rgb(91, 192, 222)",
defaults: {
name: {value:"Octopus"},
region: {value:"A"},
numblocks: {value:"4"}
},
inputs:1,
outputs:3,
outputLabels: ["raw","processed","influxdb"],
icon: "octopus.png",
align: "right",
label: function() {
return this.name||this.region;
},
labelStyle: function() {
return this.name?"node_label_italic":"";
// },
// oneditprepare: function() {
// if (this.datatype === undefined) {
// $("#node-input-region").val("");
// }
}
});
</script>