node-red-contrib-power-saver 3.0.10 → 3.1.0

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 (81) hide show
  1. package/docs/.vuepress/config.js +5 -1
  2. package/docs/.vuepress/dist/404.html +3 -3
  3. package/docs/.vuepress/dist/assets/img/next-schedule-entity.4406856a.png +0 -0
  4. package/docs/.vuepress/dist/assets/img/next-schedule-flow.413ad62b.png +0 -0
  5. package/docs/.vuepress/dist/assets/img/next-schedule-sensor.eb896bdd.png +0 -0
  6. package/docs/.vuepress/dist/assets/js/app.5cf39ea6.js +1 -0
  7. package/docs/.vuepress/dist/assets/js/runtime~app.61982ee8.js +1 -0
  8. package/docs/.vuepress/dist/assets/js/v-0607240a.661e1808.js +1 -0
  9. package/docs/.vuepress/dist/assets/js/v-08683c60.844b04c7.js +1 -0
  10. package/docs/.vuepress/dist/assets/js/v-0aca7ba6.b42fad7f.js +1 -0
  11. package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.34230e16.js +1 -0
  12. package/docs/.vuepress/dist/assets/js/v-1ad821fa.6e2194d0.js +1 -0
  13. package/docs/.vuepress/dist/assets/js/v-30acb564.f2fcd69f.js +1 -0
  14. package/docs/.vuepress/dist/assets/js/v-4637f9e4.38f66bbb.js +1 -0
  15. package/docs/.vuepress/dist/assets/js/v-510ed0d4.67ecc9be.js +1 -0
  16. package/docs/.vuepress/dist/assets/js/v-5954bcb2.182daf70.js +1 -0
  17. package/docs/.vuepress/dist/assets/js/v-5db8da3a.f2de6cb9.js +1 -0
  18. package/docs/.vuepress/dist/assets/js/v-61f728ca.6fdbbb92.js +1 -0
  19. package/docs/.vuepress/dist/assets/js/v-677dfaed.0013f083.js +1 -0
  20. package/docs/.vuepress/dist/assets/js/v-7c87f26e.1127dcf5.js +1 -0
  21. package/docs/.vuepress/dist/assets/js/{v-8daa1a0e.66c9dbce.js → v-8daa1a0e.1f821c07.js} +1 -1
  22. package/docs/.vuepress/dist/assets/js/v-b4a42144.9e5f9728.js +1 -0
  23. package/docs/.vuepress/dist/assets/js/v-e8c55052.cf8b0764.js +1 -0
  24. package/docs/.vuepress/dist/assets/js/v-fffb8e28.cc5c1c74.js +1 -0
  25. package/docs/.vuepress/dist/changelog/index.html +3 -3
  26. package/docs/.vuepress/dist/contribute/index.html +3 -3
  27. package/docs/.vuepress/dist/examples/example-next-schedule-entity.html +25 -0
  28. package/docs/.vuepress/dist/examples/example-nordpool-current-state.html +4 -4
  29. package/docs/.vuepress/dist/examples/example-nordpool-events-state.html +4 -4
  30. package/docs/.vuepress/dist/examples/example-tibber-mqtt.html +4 -4
  31. package/docs/.vuepress/dist/examples/index.html +3 -3
  32. package/docs/.vuepress/dist/guide/index.html +4 -4
  33. package/docs/.vuepress/dist/index.html +3 -3
  34. package/docs/.vuepress/dist/nodes/index.html +3 -3
  35. package/docs/.vuepress/dist/nodes/old-power-saver-doc.html +4 -4
  36. package/docs/.vuepress/dist/nodes/power-saver.html +3 -3
  37. package/docs/.vuepress/dist/nodes/ps-elvia-add-tariff.html +3 -3
  38. package/docs/.vuepress/dist/nodes/ps-receive-price.html +4 -4
  39. package/docs/.vuepress/dist/nodes/ps-strategy-best-save.html +4 -4
  40. package/docs/.vuepress/dist/nodes/ps-strategy-lowest-price.html +4 -4
  41. package/docs/.vuepress/dist/nodes/strategy-input.html +4 -4
  42. package/docs/README.md +2 -2
  43. package/docs/changelog/README.md +4 -0
  44. package/docs/examples/README.md +4 -0
  45. package/docs/examples/example-next-schedule-entity.md +41 -0
  46. package/docs/faq/README.md +23 -0
  47. package/docs/guide/README.md +4 -5
  48. package/docs/images/add-tariff-flow.png +0 -0
  49. package/docs/images/mysterious-plan.png +0 -0
  50. package/docs/images/next-schedule-entity.png +0 -0
  51. package/docs/images/next-schedule-flow.png +0 -0
  52. package/docs/images/next-schedule-sensor.png +0 -0
  53. package/docs/images/node-ps-general-add-tariff.png +0 -0
  54. package/docs/nodes/README.md +6 -0
  55. package/docs/nodes/ps-elvia-add-tariff.md +1 -1
  56. package/docs/nodes/ps-general-add-tariff.md +49 -0
  57. package/package.json +3 -2
  58. package/src/general-add-tariff-functions.js +46 -0
  59. package/src/general-add-tariff.html +186 -0
  60. package/src/general-add-tariff.js +35 -0
  61. package/test/data/nordpool-3-days-prices.json +197 -0
  62. package/test/data/nordpool-3-days-result.json +439 -0
  63. package/test/general-add-tariff-functions.test.js +104 -0
  64. package/test/general-add-tariff.test.js +183 -0
  65. package/docs/.vuepress/dist/assets/js/app.3cfedce6.js +0 -1
  66. package/docs/.vuepress/dist/assets/js/runtime~app.f1d7fab8.js +0 -1
  67. package/docs/.vuepress/dist/assets/js/v-08683c60.07fe8291.js +0 -1
  68. package/docs/.vuepress/dist/assets/js/v-0aca7ba6.aec5ba75.js +0 -1
  69. package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.163b80fb.js +0 -1
  70. package/docs/.vuepress/dist/assets/js/v-1ad821fa.85407071.js +0 -1
  71. package/docs/.vuepress/dist/assets/js/v-30acb564.73b8e29f.js +0 -1
  72. package/docs/.vuepress/dist/assets/js/v-4637f9e4.60300b77.js +0 -1
  73. package/docs/.vuepress/dist/assets/js/v-510ed0d4.b76b84de.js +0 -1
  74. package/docs/.vuepress/dist/assets/js/v-5954bcb2.9e6d2df1.js +0 -1
  75. package/docs/.vuepress/dist/assets/js/v-5db8da3a.ac192f35.js +0 -1
  76. package/docs/.vuepress/dist/assets/js/v-61f728ca.64fa763c.js +0 -1
  77. package/docs/.vuepress/dist/assets/js/v-677dfaed.b84f09f5.js +0 -1
  78. package/docs/.vuepress/dist/assets/js/v-7c87f26e.91c245da.js +0 -1
  79. package/docs/.vuepress/dist/assets/js/v-b4a42144.d1856a24.js +0 -1
  80. package/docs/.vuepress/dist/assets/js/v-e8c55052.5f85b6cd.js +0 -1
  81. package/docs/.vuepress/dist/assets/js/v-fffb8e28.9e0579a1.js +0 -1
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
6
  <meta name="generator" content="VuePress 2.0.0-beta.27">
