I Node Red ser det slik ut (eksempel med filter og varmepumpe for poolen):
Fra venstre kommer signal inn som fyrer i gang denne flowen hver gang tilgjengelig effekt endrer seg. Det er det jeg i forrige innlegg kaller forsinkelse i sekunder (OnCnt) men det er jo bare noe i nærheten av litt lange sekund men det er helt greit. Viktig å få kjapp reaksjon med en gang tilgjengelig effekt blir for liten.
flow.Pool... er av/på brytere i Node Red Dashboard som jeg har lagret i flow variabler. Det gjør det enkelt å bruke en switch node som "sporveksler" i flowen.
Så kommer setting av de 3 parametre og funksjon PowerPri for å slå av/på om energibetingelsene er oppfylt.
LowPriAllowed er timeren som tillater at lavprioriterte laster i det hele tatt slås på. Denne kan typisk i disse dager være kl 0900-1900. Da er der fremdeles litt sol igjen om kvelden til å toppe opp batteriene mest mulig før natten.
Til slutt MQTT Out som styrer de aktuelle enhetene.
[{"id":"abd0f5e89c226e10","type":"mqtt out","z":"7c77ed50c61b9875","name":"Pool Filter","topic":"zwave/Pool/Filter/switch_binary/endpoint_0/targetValue/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"6db118ed1b0c56de","x":1370,"y":150,"wires":[]},{"id":"7903c7be3acba673","type":"mqtt out","z":"7c77ed50c61b9875","name":"Pool VP","topic":"zwave/Pool/VP/switch_binary/endpoint_0/targetValue/set","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"6db118ed1b0c56de","x":1380,"y":250,"wires":[]},{"id":"5d0fce36b822f632","type":"switch","z":"7c77ed50c61b9875","name":"LowPriAllowed","property":"LowPriAllowed","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":150,"wires":[["096324008fd4be75"],["1314e388b58820f0"]]},{"id":"9b82aa6f0db1d800","type":"switch","z":"7c77ed50c61b9875","name":"LowPriAllowed","property":"LowPriAllowed","propertyType":"global","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":240,"wires":[["7a0859dd428bb88f"],["b17fa6abc9b34095"]]},{"id":"c495994f4fb602b3","type":"function","z":"7c77ed50c61b9875","name":"PowerPri (v1.5)","func":"var svar = \"\";\nvar value = null;\nvar SOn=msg.payload.SpareOn;\nvar SOff=msg.payload.SpareOff;\nvar OnCntSP=msg.payload.OnCnt;\nvar OnCnt = context.get(\"OnCnt\")||0\nvar SparePower = global.get(\"SparePower\")||4000\n\nif (SparePower < SOff){\n OnCnt = 0;\n context.set(\"OnCnt\", OnCnt);\n value = false;\n// svar = {payload:value};\n// return [null,svar]\n }\nif (SparePower < SOn){\n OnCnt = 1;\n context.set(\"OnCnt\", OnCnt);\n}\n\nif (SparePower > SOn){\n OnCnt += 1;\n context.set(\"OnCnt\", OnCnt);\n if (OnCnt >= OnCntSP){\n value = true;\n// svar = {payload:value};\n// return [svar, null]\n }\n }\n//node.warn(SOn + \" \" + SOff + \" \" + OnCntSP + \" \" + OnCnt + \" \" + SparePower + \" \" + value);\n\nif (value == true){\n svar = {payload:value};\n return [svar,null];\n}\n if (value == false){\n svar = {payload:value};\n return [null,svar];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":250,"wires":[["9b82aa6f0db1d800"],["b17fa6abc9b34095"]]},{"id":"5d05b014c0cbb57c","type":"change","z":"7c77ed50c61b9875","name":"Set params","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.SpareOn","pt":"msg","to":"3100","tot":"num"},{"t":"set","p":"payload.SpareOff","pt":"msg","to":"0","tot":"num"},{"t":"set","p":"payload.OnCnt","pt":"msg","to":"10","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":250,"wires":[["c495994f4fb602b3"]]},{"id":"7a0859dd428bb88f","type":"show-value","z":"7c77ed50c61b9875","name":"","path":"","x":1220,"y":250,"wires":[["7903c7be3acba673"]]},{"id":"b17fa6abc9b34095","type":"change","z":"7c77ed50c61b9875","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":270,"wires":[["7a0859dd428bb88f"]]},{"id":"1314e388b58820f0","type":"change","z":"7c77ed50c61b9875","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1050,"y":180,"wires":[["096324008fd4be75"]]},{"id":"89e0ea16e85c026b","type":"link in","z":"7c77ed50c61b9875","name":"InverterSparePower2","links":["5b9770d4f74c5c79"],"x":165,"y":210,"wires":[["98e076f081850425","f3e219b035e4dac7"]]},{"id":"98e076f081850425","type":"switch","z":"7c77ed50c61b9875","name":"flow.PoolVPSW","property":"PoolVPSW","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":280,"y":260,"wires":[["5d05b014c0cbb57c"],["b17fa6abc9b34095"]]},{"id":"f3e219b035e4dac7","type":"switch","z":"7c77ed50c61b9875","name":"flow.PoolFiltSW","property":"PoolFiltSW","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":280,"y":170,"wires":[["e10b0f78fcb6967f"],["1314e388b58820f0"]]},{"id":"004d19f67b3fdba4","type":"function","z":"7c77ed50c61b9875","name":"PowerPri (v1.5)","func":"var svar = \"\";\nvar value = null;\nvar SOn=msg.payload.SpareOn;\nvar SOff=msg.payload.SpareOff;\nvar OnCntSP=msg.payload.OnCnt;\nvar OnCnt = context.get(\"OnCnt\")||0\nvar SparePower = global.get(\"SparePower\")||4000\n\nif (SparePower < SOff){\n OnCnt = 0;\n context.set(\"OnCnt\", OnCnt);\n value = false;\n// svar = {payload:value};\n// return [null,svar]\n }\nif (SparePower < SOn){\n OnCnt = 1;\n context.set(\"OnCnt\", OnCnt);\n}\n\nif (SparePower > SOn){\n OnCnt += 1;\n context.set(\"OnCnt\", OnCnt);\n if (OnCnt >= OnCntSP){\n value = true;\n// svar = {payload:value};\n// return [svar, null]\n }\n }\n//node.warn(SOn + \" \" + SOff + \" \" + OnCntSP + \" \" + OnCnt + \" \" + SparePower + \" \" + value);\n\nif (value == true){\n svar = {payload:value};\n return [svar,null];\n}\n if (value == false){\n svar = {payload:value};\n return [null,svar];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":650,"y":160,"wires":[["5d0fce36b822f632"],["1314e388b58820f0"]]},{"id":"e10b0f78fcb6967f","type":"change","z":"7c77ed50c61b9875","name":"Set params","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.SpareOn","pt":"msg","to":"400","tot":"num"},{"t":"set","p":"payload.SpareOff","pt":"msg","to":"0","tot":"num"},{"t":"set","p":"payload.OnCnt","pt":"msg","to":"5","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":160,"wires":[["004d19f67b3fdba4"]]},{"id":"096324008fd4be75","type":"show-value","z":"7c77ed50c61b9875","name":"","path":"","x":1210,"y":150,"wires":[["abd0f5e89c226e10"]]},{"id":"6db118ed1b0c56de","type":"mqtt-broker","name":"DaleMQTT","broker":"172.16.0.94","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]