node-red-contrib-power-saver 2.0.5 → 3.0.2

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.
Files changed (177) hide show
  1. package/.github/FUNDING.yml +12 -0
  2. package/CHANGELOG.md +1 -37
  3. package/README.md +3 -191
  4. package/docs/.vuepress/config.js +67 -0
  5. package/docs/.vuepress/dist/404.html +15 -0
  6. package/docs/.vuepress/dist/assets/css/styles.e835bef6.css +8 -0
  7. package/docs/.vuepress/dist/assets/img/back-to-top.8b37f773.svg +1 -0
  8. package/docs/.vuepress/dist/assets/img/elvia-config-no-config.b4bb972c.png +0 -0
  9. package/docs/.vuepress/dist/assets/img/elvia-config-no-tariff.3f89aba8.png +0 -0
  10. package/docs/.vuepress/dist/assets/img/elvia-config-select-tariff.0f73fd56.png +0 -0
  11. package/docs/.vuepress/dist/assets/img/elvia-config-subscription-key.8be8ab8a.png +0 -0
  12. package/docs/.vuepress/dist/assets/img/elvia-flow.bae2a4d5.png +0 -0
  13. package/docs/.vuepress/dist/assets/img/example-flow-1.3ff3e23f.png +0 -0
  14. package/docs/.vuepress/dist/assets/img/example-flow-2.b653b58d.png +0 -0
  15. package/docs/.vuepress/dist/assets/img/migrate-best-save.f73420f6.png +0 -0
  16. package/docs/.vuepress/dist/assets/img/migrate-power-saver.aae13f9d.png +0 -0
  17. package/docs/.vuepress/dist/assets/img/node-power-saver.51ff2e5d.png +0 -0
  18. package/docs/.vuepress/dist/assets/img/node-ps-elvia-add-tariff.94ea2b09.png +0 -0
  19. package/docs/.vuepress/dist/assets/img/node-ps-receive-price.76eaa418.png +0 -0
  20. package/docs/.vuepress/dist/assets/img/node-ps-strategy-best-save.392292d5.png +0 -0
  21. package/docs/.vuepress/dist/assets/img/node-ps-strategy-lowest-price.3a4ad347.png +0 -0
  22. package/docs/.vuepress/dist/assets/img/power-saver-nordpool-current-state.bf14afde.png +0 -0
  23. package/docs/.vuepress/dist/assets/img/power-saver-nordpool-events-state.8c392507.png +0 -0
  24. package/docs/.vuepress/dist/assets/img/power-saver-tibber-mqtt.16891dd2.png +0 -0
  25. package/docs/.vuepress/dist/assets/js/293.5e967839.js +1 -0
  26. package/docs/.vuepress/dist/assets/js/491.c183eba3.js +1 -0
  27. package/docs/.vuepress/dist/assets/js/812.79dad458.js +2 -0
  28. package/docs/.vuepress/dist/assets/js/812.79dad458.js.LICENSE.txt +8 -0
  29. package/docs/.vuepress/dist/assets/js/app.4ee3384b.js +1 -0
  30. package/docs/.vuepress/dist/assets/js/runtime~app.cafd6537.js +1 -0
  31. package/docs/.vuepress/dist/assets/js/v-08683c60.07fe8291.js +1 -0
  32. package/docs/.vuepress/dist/assets/js/v-0aca7ba6.aec5ba75.js +1 -0
  33. package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.d008d8bc.js +1 -0
  34. package/docs/.vuepress/dist/assets/js/v-1ad821fa.85407071.js +1 -0
  35. package/docs/.vuepress/dist/assets/js/v-30acb564.73b8e29f.js +1 -0
  36. package/docs/.vuepress/dist/assets/js/v-3706649a.d7f73384.js +1 -0
  37. package/docs/.vuepress/dist/assets/js/v-4637f9e4.22ab9413.js +1 -0
  38. package/docs/.vuepress/dist/assets/js/v-510ed0d4.204a09ec.js +1 -0
  39. package/docs/.vuepress/dist/assets/js/v-5954bcb2.be07962c.js +1 -0
  40. package/docs/.vuepress/dist/assets/js/v-5db8da3a.ac192f35.js +1 -0
  41. package/docs/.vuepress/dist/assets/js/v-61f728ca.802ab15e.js +1 -0
  42. package/docs/.vuepress/dist/assets/js/v-677dfaed.9bbbd037.js +1 -0
  43. package/docs/.vuepress/dist/assets/js/v-7c87f26e.457a1a60.js +1 -0
  44. package/docs/.vuepress/dist/assets/js/v-8daa1a0e.db8b59c6.js +1 -0
  45. package/docs/.vuepress/dist/assets/js/v-b4a42144.6e0c5aa0.js +1 -0
  46. package/docs/.vuepress/dist/assets/js/v-e8c55052.5f85b6cd.js +1 -0
  47. package/docs/.vuepress/dist/assets/js/v-fffb8e28.e815e852.js +1 -0
  48. package/docs/.vuepress/dist/changelog/index.html +15 -0
  49. package/docs/.vuepress/dist/contribute/index.html +15 -0
  50. package/docs/.vuepress/dist/euro.png +0 -0
  51. package/docs/.vuepress/dist/examples/example-nordpool-current-state.html +169 -0
  52. package/docs/.vuepress/dist/examples/example-nordpool-events-state.html +173 -0
  53. package/docs/.vuepress/dist/examples/example-tibber-mqtt.html +182 -0
  54. package/docs/.vuepress/dist/examples/index.html +15 -0
  55. package/docs/.vuepress/dist/guide/index.html +52 -0
  56. package/docs/.vuepress/dist/index.html +15 -0
  57. package/docs/.vuepress/dist/logo.png +0 -0
  58. package/docs/.vuepress/dist/nodes/index.html +15 -0
  59. package/docs/.vuepress/dist/nodes/old-power-saver-doc.html +97 -0
  60. package/docs/.vuepress/dist/nodes/power-saver.html +15 -0
  61. package/docs/.vuepress/dist/nodes/ps-elvia-add-tariff.html +15 -0
  62. package/docs/.vuepress/dist/nodes/ps-receive-price.html +80 -0
  63. package/docs/.vuepress/dist/nodes/ps-strategy-best-save.html +65 -0
  64. package/docs/.vuepress/dist/nodes/ps-strategy-lowest-price.html +89 -0
  65. package/docs/.vuepress/dist/nodes/strategy-input.html +40 -0
  66. package/docs/.vuepress/public/euro.png +0 -0
  67. package/docs/.vuepress/public/logo.png +0 -0
  68. package/docs/README.md +32 -0
  69. package/docs/changelog/README.md +65 -0
  70. package/docs/contribute/README.md +39 -0
  71. package/docs/examples/README.md +5 -0
  72. package/docs/examples/example-nordpool-current-state.md +166 -0
  73. package/docs/examples/example-nordpool-events-state.md +170 -0
  74. package/docs/examples/example-tibber-mqtt.md +179 -0
  75. package/docs/guide/README.md +202 -0
  76. package/docs/images/all-nodes.png +0 -0
  77. package/docs/images/best-save-config.png +0 -0
  78. package/docs/images/elvia-add-tariff-node-used.png +0 -0
  79. package/docs/images/elvia-config-no-config.png +0 -0
  80. package/docs/images/elvia-config-no-tariff.png +0 -0
  81. package/docs/images/elvia-config-select-tariff.png +0 -0
  82. package/docs/images/elvia-config-subscription-key.png +0 -0
  83. package/docs/images/elvia-flow.png +0 -0
  84. package/docs/images/elvia-tariff-config.png +0 -0
  85. package/docs/images/euro.png +0 -0
  86. package/docs/images/example-flow-1.png +0 -0
  87. package/docs/images/example-flow-2.png +0 -0
  88. package/docs/images/logo.png +0 -0
  89. package/docs/images/lowest-price-config.png +0 -0
  90. package/docs/images/migrate-best-save.png +0 -0
  91. package/docs/images/migrate-power-saver.png +0 -0
  92. package/docs/images/node-power-saver.png +0 -0
  93. package/docs/images/node-ps-elvia-add-tariff.png +0 -0
  94. package/docs/images/node-ps-elvia-tariff-types.png +0 -0
  95. package/docs/images/node-ps-elvia-tariff.png +0 -0
  96. package/docs/images/node-ps-receive-price.png +0 -0
  97. package/docs/images/node-ps-strategy-best-save.png +0 -0
  98. package/docs/images/node-ps-strategy-lowest-price.png +0 -0
  99. package/{doc → docs/images}/node-red-contrib-power-saver-flow.png +0 -0
  100. package/docs/images/power-saver-nordpool-current-state.png +0 -0
  101. package/docs/images/power-saver-nordpool-events-state.png +0 -0
  102. package/docs/images/power-saver-tibber-mqtt.png +0 -0
  103. package/docs/nodes/README.md +53 -0
  104. package/docs/nodes/old-power-saver-doc.md +231 -0
  105. package/docs/nodes/power-saver.md +23 -0
  106. package/docs/nodes/ps-elvia-add-tariff.md +52 -0
  107. package/docs/nodes/ps-receive-price.md +153 -0
  108. package/docs/nodes/ps-strategy-best-save.md +142 -0
  109. package/docs/nodes/ps-strategy-lowest-price.md +165 -0
  110. package/docs/nodes/strategy-input.md +39 -0
  111. package/package.json +19 -4
  112. package/src/elvia/elvia-add-tariff.html +70 -0
  113. package/src/elvia/elvia-add-tariff.js +47 -0
  114. package/src/elvia/elvia-api.js +61 -0
  115. package/src/elvia/elvia-config.html +46 -0
  116. package/src/elvia/elvia-config.js +19 -0
  117. package/src/elvia/elvia-tariff-types.html +34 -0
  118. package/src/elvia/elvia-tariff-types.js +25 -0
  119. package/src/elvia/elvia-tariff.html +89 -0
  120. package/src/elvia/elvia-tariff.js +22 -0
  121. package/src/elvia/icons/elvia_hvite.svg +4 -0
  122. package/src/elvia/icons/elvia_positive_4 copy.svg +4 -0
  123. package/src/handle-input.js +162 -0
  124. package/src/power-saver.html +116 -0
  125. package/{power-saver.js → src/power-saver.js} +90 -72
  126. package/src/receive-price-functions.js +99 -0
  127. package/src/receive-price.html +30 -0
  128. package/src/receive-price.js +21 -0
  129. package/src/strategy-best-save-functions.js +110 -0
  130. package/src/strategy-best-save.html +116 -0
  131. package/src/strategy-best-save.js +95 -0
  132. package/src/strategy-lowest-price-functions.js +35 -0
  133. package/src/strategy-lowest-price.html +168 -0
  134. package/src/strategy-lowest-price.js +125 -0
  135. package/{utils.js → src/utils.js} +59 -104
  136. package/test/data/adjustedResult.js +302 -0
  137. package/test/data/adjustedResult_old.js +154 -0
  138. package/test/data/best-save-result.json +357 -0
  139. package/test/data/converted-prices.json +196 -0
  140. package/test/data/elvia-input-grid-tariff.json +760 -0
  141. package/test/data/elvia-input-power-prices.json +194 -0
  142. package/test/data/elvia-output-add-tariff.json +290 -0
  143. package/test/data/lowest-price-result-cont.json +18 -0
  144. package/test/data/lowest-price-result-split-allday.json +21 -0
  145. package/test/data/lowest-price-result-split-allday10.json +20 -0
  146. package/test/data/lowest-price-result-split.json +20 -0
  147. package/test/data/nordpool-current-state-prices.json +283 -0
  148. package/test/data/nordpool-event-prices.json +574 -0
  149. package/test/data/reconfigResult.js +315 -0
  150. package/test/data/reconfigResult_old.js +141 -0
  151. package/test/data/result.js +1 -0
  152. package/test/data/tibber-prices-single-home.json +64 -0
  153. package/test/data/tibber-prices.json +124 -0
  154. package/test/data/{tibber_result.json → tibber-result.json} +2 -1
  155. package/test/elvia.test.js +26 -0
  156. package/test/mostSavedStrategy.test.js +22 -55
  157. package/test/power-saver.test.js +4 -38
  158. package/test/receive-price-functions.test.js +153 -0
  159. package/test/receive-price.test.js +122 -0
  160. package/test/send-config-input.test.js +121 -0
  161. package/test/strategy-best-save-test-utils.js +32 -0
  162. package/test/strategy-best-save.test.js +103 -0
  163. package/test/strategy-lowest-price-functions.test.js +40 -0
  164. package/test/strategy-lowest-price.test.js +472 -0
  165. package/test/test-utils.js +106 -0
  166. package/test/utils.test.js +53 -163
  167. package/doc/example-nordpool-current-state.md +0 -166
  168. package/doc/example-nordpool-events-state.md +0 -153
  169. package/doc/example-tibber-mqtt.md +0 -189
  170. package/doc/power-saver-nordpool-current-state.png +0 -0
  171. package/doc/power-saver-nordpool-events-state.png +0 -0
  172. package/doc/power-saver-tibber-mqtt.png +0 -0
  173. package/mostSavedStrategy.js +0 -84
  174. package/mostSavedStrategy_v2.js +0 -68
  175. package/power-saver.html +0 -259
  176. package/test/data/tibber_data.json +0 -412
  177. package/test/data/tibber_prices.json +0 -412