7
7
  <link rel="icon" href="/euro.png"><title>ps-strategy-lowest-price | Power Saver</title><meta name="description" content="A Node-RED note to save money on hourly changing power prices">
8
- <link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.f1d7fab8.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/css/styles.e835bef6.css" as="style"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/812.79dad458.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/app.3cfedce6.js" as="script">
8
+ <link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.61982ee8.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/css/styles.e835bef6.css" as="style"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/812.79dad458.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/app.5cf39ea6.js" as="script">
9
9
  <link rel="stylesheet" href="/node-red-contrib-power-saver/assets/css/styles.e835bef6.css">
10
10
  </head>
11
11
  <body>
12
- <div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/node-red-contrib-power-saver/" class=""><!----><span class="site-name">Power Saver</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><!----></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><p class="sidebar-heading sidebar-item active">Nodes</p><ul class=""><li><!--[--><a href="/node-red-contrib-power-saver/nodes/power-saver.md" class="nav-link sidebar-item" aria-label="Power Saver"><!--[--><!--]--> Power Saver <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><p class="sidebar-item active">Strategy nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-strategy-best-save.html" class="nav-link sidebar-item" aria-label="ps-strategy-best-save"><!--[--><!--]--> ps-strategy-best-save <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="ps-strategy-lowest-price"><!--[--><!--]--> ps-strategy-lowest-price <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#description" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Description"><!--[--><!--]--> Description <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#configuration" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Configuration"><!--[--><!--]--> Configuration <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#dynamic-config" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Dynamic config"><!--[--><!--]--> Dynamic config <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#input" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Input"><!--[--><!--]--> Input <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#output" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Output"><!--[--><!--]--> Output <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#tips-tricks" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Tips &amp; tricks"><!--[--><!--]--> Tips &amp; tricks <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#multiple-nodes-works-together" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Multiple nodes works together"><!--[--><!--]--> Multiple nodes works together <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#highest-price" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Highest price"><!--[--><!--]--> Highest price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Utility nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-receive-price.html" class="nav-link sidebar-item" aria-label="ps-receive-price"><!--[--><!--]--> ps-receive-price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Grid tariff nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-elvia-add-tariff.html" class="nav-link sidebar-item" aria-label="ps-elvia-add-tariff"><!--[--><!--]--> ps-elvia-add-tariff <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Data format</p><ul class=""><li><!--[--><a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="nav-link sidebar-item" aria-label="Strategy input format"><!--[--><!--]--> Strategy input format <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="ps-strategy-lowest-price" tabindex="-1"><a class="header-anchor" href="#ps-strategy-lowest-price" aria-hidden="true">#</a> ps-strategy-lowest-price</h1><p><img src="/node-red-contrib-power-saver/assets/img/node-ps-strategy-lowest-price.3a4ad347.png" alt="ps-strategy-lowest-price"></p><p>Strategy node to turn on power the hours when the price is lowest during a given period, and turn off the other hours.</p><h2 id="description" tabindex="-1"><a class="header-anchor" href="#description" aria-hidden="true">#</a> Description</h2><p>The node can work on a specific period from 1 to 24 hours during a 24 hour period. Inside this period, you can decide how many hours that shall be on. The rest of the period will be off. Outside the period, you can select that the output shall be either on or off. You can also decide that the hours on shall be consecutive (one continuous period) or spread around in multiple on-periods.</p><h2 id="configuration" tabindex="-1"><a class="header-anchor" href="#configuration" aria-hidden="true">#</a> Configuration</h2><p><img src="/node-red-contrib-power-saver/assets/img/lowest-price-config.6d66a8c2.png" alt="Node Configuration"></p><table><thead><tr><th>Value</th><th>Description</th></tr></thead><tbody><tr><td>From Time</td><td>The start time of the selected period.</td></tr><tr><td>To Time</td><td>The end time of the selected period.</td></tr><tr><td>Hours On</td><td>The number of hours that shall be turned on.</td></tr><tr><td>Consecutive On-Period</td><td>Check this if you need the on-period to be consecutive.</td></tr><tr><td>Send When Rescheduling</td><td>Check this to make sure on or off output is sent immediately after rescheduling.</td></tr><tr><td>If No Schedule, Send</td><td>What to do if there is no valid schedule any more (turn on or off).</td></tr><tr><td>Outside Period, Send</td><td>Select the value to send outside the selected period.</td></tr></tbody></table><p>If you want to use a period of 24 hours, set the From Time and To Time to the same value. The time you select is significant in the way that it decides which 24 hours that are considered when finding the hours with lowest price.</p><div class="custom-container tip"><p class="custom-container-title">Example with Consecutive On-Period</p><p>One example to need a consecutive on-period can be if you want to control the washing machine. Let&#39;s say it needs 3 hours, and you want it to run between 22:00 and 06:00. Set <code>From Time = 22:00</code>, <code>To Time = 06:00</code> and check the <code>Consecutive On-Period</code> flag. This will turn on the cheapest 3-hour period from 22:00 to 06:00.</p><p>NB! It is not recommended to run the washing machine when you are sleeping or away.</p></div><div class="custom-container tip"><p class="custom-container-title">Example with non-consecutive on-period</p><p>If you have heating cables in the driveway, you may need them to be on only for a few hours every day, for example 4 hours, but it may not be important when this is. Then set <code>From Time = 00:00</code>, <code>To Time = 00:00</code> and <strong>un-check</strong> the <code>Consecutive On-Period</code> flag. This will turn on the 4 cheapest hours during the whole day, and off the rest.</p><p>You can use any time for start and end, but it is a good idea to use <code>00:00</code>, since the prices normally comes for this period.</p></div><div class="custom-container warning"><p class="custom-container-title">Outside Period, Send</p><p>Unless the period you select is 24 hours (<code>From Time</code> and <code>To Time</code> are the same), it is important what value you choose for <code>Outside Period, Send</code>. This decides whether the output is on or off during the period that is outside the selected period.</p></div><div class="custom-container danger"><p class="custom-container-title">Schedule not calculated</p><p>If you select a period for example from 10:00 to 02:00, it may not be possible to calculate before the period starts. This is because electricity prices for the next day (in the Nord Pool area) normally are received around 13:00. The node cannot calculate the period until it has price data for the whole period.</p></div><h3 id="dynamic-config" tabindex="-1"><a class="header-anchor" href="#dynamic-config" aria-hidden="true">#</a> Dynamic config</h3><p>It is possible to change config dynamically by sending a config message to the node. The config messages has a payload with a config object like this example:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token property">&quot;payload&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
12
+ <div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/node-red-contrib-power-saver/" class=""><!----><span class="site-name">Power Saver</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/ottopaulsen/node-red-contrib-power-saver" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><!----></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/ottopaulsen/node-red-contrib-power-saver" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><p class="sidebar-heading sidebar-item active">Nodes</p><ul class=""><li><!--[--><a href="/node-red-contrib-power-saver/nodes/power-saver.md" class="nav-link sidebar-item" aria-label="Power Saver"><!--[--><!--]--> Power Saver <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><p class="sidebar-item active">Strategy nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-strategy-best-save.html" class="nav-link sidebar-item" aria-label="ps-strategy-best-save"><!--[--><!--]--> ps-strategy-best-save <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="ps-strategy-lowest-price"><!--[--><!--]--> ps-strategy-lowest-price <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#description" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Description"><!--[--><!--]--> Description <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#configuration" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Configuration"><!--[--><!--]--> Configuration <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#dynamic-config" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Dynamic config"><!--[--><!--]--> Dynamic config <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#input" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Input"><!--[--><!--]--> Input <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#output" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Output"><!--[--><!--]--> Output <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#tips-tricks" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Tips &amp; tricks"><!--[--><!--]--> Tips &amp; tricks <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#multiple-nodes-works-together" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Multiple nodes works together"><!--[--><!--]--> Multiple nodes works together <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html#highest-price" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Highest price"><!--[--><!--]--> Highest price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Utility nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-receive-price.html" class="nav-link sidebar-item" aria-label="ps-receive-price"><!--[--><!--]--> ps-receive-price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Grid tariff nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-elvia-add-tariff.html" class="nav-link sidebar-item" aria-label="ps-elvia-add-tariff"><!--[--><!--]--> ps-elvia-add-tariff <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">Data format</p><ul class=""><li><!--[--><a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="nav-link sidebar-item" aria-label="Strategy input format"><!--[--><!--]--> Strategy input format <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="ps-strategy-lowest-price" tabindex="-1"><a class="header-anchor" href="#ps-strategy-lowest-price" aria-hidden="true">#</a> ps-strategy-lowest-price</h1><p><img src="/node-red-contrib-power-saver/assets/img/node-ps-strategy-lowest-price.3a4ad347.png" alt="ps-strategy-lowest-price"></p><p>Strategy node to turn on power the hours when the price is lowest during a given period, and turn off the other hours.</p><h2 id="description" tabindex="-1"><a class="header-anchor" href="#description" aria-hidden="true">#</a> Description</h2><p>The node can work on a specific period from 1 to 24 hours during a 24 hour period. Inside this period, you can decide how many hours that shall be on. The rest of the period will be off. Outside the period, you can select that the output shall be either on or off. You can also decide that the hours on shall be consecutive (one continuous period) or spread around in multiple on-periods.</p><h2 id="configuration" tabindex="-1"><a class="header-anchor" href="#configuration" aria-hidden="true">#</a> Configuration</h2><p><img src="/node-red-contrib-power-saver/assets/img/lowest-price-config.6d66a8c2.png" alt="Node Configuration"></p><table><thead><tr><th>Value</th><th>Description</th></tr></thead><tbody><tr><td>From Time</td><td>The start time of the selected period.</td></tr><tr><td>To Time</td><td>The end time of the selected period.</td></tr><tr><td>Hours On</td><td>The number of hours that shall be turned on.</td></tr><tr><td>Consecutive On-Period</td><td>Check this if you need the on-period to be consecutive.</td></tr><tr><td>Send When Rescheduling</td><td>Check this to make sure on or off output is sent immediately after rescheduling.</td></tr><tr><td>If No Schedule, Send</td><td>What to do if there is no valid schedule any more (turn on or off).</td></tr><tr><td>Outside Period, Send</td><td>Select the value to send outside the selected period.</td></tr></tbody></table><p>If you want to use a period of 24 hours, set the From Time and To Time to the same value. The time you select is significant in the way that it decides which 24 hours that are considered when finding the hours with lowest price.</p><div class="custom-container tip"><p class="custom-container-title">Example with Consecutive On-Period</p><p>One example to need a consecutive on-period can be if you want to control the washing machine. Let&#39;s say it needs 3 hours, and you want it to run between 22:00 and 06:00. Set <code>From Time = 22:00</code>, <code>To Time = 06:00</code> and check the <code>Consecutive On-Period</code> flag. This will turn on the cheapest 3-hour period from 22:00 to 06:00.</p><p>NB! It is not recommended to run the washing machine when you are sleeping or away.</p></div><div class="custom-container tip"><p class="custom-container-title">Example with non-consecutive on-period</p><p>If you have heating cables in the driveway, you may need them to be on only for a few hours every day, for example 4 hours, but it may not be important when this is. Then set <code>From Time = 00:00</code>, <code>To Time = 00:00</code> and <strong>un-check</strong> the <code>Consecutive On-Period</code> flag. This will turn on the 4 cheapest hours during the whole day, and off the rest.</p><p>You can use any time for start and end, but it is a good idea to use <code>00:00</code>, since the prices normally comes for this period.</p></div><div class="custom-container warning"><p class="custom-container-title">Outside Period, Send</p><p>Unless the period you select is 24 hours (<code>From Time</code> and <code>To Time</code> are the same), it is important what value you choose for <code>Outside Period, Send</code>. This decides whether the output is on or off during the period that is outside the selected period.</p></div><div class="custom-container danger"><p class="custom-container-title">Schedule not calculated</p><p>If you select a period for example from 10:00 to 02:00, it may not be possible to calculate before the period starts. This is because electricity prices for the next day (in the Nord Pool area) normally are received around 13:00. The node cannot calculate the period until it has price data for the whole period.</p></div><h3 id="dynamic-config" tabindex="-1"><a class="header-anchor" href="#dynamic-config" aria-hidden="true">#</a> Dynamic config</h3><p>It is possible to change config dynamically by sending a config message to the node. The config messages has a payload with a config object like this example:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token property">&quot;payload&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
13
13
  <span class="token property">&quot;config&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
