node-red-contrib-power-saver 3.5.5 → 3.5.6
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/docs/changelog/README.md
CHANGED
|
@@ -6,6 +6,10 @@ sidebar: "auto"
|
|
|
6
6
|
|
|
7
7
|
List the most significant changes, starting in version 1.0.9.
|
|
8
8
|
|
|
9
|
+
## 3.5.6
|
|
10
|
+
|
|
11
|
+
- Update Elvia nodes so they use the new `digin` API. NB! There is no guarantee this is working right.
|
|
12
|
+
|
|
9
13
|
## 3.5.5
|
|
10
14
|
|
|
11
15
|
- Fix config storage for Best Save node
|
package/package.json
CHANGED
|
@@ -28,14 +28,14 @@ module.exports = function (RED) {
|
|
|
28
28
|
|
|
29
29
|
getTariffForPeriod(node, key, node.tariffKey, fromTime, toTime).then((json) => {
|
|
30
30
|
const tariff = json;
|
|
31
|
-
const priceInfo = tariff.gridTariff.tariffPrice.
|
|
31
|
+
const priceInfo = tariff.gridTariff.tariffPrice.hours;
|
|
32
32
|
if (priceInfo.length !== prices.length) {
|
|
33
33
|
node.warn(`Elvia tariff count mismatch. Expected ${prices.length} items, but got ${priceInfo.length}`);
|
|
34
34
|
node.status({ fill: "red", shape: "dot", text: "Tariff error" });
|
|
35
35
|
} else {
|
|
36
36
|
prices.forEach((p, i) => {
|
|
37
37
|
p.powerPrice = p.value;
|
|
38
|
-
p.gridTariffVariable = priceInfo[i].
|
|
38
|
+
p.gridTariffVariable = priceInfo[i].energyPrice.total;
|
|
39
39
|
p.value = roundPrice(p.powerPrice + p.gridTariffVariable);
|
|
40
40
|
});
|
|
41
41
|
}
|
package/src/elvia/elvia-api.js
CHANGED
|
@@ -2,7 +2,7 @@ const fetch = require("node-fetch");
|
|
|
2
2
|
|
|
3
3
|
function ping(node, subscriptionKey, setResultStatus = true) {
|
|
4
4
|
const url = "https://elvia.azure-api.net/grid-tariff/Ping";
|
|
5
|
-
const headers = { "
|
|
5
|
+
const headers = { "X-API-Key": subscriptionKey };
|
|
6
6
|
fetch(url, { headers }).then((res) => {
|
|
7
7
|
if (setResultStatus) {
|
|
8
8
|
setNodeStatus(node, res.status);
|
|
@@ -11,13 +11,14 @@ function ping(node, subscriptionKey, setResultStatus = true) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function getTariff(node, subscriptionKey, tariffKey, range = "today", setResultStatus = true) {
|
|
14
|
-
const url =
|
|
14
|
+
const url =
|
|
15
|
+
"https://elvia.azure-api.net/grid-tariff/digin/api/1.0/tariffquery?TariffKey=" + tariffKey + "&Range=" + range;
|
|
15
16
|
return get(node, subscriptionKey, url, setResultStatus);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
function getTariffForPeriod(node, subscriptionKey, tariffKey, startTime, endTime, setResultStatus = true) {
|
|
19
20
|
const url =
|
|
20
|
-
"https://elvia.azure-api.net/grid-tariff/api/1/tariffquery?TariffKey=" +
|
|
21
|
+
"https://elvia.azure-api.net/grid-tariff/digin/api/1.0/tariffquery?TariffKey=" +
|
|
21
22
|
tariffKey +
|
|
22
23
|
"&StartTime=" +
|
|
23
24
|
startTime +
|
|
@@ -27,12 +28,12 @@ function getTariffForPeriod(node, subscriptionKey, tariffKey, startTime, endTime
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
function getTariffTypes(node, subscriptionKey, setResultStatus = true) {
|
|
30
|
-
const url = "https://elvia.azure-api.net/grid-tariff/api/1/tarifftype";
|
|
31
|
+
const url = "https://elvia.azure-api.net/grid-tariff/digin/api/1.0/tarifftype";
|
|
31
32
|
return get(node, subscriptionKey, url, setResultStatus);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
function get(node, subscriptionKey, url, setResultStatus) {
|
|
35
|
-
const headers = { "
|
|
36
|
+
const headers = { "X-API-Key": subscriptionKey };
|
|
36
37
|
return fetch(url, { headers }).then((res) => {
|
|
37
38
|
if (setResultStatus && node) {
|
|
38
39
|
setNodeStatus(node, res.status);
|