@@ -0,0 +1,166 @@
1
+ # Nord Pool and current state node
2
+
3
+ ## Description
4
+
5
+ In this example, data is read from the Nord Pool sensor in HA via the `current state` node. The `ps-best-save` node is used to control a water heater via a switch, controlled by `call service` nodes in Home Assistant. The schedule is printed to a debug node. An `inject` node is used to trigger the reading of the Nord Pool sensor every hour.
6
+
7
+ ![Example with Tibber and MQTT](../images/power-saver-nordpool-current-state.png)
8
+
9
+ ## Flow
10
+
11
+ ```json:no-line-numbers
12
+ [
13
+ {
14
+ "id": "e2578f6a.210a8",
15
+ "type": "debug",
16
+ "z": "d938c47f.3398f8",
17
+ "name": "Nord Pool result",
18
+ "active": true,
19
+ "tosidebar": true,
20
+ "console": false,
21
+ "tostatus": false,
22
+ "complete": "true",
23
+ "targetType": "full",
24
+ "statusVal": "",
25
+ "statusType": "auto",
26
+ "x": 820,
27
+ "y": 440,
28
+ "wires": []
29
+ },
30
+ {
31
+ "id": "48bcdcca.fe42a4",
32
+ "type": "api-current-state",
33
+ "z": "d938c47f.3398f8",
34
+ "name": "Read Nord Pool",
35
+ "server": "ec4a12a1.b2be9",
36
+ "version": 2,
37
+ "outputs": 1,
38
+ "halt_if": "",
39
+ "halt_if_type": "str",
40
+ "halt_if_compare": "is",
41
+ "entity_id": "sensor.nordpool_kwh_trheim_nok_3_095_025",
42
+ "state_type": "str",
43
+ "blockInputOverrides": false,
44
+ "outputProperties": [
45
+ {
46
+ "property": "payload",
47
+ "propertyType": "msg",
48
+ "value": "",
49
+ "valueType": "entityState"
50
+ },
51
+ {
52
+ "property": "payload",
53
+ "propertyType": "msg",
54
+ "value": "",
55
+ "valueType": "entity"
56
+ }
57
+ ],
58
+ "x": 280,
59
+ "y": 380,
60
+ "wires": [["428d7c7ca88db95f"]]
61
+ },
62
+ {
63
+ "id": "97cc8e58.4247a",
64
+ "type": "inject",
65
+ "z": "d938c47f.3398f8",
66
+ "name": "",
67
+ "props": [
68
+ {
69
+ "p": "payload"
70
+ },
71
+ {
72
+ "p": "topic",
73
+ "vt": "str"
74
+ }
75
+ ],
76
+ "repeat": "3600",
77
+ "crontab": "",
78
+ "once": true,
79
+ "onceDelay": 0.1,
80
+ "topic": "",
81
+ "payloadType": "date",
82
+ "x": 110,
83
+ "y": 380,
84
+ "wires": [["48bcdcca.fe42a4"]]
85
+ },
86
+ {
87
+ "id": "a6f2769b.1a62a8",
88
+ "type": "api-call-service",
89
+ "z": "d938c47f.3398f8",
90
+ "name": "Turn on VVB",
91
+ "server": "ec4a12a1.b2be9",
92
+ "version": 3,
93
+ "debugenabled": false,
94
+ "service_domain": "switch",
95
+ "service": "turn_on",
96
+ "entityId": "switch.varmtvannsbereder_switch",
97
+ "data": "",
98
+ "dataType": "jsonata",
99
+ "mergecontext": "",
100
+ "mustacheAltTags": false,
101
+ "outputProperties": [],
102
+ "queue": "none",
103
+ "x": 810,
104
+ "y": 320,
105
+ "wires": [[]]
106
+ },
107
+ {
108
+ "id": "9fc75126.65dd3",
109
+ "type": "api-call-service",
110
+ "z": "d938c47f.3398f8",
111
+ "name": "Turn off VVB",
112
+ "server": "ec4a12a1.b2be9",
113
+ "version": 3,
114
+ "debugenabled": true,
115
+ "service_domain": "switch",
116
+ "service": "turn_off",
117
+ "entityId": "switch.varmtvannsbereder_switch",
118
+ "data": "",
119
+ "dataType": "json",
120
+ "mergecontext": "",
121
+ "mustacheAltTags": false,
122
+ "outputProperties": [],
123
+ "queue": "none",
124
+ "x": 810,
125
+ "y": 360,
126
+ "wires": [[]]
127
+ },
128
+ {
129
+ "id": "428d7c7ca88db95f",
130
+ "type": "ps-receive-price",
131
+ "z": "d938c47f.3398f8",
132
+ "name": "Price Receiver",
133
+ "x": 460,
134
+ "y": 380,
135
+ "wires": [["4147bf0b99fe626f"]]
136
+ },
137
+ {
138
+ "id": "4147bf0b99fe626f",
139
+ "type": "ps-strategy-best-save",
140
+ "z": "d938c47f.3398f8",
141
+ "name": "Best Save",
142
+ "maxHoursToSaveInSequence": "4",
143
+ "minHoursOnAfterMaxSequenceSaved": "1",
144
+ "minSaving": "0.03",
145
+ "sendCurrentValueWhenRescheduling": true,
146
+ "outputIfNoSchedule": "true",
147
+ "scheduleOnlyFromCurrentTime": "false",
148
+ "x": 630,
149
+ "y": 380,
150
+ "wires": [["a6f2769b.1a62a8"], ["9fc75126.65dd3"], ["e2578f6a.210a8"]]
151
+ },
152
+ {
153
+ "id": "ec4a12a1.b2be9",
154
+ "type": "server",
155
+ "name": "Home Assistant",
156
+ "version": 2,
157
+ "addon": true,
158
+ "rejectUnauthorizedCerts": true,
159
+ "ha_boolean": "y|yes|true|on|home|open",
160
+ "connectionDelay": true,
161
+ "cacheJson": true,
162
+ "heartbeat": false,
163
+ "heartbeatInterval": 30
164
+ }
165
+ ]
166
+ ```
@@ -0,0 +1,170 @@
1
+ # Nord Pool and events: state node
2
+
3
+ ## Description
4
+
5
+ In this example, data is read from the Nord Pool sensor in HA via the `events: state` node. The `ps-lowest-price` node is used to control a switch, controlled by `call service` nodes in Home Assistant, to turn on the cheapest 4 hours between 18:00 and 08:00. The schedule is printed to a debug node. The flow is triggered every time the Nord Pool sensor receives new prices.
6
+
7
+ ![Example with Tibber and MQTT](../images/power-saver-nordpool-events-state.png)
8
+
9
+ ## Flow
10
+
11
+ ```json:no-line-numbers
12
+ [
13
+ {
14
+ "id": "3662aca5.dfe974",
15
+ "type": "server-state-changed",
16
+ "z": "d938c47f.3398f8",
17
+ "name": "Nord Pool sensor",
18
+ "server": "ec4a12a1.b2be9",
19
+ "version": 3,
20
+ "exposeToHomeAssistant": false,
21
+ "haConfig": [
22
+ {
23
+ "property": "name",
24
+ "value": ""
25
+ },
26
+ {
27
+ "property": "icon",
28
+ "value": ""
29
+ }
30
+ ],
31
+ "entityidfilter": "sensor.nordpool_kwh_trheim_nok_3_095_025",
32
+ "entityidfiltertype": "exact",
33
+ "outputinitially": true,
34
+ "state_type": "str",
35
+ "haltifstate": "",
36
+ "halt_if_type": "str",
37
+ "halt_if_compare": "is",
38
+ "outputs": 1,
39
+ "output_only_on_state_change": true,
40
+ "for": 0,
41
+ "forType": "num",
42
+ "forUnits": "minutes",
43
+ "ignorePrevStateNull": false,
44
+ "ignorePrevStateUnknown": false,
45
+ "ignorePrevStateUnavailable": false,
46
+ "ignoreCurrentStateUnknown": false,
47
+ "ignoreCurrentStateUnavailable": false,
48
+ "outputProperties": [
49
+ {
50
+ "property": "payload",
51
+ "propertyType": "msg",
52
+ "value": "",
53
+ "valueType": "entityState"
54
+ },
55
+ {
56
+ "property": "data",
57
+ "propertyType": "msg",
58
+ "value": "",
59
+ "valueType": "eventData"
60
+ },
61
+ {
62
+ "property": "topic",
63
+ "propertyType": "msg",
64
+ "value": "",
65
+ "valueType": "triggerId"
66
+ }
67
+ ],
68
+ "x": 120,
69
+ "y": 620,
70
+ "wires": [["e21a4b49adea2350"]]
71
+ },
72
+ {
73
+ "id": "ed7202ff.b5725",
74
+ "type": "debug",
75
+ "z": "d938c47f.3398f8",
76
+ "name": "Nord Pool result",
77
+ "active": false,
78
+ "tosidebar": true,
79
+ "console": false,
80
+ "tostatus": false,
81
+ "complete": "true",
82
+ "targetType": "full",
83
+ "statusVal": "",
84
+ "statusType": "auto",
85
+ "x": 720,
86
+ "y": 680,
87
+ "wires": []
88
+ },
89
+ {
90
+ "id": "32f17ab2.927cf6",
91
+ "type": "api-call-service",
92
+ "z": "d938c47f.3398f8",
93
+ "name": "Turn on",
94
+ "server": "ec4a12a1.b2be9",
95
+ "version": 3,
96
+ "debugenabled": false,
97
+ "service_domain": "switch",
98
+ "service": "turn_on",
99
+ "entityId": "switch.varmtvannsbereder_switch",
100
+ "data": "",
101
+ "dataType": "jsonata",
102
+ "mergecontext": "",
103
+ "mustacheAltTags": false,
104
+ "outputProperties": [],
105
+ "queue": "none",
106
+ "x": 700,
107
+ "y": 580,
108
+ "wires": [[]]
109
+ },
110
+ {
111
+ "id": "2a3cd7db.0891f8",
112
+ "type": "api-call-service",
113
+ "z": "d938c47f.3398f8",
114
+ "name": "Turn off",
115
+ "server": "ec4a12a1.b2be9",
116
+ "version": 3,
117
+ "debugenabled": true,
118
+ "service_domain": "switch",
119
+ "service": "turn_off",
120
+ "entityId": "switch.varmtvannsbereder_switch",
121
+ "data": "",
122
+ "dataType": "json",
123
+ "mergecontext": "",
124
+ "mustacheAltTags": false,
125
+ "outputProperties": [],
126
+ "queue": "none",
127
+ "x": 700,
128
+ "y": 620,
129
+ "wires": [[]]
130
+ },
131
+ {
132
+ "id": "e21a4b49adea2350",
133
+ "type": "ps-receive-price",
134
+ "z": "d938c47f.3398f8",
135
+ "name": "Price Receiver",
136
+ "x": 310,
137
+ "y": 620,
138
+ "wires": [["391ac08890e0dd40"]]
139
+ },
140
+ {
141
+ "id": "391ac08890e0dd40",
142
+ "type": "ps-strategy-lowest-price",
143
+ "z": "d938c47f.3398f8",
144
+ "name": "Lowest Price",
145
+ "fromTime": "18",
146
+ "toTime": "08",
147
+ "hoursOn": "04",
148
+ "doNotSplit": false,
149
+ "sendCurrentValueWhenRescheduling": true,
150
+ "outputIfNoSchedule": "false",
151
+ "outputOutsidePeriod": "false",
152
+ "x": 490,
153
+ "y": 620,
154
+ "wires": [["32f17ab2.927cf6"], ["2a3cd7db.0891f8"], ["ed7202ff.b5725"]]
155
+ },
156
+ {
157
+ "id": "ec4a12a1.b2be9",
158
+ "type": "server",
159
+ "name": "Home Assistant",
160
+ "version": 2,
161
+ "addon": true,
162
+ "rejectUnauthorizedCerts": true,
163
+ "ha_boolean": "y|yes|true|on|home|open",
164
+ "connectionDelay": true,
165
+ "cacheJson": true,
166
+ "heartbeat": false,
167
+ "heartbeatInterval": 30
168
+ }
169
+ ]
170
+ ```
@@ -0,0 +1,179 @@
1
+ # Tibber, a switch and MQTT
2
+
3
+ ## Description
4
+
5
+ In this example, data is read from Tibber and used to turn on/off a switch, scheduled by the `ps-best-save` node to be off up to 5 hours in a row, but only if at least 5 cents/øre is saved per kWh. Data is also sent to MQTT, for example to be displayed on [Magic Mirror](https://magicmirror.builders/).
6
+
7
+ ![Example with Tibber and MQTT](../images/power-saver-tibber-mqtt.png)
8
+
9
+ ## Flow
10
+
11
+ ```json:no-line-numbers
12
+ [
13
+ {
14
+ "id": "467a5fe.d0bbba",
15
+ "type": "mqtt out",
16
+ "z": "d938c47f.3398f8",
17
+ "name": "Send switch to MM",
18
+ "topic": "powersaver/switch",
19
+ "qos": "0",
20
+ "retain": "false",
21
+ "broker": "24fbcfb5.569ea",
22
+ "x": 730,
23
+ "y": 120,
24
+ "wires": []
25
+ },
26
+ {
27
+ "id": "ab2d599a.077738",
28
+ "type": "tibber-query",
29
+ "z": "d938c47f.3398f8",
30
+ "name": "Get Tibber prices",
31
+ "active": true,
32
+ "apiEndpointRef": "b70ec5d0.6f8f08",
33
+ "x": 470,
34
+ "y": 100,
35
+ "wires": [["0ef929fde193cf4d"]]
36
+ },
37
+ {
38
+ "id": "4f11b5ae.4cc22c",
39
+ "type": "inject",
40
+ "z": "d938c47f.3398f8",
41
+ "name": "Refresh",
42
+ "props": [
43
+ {
44
+ "p": "payload"
45
+ }
46
+ ],
47
+ "repeat": "3600",
48
+ "crontab": "",
49
+ "once": true,
50
+ "onceDelay": "1",
51
+ "topic": "",
52
+ "payload": "{ viewer { homes { currentSubscription{ priceInfo{ today { total startsAt } tomorrow { total startsAt } } } } } }",
53
+ "payloadType": "str",
54
+ "x": 280,
55
+ "y": 100,
56
+ "wires": [["ab2d599a.077738"]]
57
+ },
58
+ {
59
+ "id": "42d8b632.402e38",
60
+ "type": "mqtt out",
61
+ "z": "d938c47f.3398f8",
62
+ "name": "Send schedule to MM",
63
+ "topic": "powersaver/plan",
64
+ "qos": "0",
65
+ "retain": "true",
66
+ "broker": "24fbcfb5.569ea",
67
+ "x": 740,
68
+ "y": 240,
69
+ "wires": []
70
+ },
71
+ {
72
+ "id": "5e485ff7.db156",
73
+ "type": "api-call-service",
74
+ "z": "d938c47f.3398f8",
75
+ "name": "Turn on VVB",
76
+ "server": "ec4a12a1.b2be9",
77
+ "version": 3,
78
+ "debugenabled": false,
79
+ "service_domain": "switch",
80
+ "service": "turn_on",
81
+ "entityId": "switch.varmtvannsbereder_switch",
82
+ "data": "",
83
+ "dataType": "jsonata",
84
+ "mergecontext": "",
85
+ "mustacheAltTags": false,
86
+ "outputProperties": [],
87
+ "queue": "none",
88
+ "x": 710,
89
+ "y": 60,
90
+ "wires": [[]]
91
+ },
92
+ {
93
+ "id": "9c978d1c.ee76",
94
+ "type": "api-call-service",
95
+ "z": "d938c47f.3398f8",
96
+ "name": "Turn off VVB",
97
+ "server": "ec4a12a1.b2be9",
98
+ "version": 3,
99
+ "debugenabled": true,
100
+ "service_domain": "switch",
101
+ "service": "turn_off",
102
+ "entityId": "switch.varmtvannsbereder_switch",
103
+ "data": "",
104
+ "dataType": "json",
105
+ "mergecontext": "",
106
+ "mustacheAltTags": false,
107
+ "outputProperties": [],
108
+ "queue": "none",
109
+ "x": 710,
110
+ "y": 180,
111
+ "wires": [[]]
112
+ },
113
+ {
114
+ "id": "5b6be1568744c6cf",
115
+ "type": "ps-strategy-best-save",
116
+ "z": "d938c47f.3398f8",
117
+ "name": "Best Save",
118
+ "maxHoursToSaveInSequence": "5",
119
+ "minHoursOnAfterMaxSequenceSaved": "1",
120
+ "minSaving": "0.05",
121
+ "sendCurrentValueWhenRescheduling": true,
122
+ "outputIfNoSchedule": "true",
123
+ "scheduleOnlyFromCurrentTime": "false",
124
+ "x": 490,
125
+ "y": 160,
126
+ "wires": [["467a5fe.d0bbba", "5e485ff7.db156"], ["9c978d1c.ee76", "467a5fe.d0bbba"], ["42d8b632.402e38"]]
127
+ },
128
+ {
129
+ "id": "0ef929fde193cf4d",
130
+ "type": "ps-receive-price",
131
+ "z": "d938c47f.3398f8",
132
+ "name": "Price Receiver",
133
+ "x": 280,
134
+ "y": 160,
135
+ "wires": [["5b6be1568744c6cf"]]
136
+ },
137
+ {
138
+ "id": "24fbcfb5.569ea",
139
+ "type": "mqtt-broker",
140
+ "name": "MQTT",
141
+ "broker": "10.0.0.15",
142
+ "port": "1883",
143
+ "clientid": "",
144
+ "usetls": false,
145
+ "compatmode": false,
146
+ "keepalive": "60",
147
+ "cleansession": true,
148
+ "birthTopic": "",
149
+ "birthQos": "0",
150
+ "birthPayload": "",
151
+ "closeTopic": "",
152
+ "closeQos": "0",
153
+ "closePayload": "",
154
+ "willTopic": "",
155
+ "willQos": "0",
156
+ "willPayload": ""
157
+ },
158
+ {
159
+ "id": "b70ec5d0.6f8f08",
160
+ "type": "tibber-api-endpoint",
161
+ "feedUrl": "wss://api.tibber.com/v1-beta/gql/subscriptions",
162
+ "queryUrl": "https://api.tibber.com/v1-beta/gql",
163
+ "name": "Tibber API"
164
+ },
165
+ {
166
+ "id": "ec4a12a1.b2be9",
167
+ "type": "server",
168
+ "name": "Home Assistant",
169
+ "version": 2,
170
+ "addon": true,
171
+ "rejectUnauthorizedCerts": true,
172
+ "ha_boolean": "y|yes|true|on|home|open",
173
+ "connectionDelay": true,
174
+ "cacheJson": true,
175
+ "heartbeat": false,
176
+ "heartbeatInterval": 30
177
+ }
178
+ ]
179
+ ```