14
14
  <span class="token property">&quot;fromTime&quot;</span> <span class="token operator">:</span> <span class="token number">10</span><span class="token punctuation">,</span>
15
15
  <span class="token property">&quot;toTime&quot;</span> <span class="token operator">:</span> <span class="token number">16</span><span class="token punctuation">,</span>
@@ -83,7 +83,7 @@
83
83
  <span class="token property">&quot;outputOutsidePeriod&quot;</span><span class="token operator">:</span> <span class="token string">&quot;true&quot;</span>
84
84
  <span class="token punctuation">}</span>
85
85
  <span class="token punctuation">}</span>
86
- </code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br></div></div><p>The <code>schedule</code> array shows every time the switch is turned on or off. The <code>hours</code> array shows values per hour containing the price (received as input), whether that hour is on or off, the start time of the hour and the amount per kWh that is saved on hours that are turned off, compared to the next hour that is on.</p><h2 id="tips-tricks" tabindex="-1"><a class="header-anchor" href="#tips-tricks" aria-hidden="true">#</a> Tips &amp; tricks</h2><h3 id="multiple-nodes-works-together" tabindex="-1"><a class="header-anchor" href="#multiple-nodes-works-together" aria-hidden="true">#</a> Multiple nodes works together</h3><p>You can use multiple nodes simultanously, for different periods, if you want more hours on one part of the day than another part, or to make sure there are at least some hours on during each period.</p><h3 id="highest-price" tabindex="-1"><a class="header-anchor" href="#highest-price" aria-hidden="true">#</a> Highest price</h3><p>If you want to find the <code>x</code> hours with the highest prices, do as follows:</p><ol><li>Calculate <code>y</code> as the total number of hours in the period. For example, if the period is from <code>08:00</code> to <code>20:00</code>, then <code>y = 12</code>.</li><li>Configure <code>Hours On = y - x</code>, so if <code>x = 4</code>, then <code>Hours On = 12 - 4 = 8</code>.</li><li>Use <strong>Output 2</strong> to get a signal when you have the hours with the highest prices. Just remember that the value sent to output 2 is <code>false</code>, not <code>true</code> as it is on output 1.</li></ol><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">12/20/2021, 10:10:18 PM</span></div><div class="meta-item contributors"><span class="meta-item-label">Contributors: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: ottpau@gmail.com">Otto Paulsen</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><span class="prev"> ← <a href="/node-red-contrib-power-saver/nodes/ps-strategy-best-save.html" class="nav-link" aria-label="ps-strategy-best-save"><!--[--><!--]--> ps-strategy-best-save <!--[--><!--]--></a></span><span class="next"><a href="/node-red-contrib-power-saver/nodes/ps-receive-price.html" class="nav-link" aria-label="ps-receive-price"><!--[--><!--]--> ps-receive-price <!--[--><!--]--></a> → </span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
87
- <script src="/node-red-contrib-power-saver/assets/js/runtime~app.f1d7fab8.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/812.79dad458.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/app.3cfedce6.js" defer></script>
86
+ </code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br></div></div><p>The <code>schedule</code> array shows every time the switch is turned on or off. The <code>hours</code> array shows values per hour containing the price (received as input), whether that hour is on or off, the start time of the hour and the amount per kWh that is saved on hours that are turned off, compared to the next hour that is on.</p><h2 id="tips-tricks" tabindex="-1"><a class="header-anchor" href="#tips-tricks" aria-hidden="true">#</a> Tips &amp; tricks</h2><h3 id="multiple-nodes-works-together" tabindex="-1"><a class="header-anchor" href="#multiple-nodes-works-together" aria-hidden="true">#</a> Multiple nodes works together</h3><p>You can use multiple nodes simultanously, for different periods, if you want more hours on one part of the day than another part, or to make sure there are at least some hours on during each period.</p><h3 id="highest-price" tabindex="-1"><a class="header-anchor" href="#highest-price" aria-hidden="true">#</a> Highest price</h3><p>If you want to find the <code>x</code> hours with the highest prices, do as follows:</p><ol><li>Calculate <code>y</code> as the total number of hours in the period. For example, if the period is from <code>08:00</code> to <code>20:00</code>, then <code>y = 12</code>.</li><li>Configure <code>Hours On = y - x</code>, so if <code>x = 4</code>, then <code>Hours On = 12 - 4 = 8</code>.</li><li>Use <strong>Output 2</strong> to get a signal when you have the hours with the highest prices. Just remember that the value sent to output 2 is <code>false</code>, not <code>true</code> as it is on output 1.</li></ol><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">12/20/2021, 10:10:18 PM</span></div><!----></footer><nav class="page-nav"><p class="inner"><span class="prev"> ← <a href="/node-red-contrib-power-saver/nodes/ps-strategy-best-save.html" class="nav-link" aria-label="ps-strategy-best-save"><!--[--><!--]--> ps-strategy-best-save <!--[--><!--]--></a></span><span class="next"><a href="/node-red-contrib-power-saver/nodes/ps-receive-price.html" class="nav-link" aria-label="ps-receive-price"><!--[--><!--]--> ps-receive-price <!--[--><!--]--></a> → </span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
87
+ <script src="/node-red-contrib-power-saver/assets/js/runtime~app.61982ee8.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/812.79dad458.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/app.5cf39ea6.js" defer></script>
88
88
  </body>
