node-red-contrib-power-saver 3.1.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/.vuepress/config.js +1 -0
- package/docs/.vuepress/dist/.nojekyll +0 -0
- package/docs/.vuepress/dist/404.html +2 -2
- package/docs/.vuepress/dist/assets/js/{app.6090e276.js → app.49ad6d54.js} +1 -1
- package/docs/.vuepress/dist/assets/js/runtime~app.547d0f4e.js +1 -0
- package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.3b37457f.js +1 -0
- package/docs/.vuepress/dist/assets/js/{v-1e2b191e.50b8fa18.js → v-1e2b191e.98cc227b.js} +1 -1
- package/docs/.vuepress/dist/assets/js/v-4637f9e4.b320f5e8.js +1 -0
- package/docs/.vuepress/dist/assets/js/v-510ed0d4.3c7e0056.js +1 -0
- package/docs/.vuepress/dist/changelog/index.html +3 -3
- package/docs/.vuepress/dist/contribute/index.html +2 -2
- package/docs/.vuepress/dist/examples/example-next-schedule-entity.html +2 -2
- package/docs/.vuepress/dist/examples/example-nordpool-current-state.html +2 -2
- package/docs/.vuepress/dist/examples/example-nordpool-events-state.html +2 -2
- package/docs/.vuepress/dist/examples/example-tibber-mqtt.html +2 -2
- package/docs/.vuepress/dist/examples/index.html +2 -2
- package/docs/.vuepress/dist/faq/index.html +2 -2
- package/docs/.vuepress/dist/guide/index.html +2 -2
- package/docs/.vuepress/dist/index.html +2 -2
- package/docs/.vuepress/dist/nodes/index.html +2 -2
- package/docs/.vuepress/dist/nodes/old-power-saver-doc.html +2 -2
- package/docs/.vuepress/dist/nodes/power-saver.html +2 -2
- package/docs/.vuepress/dist/nodes/ps-elvia-add-tariff.html +2 -2
- package/docs/.vuepress/dist/nodes/ps-general-add-tariff.html +3 -3
- package/docs/.vuepress/dist/nodes/ps-receive-price.html +2 -2
- package/docs/.vuepress/dist/nodes/ps-strategy-best-save.html +7 -5
- package/docs/.vuepress/dist/nodes/ps-strategy-lowest-price.html +7 -5
- package/docs/.vuepress/dist/nodes/strategy-input.html +2 -2
- package/docs/changelog/README.md +19 -0
- package/docs/nodes/ps-general-add-tariff.md +2 -0
- package/docs/nodes/ps-strategy-best-save.md +6 -2
- package/docs/nodes/ps-strategy-lowest-price.md +6 -2
- package/package.json +1 -1
- package/src/elvia/elvia-add-tariff.js +5 -1
- package/src/general-add-tariff-functions.js +0 -1
- package/src/general-add-tariff.js +2 -4
- package/src/handle-input.js +10 -8
- package/src/receive-price.js +6 -1
- package/test/general-add-tariff.test.js +5 -2
- package/test/send-config-input.test.js +44 -0
- package/docs/.vuepress/dist/assets/js/runtime~app.c30fcb3d.js +0 -1
- package/docs/.vuepress/dist/assets/js/v-0b5e3c8c.34230e16.js +0 -1
- package/docs/.vuepress/dist/assets/js/v-4637f9e4.38f66bbb.js +0 -1
- package/docs/.vuepress/dist/assets/js/v-510ed0d4.f8668033.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-general-add-tariff | 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.
|
|
8
|
+
<link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.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><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">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 active">Grid tariff nodes</p><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="ps-general-add-tariff"><!--[--><!--]--> ps-general-add-tariff <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.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-general-add-tariff.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-general-add-tariff.html#add-and-delete-periods" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Add and delete periods"><!--[--><!--]--> Add and delete periods <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html#from-time-and-value" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="From time and Value"><!--[--><!--]--> From time and Value <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html#valid-from-date" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Valid from date"><!--[--><!--]--> Valid from date <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html#valid-to-date" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Valid to date"><!--[--><!--]--> Valid to date <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.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-general-add-tariff.html#output" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Output"><!--[--><!--]--> Output <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><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-general-add-tariff" tabindex="-1"><a class="header-anchor" href="#ps-general-add-tariff" aria-hidden="true">#</a> ps-general-add-tariff</h1><p><img src="/node-red-contrib-power-saver/assets/img/node-ps-general-add-tariff.a3cf6f06.png" alt="ps-general-add-tariff"></p><p>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.</p><h2 id="description" tabindex="-1"><a class="header-anchor" href="#description" aria-hidden="true">#</a> Description</h2><p>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.</p><p>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.</p><p>Here is how this node is normally used:</p><p><img src="/node-red-contrib-power-saver/assets/img/add-tariff-flow.eb700d4f.png" alt="general flow"></p><div class="custom-container tip"><p class="custom-container-title">Changes during the year</p><p>If there is one price now, and another price from a specific date, you can use two nodes after each other. Set the <code>Valid to date</code> of the node with the current prices to the last date the current prices are valid. Set the <code>Valid from date</code> of the node with the upcoming prices to the first date those prices are valid.</p></div><h2 id="configuration" tabindex="-1"><a class="header-anchor" href="#configuration" aria-hidden="true">#</a> Configuration</h2><h3 id="add-and-delete-periods" tabindex="-1"><a class="header-anchor" href="#add-and-delete-periods" aria-hidden="true">#</a> Add and delete periods</h3><p>You can have from 1 to 24 periods during the day, with different values to add for each hour. Click the <code>Add period</code> button to add more periods. Click the <code>X</code> button to delete a period.</p><h3 id="from-time-and-value" tabindex="-1"><a class="header-anchor" href="#from-time-and-value" aria-hidden="true">#</a> From time and Value</h3><p>For each period, select the time of the day the value is valid from, and enter the value.</p><h3 id="valid-from-date" tabindex="-1"><a class="header-anchor" href="#valid-from-date" aria-hidden="true">#</a> Valid from date</h3><p>Fill in the first date the config is valid.</p><p>If this is empty, the config is valid from the dawn of time.</p><h3 id="valid-to-date" tabindex="-1"><a class="header-anchor" href="#valid-to-date" aria-hidden="true">#</a> Valid to date</h3><p>Fill in the last date the config is valid.</p><p>If this is empty, the config is valid until forever.</p><h2 id="input" tabindex="-1"><a class="header-anchor" href="#input" aria-hidden="true">#</a> Input</h2><p>The input is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><h2 id="output" tabindex="-1"><a class="header-anchor" href="#output" aria-hidden="true">#</a> Output</h2><p>The output is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">1/5/2022, 7:42:13 PM</span></div><!----></footer><nav class="page-nav"><p class="inner"><!----><span class="next"><a href="/node-red-contrib-power-saver/nodes/ps-elvia-add-tariff.html" class="nav-link" aria-label="ps-elvia-add-tariff"><!--[--><!--]--> ps-elvia-add-tariff <!--[--><!--]--></a> → </span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
|
|
13
|
-
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.
|
|
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">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 active">Grid tariff nodes</p><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="ps-general-add-tariff"><!--[--><!--]--> ps-general-add-tariff <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.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-general-add-tariff.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-general-add-tariff.html#add-and-delete-periods" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Add and delete periods"><!--[--><!--]--> Add and delete periods <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html#from-time-and-value" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="From time and Value"><!--[--><!--]--> From time and Value <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html#valid-from-date" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Valid from date"><!--[--><!--]--> Valid from date <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.html#valid-to-date" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Valid to date"><!--[--><!--]--> Valid to date <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><li><!--[--><a aria-current="page" href="/node-red-contrib-power-saver/nodes/ps-general-add-tariff.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-general-add-tariff.html#output" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="Output"><!--[--><!--]--> Output <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li><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-general-add-tariff" tabindex="-1"><a class="header-anchor" href="#ps-general-add-tariff" aria-hidden="true">#</a> ps-general-add-tariff</h1><p><img src="/node-red-contrib-power-saver/assets/img/node-ps-general-add-tariff.a3cf6f06.png" alt="ps-general-add-tariff"></p><p>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.</p><h2 id="description" tabindex="-1"><a class="header-anchor" href="#description" aria-hidden="true">#</a> Description</h2><p>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.</p><p>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.</p><p>Here is how this node is normally used:</p><p><img src="/node-red-contrib-power-saver/assets/img/add-tariff-flow.eb700d4f.png" alt="general flow"></p><div class="custom-container tip"><p class="custom-container-title">Changes during the year</p><p>If there is one price now, and another price from a specific date, you can use two nodes after each other. Set the <code>Valid to date</code> of the node with the current prices to the last date the current prices are valid. Set the <code>Valid from date</code> of the node with the upcoming prices to the first date those prices are valid.</p></div><h2 id="configuration" tabindex="-1"><a class="header-anchor" href="#configuration" aria-hidden="true">#</a> Configuration</h2><h3 id="add-and-delete-periods" tabindex="-1"><a class="header-anchor" href="#add-and-delete-periods" aria-hidden="true">#</a> Add and delete periods</h3><p>You can have from 1 to 24 periods during the day, with different values to add for each hour. Click the <code>Add period</code> button to add more periods. Click the <code>X</code> button to delete a period.</p><h3 id="from-time-and-value" tabindex="-1"><a class="header-anchor" href="#from-time-and-value" aria-hidden="true">#</a> From time and Value</h3><p>For each period, select the time of the day the value is valid from, and enter the value.</p><h3 id="valid-from-date" tabindex="-1"><a class="header-anchor" href="#valid-from-date" aria-hidden="true">#</a> Valid from date</h3><p>Fill in the first date the config is valid.</p><p>If this is empty, the config is valid from the dawn of time.</p><h3 id="valid-to-date" tabindex="-1"><a class="header-anchor" href="#valid-to-date" aria-hidden="true">#</a> Valid to date</h3><p>Fill in the last date the config is valid.</p><p>If this is empty, the config is valid until forever.</p><h2 id="input" tabindex="-1"><a class="header-anchor" href="#input" aria-hidden="true">#</a> Input</h2><p>The input is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><h2 id="output" tabindex="-1"><a class="header-anchor" href="#output" aria-hidden="true">#</a> Output</h2><p>The output is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><p>If there is a config property in the input payload, it is passed on to the output payload.</p><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">1/7/2022, 9:09:31 PM</span></div><!----></footer><nav class="page-nav"><p class="inner"><!----><span class="next"><a href="/node-red-contrib-power-saver/nodes/ps-elvia-add-tariff.html" class="nav-link" aria-label="ps-elvia-add-tariff"><!--[--><!--]--> ps-elvia-add-tariff <!--[--><!--]--></a> → </span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
|
|
13
|
+
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.js" defer></script>
|
|
14
14
|
</body>
|
|
15
15
|
</html>
|
|
@@ -5,7 +5,7 @@
|
|
|
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-receive-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.
|
|
8
|
+
<link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.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>
|
|
@@ -75,6 +75,6 @@
|
|
|
75
75
|
<span class="token punctuation">]</span>
|
|
76
76
|
<span class="token punctuation">}</span>
|
|
77
77
|
</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></div></div><h2 id="output" tabindex="-1"><a class="header-anchor" href="#output" aria-hidden="true">#</a> Output</h2><p>The output is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a>, so it can be sent directly to the strategy nodes, or via any <code>ps-xxx-add-tariff</code> node.</p><!--]--></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-lowest-price.html" class="nav-link" aria-label="ps-strategy-lowest-price"><!--[--><!--]--> ps-strategy-lowest-price <!--[--><!--]--></a></span><!----></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
|
|
78
|
-
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.
|
|
78
|
+
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.js" defer></script>
|
|
79
79
|
</body>
|
|
80
80
|
</html>
|
|
@@ -5,7 +5,7 @@
|
|
|
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-best-save | 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.
|
|
8
|
+
<link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.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>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<span class="token property">"scheduleOnlyFromCurrentTime"</span><span class="token operator">:</span> <span class="token boolean">false</span>
|
|
20
20
|
<span class="token punctuation">}</span>
|
|
21
21
|
<span class="token punctuation">}</span>
|
|
22
|
-
</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></div></div><p>All the variables in the config object are optional. You can send only those you want to change.</p><p>The config sent like this will be valid until a new config is sent the same way, or until the flow is restarted. On a restart, the original config set up in the node will be used.</p><p>When a config is sent like this, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.</p><h2 id="input" tabindex="-1"><a class="header-anchor" href="#input" aria-hidden="true">#</a> Input</h2><p>The input is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><h2 id="output" tabindex="-1"><a class="header-anchor" href="#output" aria-hidden="true">#</a> Output</h2><p>There are three outputs. You use only those you need for your purpose.</p><h3 id="output-1" tabindex="-1"><a class="header-anchor" href="#output-1" aria-hidden="true">#</a> Output 1</h3><p>A payload with the word <code>true</code> is sent to output 1 whenever the power / switch shall be turned on.</p><h3 id="output-2" tabindex="-1"><a class="header-anchor" href="#output-2" aria-hidden="true">#</a> Output 2</h3><p>A payload with the word <code>false</code> is sent to output 2 whenever the power / switch shall be turned off.</p><h3 id="output-3" tabindex="-1"><a class="header-anchor" href="#output-3" aria-hidden="true">#</a> Output 3</h3><p>When a valid input is received, and the schedule is recalculated, the resulting schedule, as well as some other information, is sent to output 3. You can use this to see the plan and verify that it meets your expectations. You can also use it to display the schedule in any way you like.</p><p>Example of output:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
|
|
22
|
+
</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></div></div><p>All the variables in the config object are optional. You can send only those you want to change.</p><p>The config sent like this will be valid until a new config is sent the same way, or until the flow is restarted. On a restart, the original config set up in the node will be used.</p><p>When a config is sent like this, and without price data, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.</p><p>However, you can send config and price data in the same message. Then both will be used .</p><h2 id="input" tabindex="-1"><a class="header-anchor" href="#input" aria-hidden="true">#</a> Input</h2><p>The input is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><h2 id="output" tabindex="-1"><a class="header-anchor" href="#output" aria-hidden="true">#</a> Output</h2><p>There are three outputs. You use only those you need for your purpose.</p><h3 id="output-1" tabindex="-1"><a class="header-anchor" href="#output-1" aria-hidden="true">#</a> Output 1</h3><p>A payload with the word <code>true</code> is sent to output 1 whenever the power / switch shall be turned on.</p><h3 id="output-2" tabindex="-1"><a class="header-anchor" href="#output-2" aria-hidden="true">#</a> Output 2</h3><p>A payload with the word <code>false</code> is sent to output 2 whenever the power / switch shall be turned off.</p><h3 id="output-3" tabindex="-1"><a class="header-anchor" href="#output-3" aria-hidden="true">#</a> Output 3</h3><p>When a valid input is received, and the schedule is recalculated, the resulting schedule, as well as some other information, is sent to output 3. You can use this to see the plan and verify that it meets your expectations. You can also use it to display the schedule in any way you like.</p><p>Example of output:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
|
|
23
23
|
<span class="token property">"schedule"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
|
|
24
24
|
<span class="token punctuation">{</span>
|
|
25
25
|
<span class="token property">"time"</span><span class="token operator">:</span> <span class="token string">"2021-09-30T00:00:00.000+02:00"</span><span class="token punctuation">,</span>
|
|
@@ -57,9 +57,11 @@
|
|
|
57
57
|
<span class="token property">"minSaving"</span><span class="token operator">:</span> <span class="token number">0.001</span><span class="token punctuation">,</span>
|
|
58
58
|
<span class="token property">"sendCurrentValueWhenRescheduling"</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
|
|
59
59
|
<span class="token property">"outputIfNoSchedule"</span><span class="token operator">:</span> <span class="token boolean">false</span>
|
|
60
|
-
<span class="token punctuation">}</span>
|
|
60
|
+
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
|
61
|
+
<span class="token property">"time"</span><span class="token operator">:</span> <span class="token string">"2021-09-30T23:45:12.123+02:00"</span><span class="token punctuation">,</span>
|
|
62
|
+
<span class="token property">"version"</span><span class="token operator">:</span> <span class="token string">"3.1.2"</span>
|
|
61
63
|
<span class="token punctuation">}</span>
|
|
62
|
-
</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></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="algorithm" tabindex="-1"><a class="header-anchor" href="#algorithm" aria-hidden="true">#</a> Algorithm</h2><p>The calculation that decides what hours to turn off works as follows:</p><ol><li>A matrix (x * y) is created where x is the number of hours we have price information for, and y is the configured maximum number of hours to turn off in a sequence.</li><li>The matrix is filled with how much you save by turning off hour x for y hours.</li><li>The matrix is processed calculating all possibilities for turning off a number of hours in a sequence and by that saving money. In this process all non-saving sequences are discarded. Also, if the average saving per hour is less than what you have configured as minimum amount to save per kWh, the sequence is discarded.</li><li>The remaining sequences are sorted by how much that is saved, in descending order.</li><li>Next, a table with one value per hour is created, with all hours in state "on".</li><li>Then the saving sequences is applied one by one, turning off the hours in each sequence, discarding sequences that lead to any violation of the rules set by the config.</li><li>When all sequences are processed, the resulting table shows a pretty good savings plan, that in most cases would be the optimal plan.</li></ol><p>I say "in most cases", because there is a chance that a group of two or more sequences combined can give a better plan than a single sequence preceeding those two, but where the selection of the one sequence causes the group to be discarded. If anyone encounters this situation, I would be happy to receive the price data set, and try to improve the algorithm even further.</p><h2 id="integration-with-magicmirror" tabindex="-1"><a class="header-anchor" href="#integration-with-magicmirror" aria-hidden="true">#</a> Integration with MagicMirror</h2><p>Are you using <a href="https://magicmirror.builders/" target="_blank" rel="noopener noreferrer">MagicMirror<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>? Are you also using <a href="https://tibber.com/" target="_blank" rel="noopener noreferrer">Tibber<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>? If so, there is a module for MM called <a href="https://github.com/ottopaulsen/MMM-Tibber" target="_blank" rel="noopener noreferrer">MMM-Tibber<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>, that easily can be used to show savings from this node.</p><p><img src="https://github.com/ottopaulsen/MMM-Tibber/blob/master/doc/MMM-Tibber-screenshot-savings-graph.png?raw=true" alt="Show savings in MMM-Tibber"></p><p>The purple lines show savings per kWh.</p><p>Read more about this in the <a href="https://github.com/ottopaulsen/MMM-Tibber#show-savings" target="_blank" rel="noopener noreferrer">MMM-Tibber documentation<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>.</p><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">
|
|
63
|
-
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.
|
|
64
|
+
</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></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="algorithm" tabindex="-1"><a class="header-anchor" href="#algorithm" aria-hidden="true">#</a> Algorithm</h2><p>The calculation that decides what hours to turn off works as follows:</p><ol><li>A matrix (x * y) is created where x is the number of hours we have price information for, and y is the configured maximum number of hours to turn off in a sequence.</li><li>The matrix is filled with how much you save by turning off hour x for y hours.</li><li>The matrix is processed calculating all possibilities for turning off a number of hours in a sequence and by that saving money. In this process all non-saving sequences are discarded. Also, if the average saving per hour is less than what you have configured as minimum amount to save per kWh, the sequence is discarded.</li><li>The remaining sequences are sorted by how much that is saved, in descending order.</li><li>Next, a table with one value per hour is created, with all hours in state "on".</li><li>Then the saving sequences is applied one by one, turning off the hours in each sequence, discarding sequences that lead to any violation of the rules set by the config.</li><li>When all sequences are processed, the resulting table shows a pretty good savings plan, that in most cases would be the optimal plan.</li></ol><p>I say "in most cases", because there is a chance that a group of two or more sequences combined can give a better plan than a single sequence preceeding those two, but where the selection of the one sequence causes the group to be discarded. If anyone encounters this situation, I would be happy to receive the price data set, and try to improve the algorithm even further.</p><h2 id="integration-with-magicmirror" tabindex="-1"><a class="header-anchor" href="#integration-with-magicmirror" aria-hidden="true">#</a> Integration with MagicMirror</h2><p>Are you using <a href="https://magicmirror.builders/" target="_blank" rel="noopener noreferrer">MagicMirror<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>? Are you also using <a href="https://tibber.com/" target="_blank" rel="noopener noreferrer">Tibber<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>? If so, there is a module for MM called <a href="https://github.com/ottopaulsen/MMM-Tibber" target="_blank" rel="noopener noreferrer">MMM-Tibber<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>, that easily can be used to show savings from this node.</p><p><img src="https://github.com/ottopaulsen/MMM-Tibber/blob/master/doc/MMM-Tibber-screenshot-savings-graph.png?raw=true" alt="Show savings in MMM-Tibber"></p><p>The purple lines show savings per kWh.</p><p>Read more about this in the <a href="https://github.com/ottopaulsen/MMM-Tibber#show-savings" target="_blank" rel="noopener noreferrer">MMM-Tibber documentation<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>.</p><!--]--></div><footer class="page-meta"><!----><div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><span class="meta-item-info">1/7/2022, 9:09:31 PM</span></div><!----></footer><nav class="page-nav"><p class="inner"><!----><span class="next"><a href="/node-red-contrib-power-saver/nodes/ps-strategy-lowest-price.html" class="nav-link" aria-label="ps-strategy-lowest-price"><!--[--><!--]--> ps-strategy-lowest-price <!--[--><!--]--></a> → </span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!--]--></div>
|
|
65
|
+
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.js" defer></script>
|
|
64
66
|
</body>
|
|
65
67
|
</html>
|
|
@@ -5,7 +5,7 @@
|
|
|
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.
|
|
8
|
+
<link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.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>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<span class="token property">"outputOutsidePeriod"</span><span class="token operator">:</span> <span class="token boolean">false</span>
|
|
21
21
|
<span class="token punctuation">}</span>
|
|
22
22
|
<span class="token punctuation">}</span>
|
|
23
|
-
</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></div></div><p>All the variables in the config object are optional. You can send only those you want to change.</p><p>The config sent like this will be valid until a new config is sent the same way, or until the flow is restarted. On a restart, the original config set up in the node will be used.</p><p>When a config is sent like this, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.</p><h2 id="input" tabindex="-1"><a class="header-anchor" href="#input" aria-hidden="true">#</a> Input</h2><p>The input is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><h2 id="output" tabindex="-1"><a class="header-anchor" href="#output" aria-hidden="true">#</a> Output</h2><p>When a valid input is received, and the schedule is recalculated, the resulting schedule, as well as some other information, is sent to output 3. You can use this to see the plan and verify that it meets your expectations. You can also use it to display the schedule in any way you like.</p><p>Example of output:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
|
|
23
|
+
</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></div></div><p>All the variables in the config object are optional. You can send only those you want to change.</p><p>The config sent like this will be valid until a new config is sent the same way, or until the flow is restarted. On a restart, the original config set up in the node will be used.</p><p>When a config is sent like this, and without price data, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.</p><p>However, you can send config and price data in the same message. Then both will be used .</p><h2 id="input" tabindex="-1"><a class="header-anchor" href="#input" aria-hidden="true">#</a> Input</h2><p>The input is the <a href="/node-red-contrib-power-saver/nodes/strategy-input.html" class="">common strategy input format</a></p><h2 id="output" tabindex="-1"><a class="header-anchor" href="#output" aria-hidden="true">#</a> Output</h2><p>When a valid input is received, and the schedule is recalculated, the resulting schedule, as well as some other information, is sent to output 3. You can use this to see the plan and verify that it meets your expectations. You can also use it to display the schedule in any way you like.</p><p>Example of output:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
|
|
24
24
|
<span class="token property">"schedule"</span><span class="token operator">:</span> <span class="token punctuation">[</span>
|
|
25
25
|
<span class="token punctuation">{</span>
|
|
26
26
|
<span class="token property">"time"</span><span class="token operator">:</span> <span class="token string">"2021-12-10T00:00:00.000+01:00"</span><span class="token punctuation">,</span>
|
|
@@ -81,9 +81,11 @@
|
|
|
81
81
|
<span class="token property">"sendCurrentValueWhenRescheduling"</span><span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
|
|
82
82
|
<span class="token property">"outputIfNoSchedule"</span><span class="token operator">:</span> <span class="token string">"true"</span><span class="token punctuation">,</span>
|
|
83
83
|
<span class="token property">"outputOutsidePeriod"</span><span class="token operator">:</span> <span class="token string">"true"</span>
|
|
84
|
-
<span class="token punctuation">}</span>
|
|
84
|
+
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
|
85
|
+
<span class="token property">"time"</span><span class="token operator">:</span> <span class="token string">"2021-09-30T23:45:12.123+02:00"</span><span class="token punctuation">,</span>
|
|
86
|
+
<span class="token property">"version"</span><span class="token operator">:</span> <span class="token string">"3.1.2"</span>
|
|
85
87
|
<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 & 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">
|
|
87
|
-
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.
|
|
88
|
+
</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><span class="line-number">64</span><br><span class="line-number">65</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 & 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">1/7/2022, 9:09:31 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>
|
|
89
|
+
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.js" defer></script>
|
|
88
90
|
</body>
|
|
89
91
|
</html>
|
|
@@ -5,7 +5,7 @@
|
|
|
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.
|
|
8
|
+
<link rel="preload" href="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.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>
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
<span class="token punctuation">]</span>
|
|
36
36
|
<span class="token punctuation">}</span>
|
|
37
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.
|
|
38
|
+
<script src="/node-red-contrib-power-saver/assets/js/runtime~app.547d0f4e.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.49ad6d54.js" defer></script>
|
|
39
39
|
</body>
|
|
40
40
|
</html>
|
package/docs/changelog/README.md
CHANGED
|
@@ -6,6 +6,25 @@ sidebar: "auto"
|
|
|
6
6
|
|
|
7
7
|
List the most significant changes, starting in version 1.0.9.
|
|
8
8
|
|
|
9
|
+
## 3.2.3
|
|
10
|
+
|
|
11
|
+
- Remove unused imports
|
|
12
|
+
- Fix doc deployment issue
|
|
13
|
+
|
|
14
|
+
## 3.2.2
|
|
15
|
+
|
|
16
|
+
- New attempt to solve the problem with multiple outputs at the same time.
|
|
17
|
+
|
|
18
|
+
## 3.2.1
|
|
19
|
+
|
|
20
|
+
- Fix that may solve the problem with multiple outputs at the same time.
|
|
21
|
+
|
|
22
|
+
## 3.2.0
|
|
23
|
+
|
|
24
|
+
- Config can be sent on input to strategy nodes together with price data, in the same message.
|
|
25
|
+
- The ps-receive-price and ps-xxx-add-tariff nodes pass config through from input to output.
|
|
26
|
+
- Status on strategy nodes shows the time for the next change.
|
|
27
|
+
|
|
9
28
|
## 3.1.2
|
|
10
29
|
|
|
11
30
|
- Add time, version and current value to output from strategy nodes.
|
|
@@ -52,7 +52,9 @@ All the variables in the config object are optional. You can send only those you
|
|
|
52
52
|
|
|
53
53
|
The config sent like this will be valid until a new config is sent the same way, or until the flow is restarted. On a restart, the original config set up in the node will be used.
|
|
54
54
|
|
|
55
|
-
When a config is sent like this, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.
|
|
55
|
+
When a config is sent like this, and without price data, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.
|
|
56
|
+
|
|
57
|
+
However, you can send config and price data in the same message. Then both will be used .
|
|
56
58
|
|
|
57
59
|
## Input
|
|
58
60
|
|
|
@@ -115,7 +117,9 @@ Example of output:
|
|
|
115
117
|
"minSaving": 0.001,
|
|
116
118
|
"sendCurrentValueWhenRescheduling": true,
|
|
117
119
|
"outputIfNoSchedule": false
|
|
118
|
-
}
|
|
120
|
+
},
|
|
121
|
+
"time": "2021-09-30T23:45:12.123+02:00",
|
|
122
|
+
"version": "3.1.2"
|
|
119
123
|
}
|
|
120
124
|
```
|
|
121
125
|
|
|
@@ -70,7 +70,9 @@ All the variables in the config object are optional. You can send only those you
|
|
|
70
70
|
|
|
71
71
|
The config sent like this will be valid until a new config is sent the same way, or until the flow is restarted. On a restart, the original config set up in the node will be used.
|
|
72
72
|
|
|
73
|
-
When a config is sent like this, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.
|
|
73
|
+
When a config is sent like this, and without price data, the schedule will be replanned based on the last previously received price data. If no price data has been received, no scheduling is done.
|
|
74
|
+
|
|
75
|
+
However, you can send config and price data in the same message. Then both will be used .
|
|
74
76
|
|
|
75
77
|
## Input
|
|
76
78
|
|
|
@@ -144,7 +146,9 @@ Example of output:
|
|
|
144
146
|
"sendCurrentValueWhenRescheduling": true,
|
|
145
147
|
"outputIfNoSchedule": "true",
|
|
146
148
|
"outputOutsidePeriod": "true"
|
|
147
|
-
}
|
|
149
|
+
},
|
|
150
|
+
"time": "2021-09-30T23:45:12.123+02:00",
|
|
151
|
+
"version": "3.1.2"
|
|
148
152
|
}
|
|
149
153
|
```
|
|
150
154
|
|
package/package.json
CHANGED
|
@@ -39,7 +39,11 @@ module.exports = function (RED) {
|
|
|
39
39
|
p.value = roundPrice(p.powerPrice + p.gridTariffVariable);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
const payload = { priceData: prices };
|
|
43
|
+
if (msg.payload.config) {
|
|
44
|
+
payload.config = msg.payload.config;
|
|
45
|
+
}
|
|
46
|
+
node.send([{ payload }]);
|
|
43
47
|
});
|
|
44
48
|
});
|
|
45
49
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const cloneDeep = require("lodash.clonedeep");
|
|
2
|
-
const {
|
|
3
|
-
const {
|
|
4
|
-
const { roundPrice } = require("./utils");
|
|
5
|
-
const { extractPlanForDate, getEffectiveConfig, validationFailure } = require("./utils");
|
|
2
|
+
const { addTariffToPrices } = require("./general-add-tariff-functions");
|
|
3
|
+
const { getEffectiveConfig } = require("./utils");
|
|
6
4
|
|
|
7
5
|
module.exports = function (RED) {
|
|
8
6
|
function PsGeneralAddTariffNode(config) {
|
package/src/handle-input.js
CHANGED
|
@@ -3,13 +3,15 @@ const { DateTime } = require("luxon");
|
|
|
3
3
|
const { version } = require("../package.json");
|
|
4
4
|
|
|
5
5
|
function handleStrategyInput(node, msg, doPlanning) {
|
|
6
|
-
node.schedulingTimeout = null;
|
|
7
|
-
|
|
8
6
|
const effectiveConfig = getEffectiveConfig(node, msg);
|
|
7
|
+
|
|
9
8
|
if (!validateInput(node, msg)) {
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
const priceData = getPriceData(node, msg);
|
|
12
|
+
if (!priceData) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
13
15
|
const planFromTime = msg.payload.time ? DateTime.fromISO(msg.payload.time) : DateTime.now();
|
|
14
16
|
|
|
15
17
|
// Store config variables in node
|
|
@@ -67,7 +69,8 @@ function handleStrategyInput(node, msg, doPlanning) {
|
|
|
67
69
|
|
|
68
70
|
function getPriceData(node, msg) {
|
|
69
71
|
const isConfigMsg = !!msg?.payload?.config;
|
|
70
|
-
|
|
72
|
+
const isPriceMsg = !!msg?.payload?.priceData;
|
|
73
|
+
if (isConfigMsg && !isPriceMsg) {
|
|
71
74
|
return node.context().get("lastPriceData");
|
|
72
75
|
}
|
|
73
76
|
const priceData = msg.payload.priceData;
|
|
@@ -76,19 +79,18 @@ function getPriceData(node, msg) {
|
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
function runSchedule(node, schedule, time, currentSent = false) {
|
|
79
|
-
let currentTime = time;
|
|
80
82
|
let remainingSchedule = schedule.filter((entry) => {
|
|
81
|
-
return DateTime.fromISO(entry.time) >
|
|
83
|
+
return DateTime.fromISO(entry.time) > time;
|
|
82
84
|
});
|
|
83
85
|
if (remainingSchedule.length > 0) {
|
|
84
86
|
const entry = remainingSchedule[0];
|
|
85
87
|
const nextTime = DateTime.fromISO(entry.time);
|
|
86
|
-
const wait = nextTime -
|
|
88
|
+
const wait = nextTime - time;
|
|
87
89
|
const onOff = entry.value ? "on" : "off";
|
|
88
90
|
node.log("Switching " + onOff + " in " + wait + " milliseconds");
|
|
89
|
-
const statusMessage =
|
|
91
|
+
const statusMessage = `${remainingSchedule.length} changes - ${
|
|
90
92
|
remainingSchedule[0].value ? "on" : "off"
|
|
91
|
-
}`;
|
|
93
|
+
} at ${nextTime.toLocaleString(DateTime.TIME_SIMPLE)}`;
|
|
92
94
|
node.status({ fill: "green", shape: "dot", text: statusMessage });
|
|
93
95
|
return setTimeout(() => {
|
|
94
96
|
sendSwitch(node, entry.value);
|
package/src/receive-price.js
CHANGED
|
@@ -12,8 +12,13 @@ module.exports = function (RED) {
|
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
const payload = { priceData, source };
|
|
16
|
+
if (msg.config) {
|
|
17
|
+
payload.config = msg.config;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
// Send output
|
|
16
|
-
node.send({ payload
|
|
21
|
+
node.send({ payload });
|
|
17
22
|
});
|
|
18
23
|
}
|
|
19
24
|
|
|
@@ -55,7 +55,7 @@ describe("general-add-tariff node", function () {
|
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
it("should add to price", function (done) {
|
|
58
|
+
it("should add to price and config", function (done) {
|
|
59
59
|
const flow = [
|
|
60
60
|
{
|
|
61
61
|
id: "n1",
|
|
@@ -76,6 +76,7 @@ describe("general-add-tariff node", function () {
|
|
|
76
76
|
result.priceData[3].value = 2.0345;
|
|
77
77
|
result.priceData[4].value = 2.9;
|
|
78
78
|
result.priceData[5].value = 2.7;
|
|
79
|
+
result.config = { abc: 123 };
|
|
79
80
|
helper.load(addTariff, flow, function () {
|
|
80
81
|
const n1 = helper.getNode("n1");
|
|
81
82
|
const n2 = helper.getNode("n2");
|
|
@@ -83,7 +84,9 @@ describe("general-add-tariff node", function () {
|
|
|
83
84
|
expect(msg).toHaveProperty("payload", result);
|
|
84
85
|
done();
|
|
85
86
|
});
|
|
86
|
-
|
|
87
|
+
const payload = cloneDeep(prices);
|
|
88
|
+
payload.config = { abc: 123 };
|
|
89
|
+
n1.receive({ payload });
|
|
87
90
|
});
|
|
88
91
|
});
|
|
89
92
|
it("should add to price when only first day is valid", function (done) {
|