89
89
  </html>
@@ -5,11 +5,11 @@
5
5
  <meta name="viewport" content="width=device-width,initial-scale=1">
6
6
  <meta name="generator" content="VuePress 2.0.0-beta.27">
7
7
  <link rel="icon" href="/euro.png"><title>Strategy input format | Power Saver</title><meta name="description" content="A Node-RED note to save money on hourly changing power prices">
8
- <link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.f1d7fab8.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/css/styles.e835bef6.css" as="style"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/812.79dad458.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/app.3cfedce6.js" as="script">
8
+ <link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.61982ee8.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/css/styles.e835bef6.css" as="style"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/812.79dad458.js" as="script"><link rel="preload" href="/node-red-contrib-power-saver/assets/js/app.5cf39ea6.js" as="script">
9
9
  <link rel="stylesheet" href="/node-red-contrib-power-saver/assets/css/styles.e835bef6.css">
10
10
  </head>
11
11
  <body>
12
- <div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/node-red-contrib-power-saver/" class=""><!----><span class="site-name">Power Saver</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><!----></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><p class="sidebar-heading sidebar-item">Nodes</p><ul class=""><li><!--[--><a href="/node-red-contrib-power-saver/nodes/power-saver.md" class="nav-link sidebar-item" aria-label="Power Saver"><!--[--><!--]--> Power Saver <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><p class="sidebar-item">Strategy nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-strategy-best-save.html" class="nav-link sidebar-item" aria-label="ps-strategy-best-save"><!--[--><!--]--> ps-strategy-best-save <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html" class="nav-link sidebar-item" aria-label="ps-strategy-lowest-price"><!--[--><!--]--> ps-strategy-lowest-price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Utility nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-receive-price.html" class="nav-link sidebar-item" aria-label="ps-receive-price"><!--[--><!--]--> ps-receive-price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Grid tariff nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-elvia-add-tariff.html" class="nav-link sidebar-item" aria-label="ps-elvia-add-tariff"><!--[--><!--]--> ps-elvia-add-tariff <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item active">Data format</p><ul class=""><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="Strategy input format"><!--[--><!--]--> Strategy input format <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="strategy-input-format" tabindex="-1"><a class="header-anchor" href="#strategy-input-format" aria-hidden="true">#</a> Strategy input format</h1><p>The common input for strategy nodes is a payload with a <code>priceData</code> array containing an object for each hour. Each object has a <code>value</code> which is the price, and a <code>start</code> which is the start time for the hour.</p><p>Example:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
12
+ <div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/node-red-contrib-power-saver/" class=""><!----><span class="site-name">Power Saver</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/ottopaulsen/node-red-contrib-power-saver" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><!----></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/guide/" class="nav-link" aria-label="Guide"><!--[--><!--]--> Guide <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/nodes/" class="nav-link router-link-active" aria-label="Nodes"><!--[--><!--]--> Nodes <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/examples/" class="nav-link" aria-label="Examples"><!--[--><!--]--> Examples <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/contribute/" class="nav-link" aria-label="Contribute"><!--[--><!--]--> Contribute <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/node-red-contrib-power-saver/changelog/" class="nav-link" aria-label="Changes"><!--[--><!--]--> Changes <!--[--><!--]--></a></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/ottopaulsen/node-red-contrib-power-saver" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">open in new window</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><p class="sidebar-heading sidebar-item">Nodes</p><ul class=""><li><!--[--><a href="/node-red-contrib-power-saver/nodes/power-saver.md" class="nav-link sidebar-item" aria-label="Power Saver"><!--[--><!--]--> Power Saver <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><p class="sidebar-item">Strategy nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-strategy-best-save.html" class="nav-link sidebar-item" aria-label="ps-strategy-best-save"><!--[--><!--]--> ps-strategy-best-save <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html" class="nav-link sidebar-item" aria-label="ps-strategy-lowest-price"><!--[--><!--]--> ps-strategy-lowest-price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Utility nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-receive-price.html" class="nav-link sidebar-item" aria-label="ps-receive-price"><!--[--><!--]--> ps-receive-price <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><p class="sidebar-item">Grid tariff nodes</p><ul class="sidebar-sub-items"><li><!--[--><a href="/node-red-contrib-power-saver/nodes/ps-elvia-add-tariff.html" class="nav-link sidebar-item" aria-label="ps-elvia-add-tariff"><!--[--><!--]--> ps-elvia-add-tariff <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item active">Data format</p><ul class=""><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="Strategy input format"><!--[--><!--]--> Strategy input format <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="strategy-input-format" tabindex="-1"><a class="header-anchor" href="#strategy-input-format" aria-hidden="true">#</a> Strategy input format</h1><p>The common input for strategy nodes is a payload with a <code>priceData</code> array containing an object for each hour. Each object has a <code>value</code> which is the price, and a <code>start</code> which is the start time for the hour.</p><p>Example:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
13
13
  <span class="token property">&quot;priceData&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
14
14
  <span class="token punctuation">{</span>
15
15
  <span class="token property">&quot;value&quot;</span><span class="token operator">:</span> <span class="token number">0.9544</span><span class="token punctuation">,</span>
@@ -34,7 +34,7 @@
34
34
  <span class="token comment">// ... normally 24 or 48 hours</span>
35
35
  <span class="token punctuation">]</span>
36
36
  <span class="token punctuation">}</span>
37
- </code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><p>This format is used for:</p><ul><li>Output of the <code>ps-receive-price</code> node</li><li>Input and output of the <code>ps-xxx-add-tariff</code> nodes</li><li>Input for the strategy nodes (<code>ps-strategy-xxx-xxx</code>)</li></ul><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">12/20/2021, 10:10:18 PM</span></div><div class="meta-item contributors"><span class="meta-item-label">Contributors: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: ottpau@gmail.com">Otto Paulsen</span><!----><!--]--><!--]--></span></div></footer><!----><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
38
- <script src="/node-red-contrib-power-saver/assets/js/runtime~app.f1d7fab8.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/812.79dad458.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/app.3cfedce6.js" defer></script>
37
+ </code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><p>This format is used for:</p><ul><li>Output of the <code>ps-receive-price</code> node</li><li>Input and output of the <code>ps-xxx-add-tariff</code> nodes</li><li>Input for the strategy nodes (<code>ps-strategy-xxx-xxx</code>)</li></ul><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">12/20/2021, 10:10:18 PM</span></div><!----></footer><!----><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
38
+ <script src="/node-red-contrib-power-saver/assets/js/runtime~app.61982ee8.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/812.79dad458.js" defer></script><script src="/node-red-contrib-power-saver/assets/js/app.5cf39ea6.js" defer></script>
39
39
  </body>
40
40
  </html>
package/docs/README.md CHANGED
@@ -21,8 +21,8 @@ features:
21
21
  details: Postpone power consumption when there is most to save, perfect for the water heater.
22
22
  - title: Lowest Price Strategy
23
23
  details: Turn on power when the prices are the lowest, perfect for smart charging or heating.
24
- - title: Integrate with grid tariff APIs
25
- details: Elvia grid tariff API already supported. Others are easy to add.
24
+ - title: Add variable grid tariff
25
+ details: Automatically add values that varies on fixed hours, or use API to get grid tariff from Elvia.
26
26
  - title: Perfect with Home Assistant
27
27
  details: Use Home Assistant with Node-RED and control switches via service calls.
28
28
  - title: Tibber and Nord Pool
@@ -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.1.0
10
+
11
+ - New node `ps-general-add-tariff` to add values that varies af fixed times during the day.
12
+
9
13
  ## 3.0.10
10
14
 
11
15
  - Fix bug in ps-elvia-add-tariff so it connects to API.
@@ -3,3 +3,7 @@
3
3
  [Nord Pool and `current state` node in HA](./example-nordpool-current-state)
4
4
  [Nord Pool and `events: state` node in HA](./example-nordpool-events-state)
5
5
  [Tibber and mqtt](./example-tibber-mqtt)
6
+
7
+ ## User provided examples
8
+
9
+ [Output schedule to a sensor entity](./example-next-schedule-entity.md) (by Stefan)
@@ -0,0 +1,41 @@
1
+ # Output schedule to a sensor entity
2
+ This example was contributed by [Stefan](https://github.com/oakhill87)
3
+
4
+ Note: Requires [Node-RED Companion Integration](https://github.com/zachowj/hass-node-red).
5
+
6
+
7
+ ![Sensor with timestamp and attributes](../images/next-schedule-sensor.png) ![Sensor flow](../images/next-schedule-flow.png)
8
+
9
+ This JavaScript code snippet can be pasted into a Function-node. When connected to the schedule-output (3) from Best Save, it will loop through the array of available hours and find the next timestamp where a power saving schedule is initated.
10
+ ```js
11
+ for (var i = 0; i < msg.payload.hours.length; i++) {
12
+ if (msg.payload.hours[i].onOff != true) {
13
+ var schedule = {time: msg.payload.hours[i].start, topic: "Neste spareperiode", length: msg.payload.config.maxHoursToSaveInSequence, savings: msg.payload.hours[i].saving}
14
+ break}
15
+ else {
16
+ var schedule = {time: false, topic: "Ingen aksjoner", length: "0", savings: "0"}
17
+ }
18
+ }
19
+ var schedule_array = {upcoming: schedule}
20
+ return [schedule_array]
21
+ ```
22
+
23
+ This will return the following:
24
+ - msg.upcoming.time = Timestamp if saving is scheduled - False if no schedule with the current available prices.
25
+ - msg.upcoming.length = How long the next saving will last - set to 0 if no schedule.
26
+ - msg.upcoming.savings = Estimated savings retrieved from the node.
27
+
28
+ ## Setup
29
+ 1. Paste the code above into a Function node and connect it to the schedule output.
30
+ 2. Create an entity node from the Node-RED Companion Integration, and configure it according to the steps below:
31
+
32
+ The msg.topic is currently not used, but in case you'd want to specify dynamic names in the sensor instead of in the frontend, go ahead and add them as attributes using the following configuration:
33
+
34
+ 1. **State**: msg.upcoming.time
35
+ 2. Attribute key **Duration**: msg.upcoming.length
36
+ 3. Attribute key **Savings**: msg.upcoming.savings
37
+
38
+ <img src="../images/next-schedule-entity.png" width="25%">
39
+
40
+ ## To-do
41
+ If you find any bugs, let me know, but as long as the payload doesn't change it should work.
@@ -0,0 +1,23 @@
1
+ # FAQ
2
+
3
+ ## Why does the Best Save node not turn off the most expensive hours?
4
+
5
+ Here is an example:
6
+
7
+ ![Mysterious saving](../images/mysterious-plan.png)
8
+
9
+ The purple strokes shows the savings. The Best Save node is configured to save up to 5 hours in a sequence, and only when saving is more than 0.05 NOK.
10
+
11
+ Why does it not save the most expensive period?
12
+
13
+ If you move the saving-period 4-5 hours earlier, the most expensive hours would have been saved. Why is this not better?
14
+
15
+ Remember that the power that is not used during the saving-period, will be used immediately after. At least, that is the idea, and the normal behaviour if the power consumer is a water heater or another heater controlled by a thermostat. So, then the power would be used one of the blue hours in stead of the green cheaper hour.
16
+
17
+ Also remember that when saving, you do not save the full price. You only save what is the difference between the price during the saved hours and the price the hour immediately after.
18
+
19
+ So the best saving is found where this difference is the largest, and that is not always by turning off the most expensive hours. In the case above, the difference is largest when you turn off the hours marked wit a purple stroke, so this is the best saving you can get.
20
+
21
+ Of course, if you expand the saving period from 5 to 10 hours you would save even more, but that would be a different case, and you can do that if it is ok for you to turn off for that long time.
22
+
23
+ Another alternative is to reduce the minimum saving from 0.05 to 0.001. Then the 3 first red hours would be turned off, but the last red would have to be on, in order to get one hour on until the next 5-hour period off. This would however not save you for much money, since the hour that is on is almost as expensive as the hours you would turn off.
@@ -132,11 +132,10 @@ When also the grid tariff changes per hour, it must be added to the electricity
132
132
 
133
133
  After the the `ps-receive-price` node, add a `ps-xxx-add-tariff` node to add grid tariff. What node to choose depends on what grid you get electricity through. The following grids are supported:
134
134
 
135
- | Grid supplier | Node |
136
- | ------------- | --------------------- |
137
- | Elvia | `ps-elvia-add-tariff` |
138
-
139
- Oops. Only one grid is currently supported.
135
+ | Grid supplier | Node |
136
+ | ------------- | ----------------------- |
137
+ | General (any) | `ps-general-add-tariff` |
138
+ | Elvia | `ps-elvia-add-tariff` |
140
139
 
141
140
  If your grid is not supported, you may code this yourself.
142
141
 
Binary file
Binary file
@@ -34,6 +34,12 @@ Node to convert different types of input data to the format used by the strategy
34
34
 
35
35
  ## Grid tariff nodes
36
36
 
37
+ ### [ps-general-add-tariff](./ps-general-add-tariff)
38
+
39
+ ![ps-general-add-tariff](../images/node-ps-general-add-tariff.png)
40
+
41
+ Node to add a variable grid tariff (or any value) to the prices before sending them to the strategy nodes.
42
+
37
43
  ### [ps-elvia-add-tariff](./ps-elvia-add-tariff)
38
44
 
39
45
  ![ps-elvia-add-tariff](../images/node-ps-elvia-add-tariff.png)
@@ -49,4 +49,4 @@ The input is the [common strategy input format](./strategy-input.md)
49
49
 
50
50
  ## Output
51
51
 
52
- The input is the [common strategy input format](./strategy-input.md)
52
+ The output is the [common strategy input format](./strategy-input.md)
@@ -0,0 +1,49 @@
1
+ # ps-general-add-tariff
2
+
3
+ ![ps-general-add-tariff](../images/node-ps-general-add-tariff.png)
4
+
5
+ Node to add a value, for example a variable grid tariff, to the price before it is used to calculate savings in the strategy nodes.
6
+
7
+ ## Description
8
+
9
+ This node is useful if there is an addition to the electricity price that varies over the day, as it might be for the grid tariff.
10
+
11
+ If there is one price for example from 22:00 to 06:00 every day, and another price from 06:00 to 22:00, this is the right node to use. It can be used for more than two periods, as long as the time it changes is the same every day.
12
+
13
+ Here is how this node is normally used:
14
+
15
+ ![general flow](../images/add-tariff-flow.png)
16
+
17
+ ::: tip Changes during the year
18
+ If there is one price now, and another price from a specific date, you can use two nodes after each other. Set the `Valid to date` of the node with the current prices to the last date the current prices are valid. Set the `Valid from date` of the node with the upcoming prices to the first date those prices are valid.
19
+ :::
20
+
21
+ ## Configuration
22
+
23
+ ### Add and delete periods
24
+
25
+ You can have from 1 to 24 periods during the day, with different values to add for each hour. Click the `Add period` button to add more periods. Click the `X` button to delete a period.
26
+
27
+ ### From time and Value
28
+
29
+ For each period, select the time of the day the value is valid from, and enter the value.
30
+
31
+ ### Valid from date
32
+
33
+ Fill in the first date the config is valid.
34
+
35
+ If this is empty, the config is valid from the dawn of time.
36
+
37
+ ### Valid to date
38
+
39
+ Fill in the last date the config is valid.
40
+
41
+ If this is empty, the config is valid until forever.
42
+
43
+ ## Input
44
+
45
+ The input is the [common strategy input format](./strategy-input.md)
46
+
47
+ ## Output
48
+
49
+ The output is the [common strategy input format](./strategy-input.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-power-saver",
3
- "version": "3.0.10",
3
+ "version": "3.1.0",
4
4
  "description": "A module for Node-RED that you can use to turn on and off a switch based on power prices",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,7 +28,8 @@
28
28
  "ps-elvia-config": "src/elvia/elvia-config.js",
29
29
  "ps-elvia-tariff-types": "src/elvia/elvia-tariff-types.js",
30
30
  "ps-elvia-tariff": "src/elvia/elvia-tariff.js",
31
- "ps-elvia-add-tariff": "src/elvia/elvia-add-tariff.js"
31
+ "ps-elvia-add-tariff": "src/elvia/elvia-add-tariff.js",
32
+ "ps-general-add-tariff": "src/general-add-tariff.js"
32
33
  }
33
34
  },
34
35
  "prettier": {
@@ -0,0 +1,46 @@
1
+ const cloneDeep = require("lodash.clonedeep");
2
+ const { DateTime } = require("luxon");
3
+ const { nodes } = require("node-red");
4
+ const { roundPrice } = require("./utils");
5
+
6
+ function buildAllHours(node, periods) {
7
+ const sortedPeriods = cloneDeep(periods);
8
+ sortedPeriods.sort((a, b) => a.start - b.start);
9
+ let res = [];
10
+ let hour = 0;
11
+ let current = sortedPeriods[sortedPeriods.length - 1];
12
+ sortedPeriods.push({ start: 24, value: null });
13
+ sortedPeriods.forEach((period) => {
14
+ const nextHour = parseInt(period.start);
15
+ while (hour < nextHour) {
16
+ let value = 0;
17
+ try {
18
+ value = parseFloat(("" + current.value).replace(",", "."));
19
+ } catch (e) {
20
+ node.warn("Illegal number: " + current.value);
21
+ }
22
+ res[hour] = value;
23
+ hour++;
24
+ }
25
+ current = period;
26
+ });
27
+ return res;
28
+ }
29
+
30
+ function addTariffToPrices(node, config, prices) {
31
+ const allHours = buildAllHours(node, config.periods);
32
+ const validFrom = DateTime.fromISO(config.validFrom || prices[0].start.substr(0, 10));
33
+ const validTo = DateTime.fromISO(config.validTo || prices[prices.length - 1].start.substr(0, 10));
34
+ prices.forEach((p, i) => {
35
+ const date = DateTime.fromISO(p.start.substr(0, 10));
36
+ const hour = DateTime.fromISO(p.start).hour;
37
+ if (date >= validFrom && date <= validTo) {
38
+ prices[i].value = roundPrice(prices[i].value + allHours[hour]);
39
+ }
40
+ });
41
+ }
42
+
43
+ module.exports = {
44
+ addTariffToPrices,
45
+ buildAllHours,
46
+ };