node-red-solar-diverter
A combination of flow and a minimal set of hardware that allows to divert solar generated energy to non electronic controlled devices, like a water heater or small heat accumulators.
Features
- Minimal and cheap hardware parts required. With just a chinese AC Dimmer and an ESP8266 you can work out the project.
- All the involved functions and requirements integrated in just one flow.
- Can manage excess energy from both feed-in or zero-feed systems.
- Uses a PID controller for a smooth operation.
- Publishes a small dashboard for easily testing and adjust.
Hardware
You will need an AC Dimmer rated for the required duty. I've been using the one on the following link (16A) with success with a 1500W water heater. Always when buying from chinese sources, chose a higher rating one. You should add a small fan to the heat-sink.
Then connect an ESP8266 to the dimmer and provide a suitable power source. You can power the board using a PSU or a phone charger.
The code for the ESP is contained at the root of the github repo. For the moment does not have any captive portal or other extra functionalities other than the minimal needed. Just edit the main file for entering your wifi SSID and Key and burn to the ESP using platformio.
The sketch will setup the ESP+Dimmer to receive the PWM setpoint via mqtt at the topic 'PWMController/value' and establish a time wachdog to avoid diverting if messages are not received for a period of time.
Flow
The flow has three parts: The upper-center one has the programming logic for the divert manager. You should edit the mqtt output node at the right and edit to match the topic configured in your ESP. On the center section a PID algorithm is implemented along with a manual override.
On the lower-left region is the inputs section. You only need to feed the in_Watts
input with the power source to monitor. Being grid feed-in, or battery watts in case of self-consumption.
There are implemented two possible ways of automating the diverter. The upper one uses the battery state (bulk/absorption/float) to dinamically set the diverting setpoint, but you could replace it with a SoC percentage logic. If you set a very high setpoint, will behave the same as it was turn off.
The last one turns on or off the system based on SoC. Could also be the daylight detection reported by some mppt controllers. This is useful in a zero-feedin system, as it could also have a nightly charging cycle, to avoid diverting in that cases.
The right section has the default values node, node-red-contrib-set-defaults
node is required here, and publishes an small dashboard useful for adjusting the PID coefficients, supervising and manually overriding the functions of the flow. Just like in the image below:
You can setup several PID implementations with their own parameters and switch them here and compare the results, as well as turning all off.
TODOs:
- Making it a node-red node. :grin:
Contribution
If that bit of work become useful to you, remember that you can make a donation or drop me a :beer:
[{"id":"5689a9933e238e57","type":"tab","label":"Diverter","disabled":false,"info":""},{"id":"179ce9bcc0731d9f","type":"group","z":"5689a9933e238e57","style":{"stroke":"#2e333a","stroke-opacity":"1","fill":"#383c45","fill-opacity":"0.5","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["0069a5896e256ef2","cf4db2b3bd6a252d","6d830da334fcf3e4","c0e7275fe20f508e","0d431f2fac39f961","9872c3739e460fb8","b0f1c802f1e90f3b","eba6743c3b6106db","1de401703b38fcf0","46485467942aaec4","f75acfe9cf187da0","6a7fca18b207e304","5567b5e0326dbb32","679d07ef10bc51b7","9a77847448cbeb62","b1fc334abf9018b6","bdf5869cd83ee288","8f7c641148ba21c0","5aaa11ae5f31efbd","dbecaf40e30b4550","c2e91454f5ca61e5","f059cd73b42143f6","5503f46c98df6f4d","952b75889c53cbf2","c43934dc40cdc23c","854c0b96024c3969","5498f155b005d729","bdfe2417e4307c0e"],"x":34,"y":459,"w":722,"h":602},{"id":"d2726c96f55e2e8f","type":"group","z":"5689a9933e238e57","style":{"stroke":"#2e333a","stroke-opacity":"1","fill":"#383c45","fill-opacity":"0.5","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["beb976f6e584d4b5","0baca73a01df5956","a841c39dc4d2ac12","0dbba99859581198","efb61250eb591cc4","4422bebce23278bc","3e956afda3a3bacb","cf404e55c263efb0","1b98dd837ce673eb","99e2b9a0ecc7ea0f","4e912d22de9a7595","44f413430a299441","66f73ee11bf0068b","91e4e5c28ea422f7","57c9d5e230efcfea"],"x":274,"y":39,"w":1392,"h":322},{"id":"e0f729e718392b31","type":"group","z":"5689a9933e238e57","style":{"stroke":"#2e333a","stroke-opacity":"1","fill":"#383c45","fill-opacity":"0.5","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["6143dfc0c066f213","43ca04fce322c208","d0edab7649689c19","6ecd029172aaaa08","0d672a649231d96b","2d985ab412c37929","88b066b039fb7a96","be458fa9a04aebb6","58315af0f2a0ca8f","f8e95b92a06ea107","4ff9ed661f11fe04","c770c5d8566fad24","e8b8be33cb5b62c0","fe6c597562114a67","35c3be1185cce8ea","6796d009c1ba85c3","7f22e802624da632","a5d31ccccc3a741d","805107ce76ddda33","590ca2fc5112e223","0fd6463f41107188","c9d32b771947d14c","b241ea6004b8cfe4","754b6a4488cd0290","f131f665110ee596","647b3b184b510f2c","47c1872074149a3a","012a1c9312f67046","be9178188bab3724","72c8d28db7ac4906","60496d5df66f6bdc","9e3712d3ad7fe731"],"x":774,"y":519,"w":952,"h":502},{"id":"6143dfc0c066f213","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setpoint","payload":"100","payloadType":"num","x":1070,"y":940,"wires":[["c9d32b771947d14c"]]},{"id":"0069a5896e256ef2","type":"debug","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":190,"y":600,"wires":[]},{"id":"43ca04fce322c208","type":"ui_chart","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","group":"c45a83a3.d00908","order":1,"width":0,"height":0,"label":"","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"60","removeOlderPoints":"","removeOlderUnit":"1","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#f7a359","#ff5c5f","#8afdff","#98df8a","#df8bdc","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":1610,"y":600,"wires":[[]]},{"id":"d0edab7649689c19","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"Clear chart on deploy","repeat":"","crontab":"","once":true,"topic":"","payload":"{\"data\":[]}","payloadType":"json","x":1160,"y":600,"wires":[["6ecd029172aaaa08"]]},{"id":"6ecd029172aaaa08","type":"change","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","rules":[{"t":"move","p":"payload.data","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1396,"y":600,"wires":[["43ca04fce322c208"]]},{"id":"beb976f6e584d4b5","type":"mqtt out","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","topic":"PWMController/value","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"bf885360.b5a32","x":1540,"y":140,"wires":[]},{"id":"0d672a649231d96b","type":"ui_slider","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"in","label":"Input","tooltip":"","group":"c45a83a3.d00908","order":5,"width":0,"height":0,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"-500","max":"2000","step":"10","x":1270,"y":720,"wires":[["590ca2fc5112e223"]]},{"id":"2d985ab412c37929","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input","payload":"100","payloadType":"num","x":880,"y":720,"wires":[["0d672a649231d96b"]]},{"id":"88b066b039fb7a96","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input","payload":"300","payloadType":"num","x":1060,"y":760,"wires":[["0d672a649231d96b"]]},{"id":"be458fa9a04aebb6","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"input","payload":"-200","payloadType":"num","x":880,"y":760,"wires":[["0d672a649231d96b"]]},{"id":"cf4db2b3bd6a252d","type":"change","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"in","rules":[{"t":"set","p":"topic","pt":"msg","to":"in","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":560,"wires":[["c0e7275fe20f508e","b0f1c802f1e90f3b"]]},{"id":"58315af0f2a0ca8f","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setpoint","payload":"1000","payloadType":"num","x":890,"y":940,"wires":[["c9d32b771947d14c"]]},{"id":"f8e95b92a06ea107","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setpoint","payload":"2000","payloadType":"num","x":890,"y":900,"wires":[["c9d32b771947d14c"]]},{"id":"0baca73a01df5956","type":"switch","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","property":"mode","propertyType":"flow","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"-1","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"false","repair":false,"outputs":3,"x":650,"y":220,"wires":[["0dbba99859581198"],["91e4e5c28ea422f7"],["a841c39dc4d2ac12"]]},{"id":"4ff9ed661f11fe04","type":"ui_dropdown","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"mode","label":"Mode","tooltip":"","place":"Select option","group":"c45a83a3.d00908","order":2,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"Manual","value":-1,"type":"num"},{"label":"OFF","value":0,"type":"num"},{"label":"PID","value":1,"type":"num"}],"payload":"","topic":"topic","topicType":"msg","x":1270,"y":660,"wires":[["c770c5d8566fad24"]]},{"id":"c770c5d8566fad24","type":"change","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","rules":[{"t":"set","p":"mode","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1440,"y":660,"wires":[[]]},{"id":"a841c39dc4d2ac12","type":"function","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"PID","func":"const SampleTime = 500;\n\nvar setpoint = flow.get(\"setpoint\") || 100;\n\nif (msg.hasOwnProperty(\"setpoint\")) {\n setpoint = msg.setpoint;\n node.status({ fill: \"blue\", shape: \"dot\", text: 'sp: ' + setpoint });\n flow.set(\"setpoint\", setpoint);\n}\n\n// Negative for energy diverting\n// -0.05 / -0.06 / -0.03\n// -0.10 / -0.07 / -0.04\nconst kp = -0.10;\nconst ki = -0.08;\nconst kd = -0.04;\n// const kp = -0.05;\n// const ki = -0.06;\n// const kd = -0.03;\nconst multiplier = 0.4;\n\n// 0 / 1023\nconst outMin = -255;\nconst outMax = 255;\n\nconst pOnE = false; // Proportional on Error else Proportional on Measurement\n\nconst now = Date.now();\nconst lastTime = context.get('lastTime') || 0;\nconst timeChange = (now - lastTime);\n\nconst lastInput = context.get('lastInput') || msg.payload;\nvar outputSum = context.get(\"outputSum\") || 0;\n\nif (timeChange < SampleTime) return null;\n\n/*Compute all the working error variables*/\nvar input = msg.payload,\n error = setpoint - input,\n dInput = (input - lastInput),\n output;\n\n/*Compute integral*/\noutputSum += (ki * error);\n\n/*Compute proportional*/\nif (pOnE) { output = kp * error; } /*Add Proportional on Error, if P_ON_E is specified*/\nelse { outputSum -= kp * dInput; output = 0; } /*Add Proportional on Measurement, if P_ON_M is specified*/\n\nif (outputSum > outMax) outputSum = outMax;\nelse if (outputSum < outMin) outputSum = outMin;\n\n/*Compute derivative*/\noutput -= kd * dInput;\n\n/*Merge*/\noutput += outputSum;\n\nif (output > outMax) output = outMax;\nelse if (output < outMin) output = outMin;\n\noutput *= multiplier;\noutput = Math.round((output + Number.EPSILON) * 1000) / 1000;\n\n/*Remember some variables for next time*/\ncontext.set(\"lastInput\", input);\ncontext.set(\"lastTime\", now);\n\nconst color = input < setpoint ? \"red\" : \"green\";\nnode.status({ fill: color, shape: \"dot\", text: 'sp: ' + setpoint + ', pid: ' + output });\n\nreturn { topic: \"pid\", payload: output };","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":890,"y":300,"wires":[["cf404e55c263efb0"]]},{"id":"e8b8be33cb5b62c0","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setpoint","payload":"20","payloadType":"num","x":1060,"y":980,"wires":[["c9d32b771947d14c"]]},{"id":"fe6c597562114a67","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"pwm","payload":"0","payloadType":"num","x":870,"y":840,"wires":[["7f22e802624da632"]]},{"id":"35c3be1185cce8ea","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"pwm","payload":"128","payloadType":"num","x":880,"y":800,"wires":[["7f22e802624da632"]]},{"id":"6796d009c1ba85c3","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"pwm","payload":"255","payloadType":"num","x":1060,"y":840,"wires":[["7f22e802624da632"]]},{"id":"7f22e802624da632","type":"ui_slider","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"pwm","label":"PWM","tooltip":"","group":"c45a83a3.d00908","order":4,"width":0,"height":0,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"0","max":"255","step":1,"x":1270,"y":800,"wires":[["a5d31ccccc3a741d"]]},{"id":"a5d31ccccc3a741d","type":"change","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","rules":[{"t":"set","p":"pwm","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1450,"y":800,"wires":[["805107ce76ddda33"]]},{"id":"805107ce76ddda33","type":"debug","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1610,"y":800,"wires":[]},{"id":"0dbba99859581198","type":"change","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"PowerOff","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":200,"wires":[["beb976f6e584d4b5"]]},{"id":"a5dc614295c82660","type":"comment","z":"5689a9933e238e57","name":"Solar diverter","info":"","x":110,"y":40,"wires":[]},{"id":"6d830da334fcf3e4","type":"link in","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"in_Watts","links":["5c71d5999762987c"],"x":75,"y":560,"wires":[["0069a5896e256ef2","bdfe2417e4307c0e"]]},{"id":"efb61250eb591cc4","type":"debug","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1510,"y":320,"wires":[]},{"id":"c0e7275fe20f508e","type":"smooth","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","property":"payload","action":"mean","count":"7","round":"0","mult":"single","reduce":false,"x":420,"y":560,"wires":[["0d431f2fac39f961"]]},{"id":"0d431f2fac39f961","type":"change","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"in-smooth","rules":[{"t":"set","p":"topic","pt":"msg","to":"in-smooth","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":560,"wires":[["eba6743c3b6106db"]]},{"id":"4422bebce23278bc","type":"inject","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","props":[{"p":"payload"}],"repeat":"0.25","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"in","payloadType":"flow","x":380,"y":200,"wires":[["0baca73a01df5956"]]},{"id":"590ca2fc5112e223","type":"change","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","rules":[{"t":"set","p":"in","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1460,"y":720,"wires":[[]]},{"id":"0fd6463f41107188","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setpoint","payload":"700","payloadType":"num","x":890,"y":980,"wires":[["c9d32b771947d14c"]]},{"id":"c9d32b771947d14c","type":"ui_slider","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"setpoint","label":"Setpoint","tooltip":"","group":"c45a83a3.d00908","order":3,"width":0,"height":0,"passthru":true,"outs":"end","topic":"topic","topicType":"msg","min":"0","max":"5000","step":"10","x":1280,"y":900,"wires":[["b241ea6004b8cfe4"]]},{"id":"b241ea6004b8cfe4","type":"change","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","rules":[{"t":"set","p":"setpoint","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1440,"y":900,"wires":[["754b6a4488cd0290"]]},{"id":"754b6a4488cd0290","type":"debug","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1610,"y":900,"wires":[]},{"id":"f131f665110ee596","type":"inject","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","props":[],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"str","x":870,"y":660,"wires":[["647b3b184b510f2c"]]},{"id":"647b3b184b510f2c","type":"set-defaults","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","rules":[{"p":"mode","pt":"flow","to":"1","tot":"num"},{"p":"pwm","pt":"flow","to":"0","tot":"num"},{"p":"setpoint","pt":"flow","to":"6000","tot":"num"}],"chbox_DoOutputToMessage":true,"chbox_SetCurrentToMsg":true,"howSend":{"text":"payload","type":"msg","modifiedValue":"payload"},"dropdown_HowManyMessages":"multiple","dropdownObjOrVal":"value","outputs":3,"x":1030,"y":660,"wires":[["4ff9ed661f11fe04"],["7f22e802624da632"],["c9d32b771947d14c"]]},{"id":"3e956afda3a3bacb","type":"inject","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","props":[{"p":"pid","v":"pid","vt":"flow"},{"p":"payload"}],"repeat":"0.5","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"pwm","payloadType":"flow","x":390,"y":140,"wires":[["57c9d5e230efcfea"]]},{"id":"cf404e55c263efb0","type":"change","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","rules":[{"t":"set","p":"pid","pt":"flow","to":"payload","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"pid","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1320,"y":280,"wires":[["44f413430a299441","efb61250eb591cc4"]]},{"id":"1b98dd837ce673eb","type":"change","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"pwm","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"payload + pid","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"$round(payload)","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"payload > 255 ? 255 : payload","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"payload < 0 ? 0 : payload","tot":"jsonata"},{"t":"set","p":"pwm","pt":"flow","to":"payload","tot":"msg"},{"t":"delete","p":"pid","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":140,"wires":[["99e2b9a0ecc7ea0f","4e912d22de9a7595","beb976f6e584d4b5"]]},{"id":"99e2b9a0ecc7ea0f","type":"debug","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":1050,"y":160,"wires":[]},{"id":"47c1872074149a3a","type":"link in","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"in_pwm","links":["4e912d22de9a7595"],"x":995,"y":800,"wires":[["7f22e802624da632"]]},{"id":"4e912d22de9a7595","type":"link out","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"out_pwm","links":["47c1872074149a3a","012a1c9312f67046"],"x":1015,"y":120,"wires":[]},{"id":"012a1c9312f67046","type":"link in","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","links":["4e912d22de9a7595","44f413430a299441","b0f1c802f1e90f3b","eba6743c3b6106db"],"x":1495,"y":560,"wires":[["43ca04fce322c208"]]},{"id":"44f413430a299441","type":"link out","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"","links":["012a1c9312f67046"],"x":1475,"y":280,"wires":[]},{"id":"9872c3739e460fb8","type":"comment","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"Input: Feed with grid W or battery W","info":"","x":200,"y":500,"wires":[]},{"id":"66f73ee11bf0068b","type":"comment","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"Output PWM: to send to the device","info":"","x":1460,"y":80,"wires":[]},{"id":"b0f1c802f1e90f3b","type":"link out","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","links":["012a1c9312f67046"],"x":375,"y":600,"wires":[]},{"id":"be9178188bab3724","type":"link in","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","links":["eba6743c3b6106db"],"x":995,"y":720,"wires":[["0d672a649231d96b"]]},{"id":"eba6743c3b6106db","type":"link out","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","links":["012a1c9312f67046","be9178188bab3724"],"x":655,"y":560,"wires":[]},{"id":"72c8d28db7ac4906","type":"comment","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"Control dashboard","info":"","x":890,"y":560,"wires":[]},{"id":"1de401703b38fcf0","type":"comment","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"Charge phase: Fixes a setpoint for each charging phase.","info":"","x":270,"y":680,"wires":[]},{"id":"46485467942aaec4","type":"link in","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","links":["57173daf7e57df64"],"x":75,"y":740,"wires":[["f75acfe9cf187da0","8f7c641148ba21c0"]]},{"id":"f75acfe9cf187da0","type":"debug","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":170,"y":780,"wires":[]},{"id":"6a7fca18b207e304","type":"switch","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"num"},{"t":"eq","v":"4","vt":"num"},{"t":"eq","v":"5","vt":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":4,"x":410,"y":740,"wires":[["5567b5e0326dbb32"],["679d07ef10bc51b7"],["9a77847448cbeb62"],["b1fc334abf9018b6"]]},{"id":"5567b5e0326dbb32","type":"change","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"2000","rules":[{"t":"set","p":"payload","pt":"msg","to":"2000","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":700,"wires":[["bdf5869cd83ee288"]]},{"id":"679d07ef10bc51b7","type":"change","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"500","rules":[{"t":"set","p":"payload","pt":"msg","to":"500","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":740,"wires":[["bdf5869cd83ee288"]]},{"id":"9a77847448cbeb62","type":"change","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"50","rules":[{"t":"set","p":"payload","pt":"msg","to":"50","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":780,"wires":[["bdf5869cd83ee288"]]},{"id":"b1fc334abf9018b6","type":"change","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"6000 (warning)","rules":[{"t":"set","p":"payload","pt":"msg","to":"6000","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":820,"wires":[["bdf5869cd83ee288"]]},{"id":"60496d5df66f6bdc","type":"link in","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","links":["bdf5869cd83ee288"],"x":1015,"y":900,"wires":[["c9d32b771947d14c"]]},{"id":"bdf5869cd83ee288","type":"link out","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","links":["60496d5df66f6bdc"],"x":715,"y":800,"wires":[]},{"id":"8f7c641148ba21c0","type":"switch","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"if auto","property":"mode","propertyType":"flow","rules":[{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":170,"y":740,"wires":[["5aaa11ae5f31efbd"]]},{"id":"5aaa11ae5f31efbd","type":"rbe","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":290,"y":740,"wires":[["6a7fca18b207e304"]]},{"id":"dbecaf40e30b4550","type":"link in","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"","links":["76cf8f4b3cf821e5"],"x":75,"y":980,"wires":[["f059cd73b42143f6","5503f46c98df6f4d"]]},{"id":"c2e91454f5ca61e5","type":"comment","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"SoC: Divert based on the SoC","info":"","x":180,"y":920,"wires":[]},{"id":"f059cd73b42143f6","type":"rbe","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":230,"y":980,"wires":[["952b75889c53cbf2"]]},{"id":"5503f46c98df6f4d","type":"debug","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":190,"y":1020,"wires":[]},{"id":"952b75889c53cbf2","type":"switch","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gte","v":"80","vt":"num"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":350,"y":980,"wires":[["c43934dc40cdc23c"],["854c0b96024c3969"]]},{"id":"c43934dc40cdc23c","type":"change","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":960,"wires":[["5498f155b005d729"]]},{"id":"854c0b96024c3969","type":"change","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":1000,"wires":[["5498f155b005d729"]]},{"id":"9e3712d3ad7fe731","type":"link in","z":"5689a9933e238e57","g":"e0f729e718392b31","name":"","links":["5498f155b005d729"],"x":1175,"y":680,"wires":[["4ff9ed661f11fe04"]]},{"id":"5498f155b005d729","type":"link out","z":"5689a9933e238e57","d":true,"g":"179ce9bcc0731d9f","name":"","links":["9e3712d3ad7fe731"],"x":595,"y":980,"wires":[]},{"id":"bdfe2417e4307c0e","type":"switch","z":"5689a9933e238e57","g":"179ce9bcc0731d9f","name":"if auto","property":"mode","propertyType":"flow","rules":[{"t":"gt","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":170,"y":560,"wires":[["cf4db2b3bd6a252d"]]},{"id":"91e4e5c28ea422f7","type":"change","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"Manual","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":240,"wires":[["cf404e55c263efb0"]]},{"id":"57c9d5e230efcfea","type":"switch","z":"5689a9933e238e57","g":"d2726c96f55e2e8f","name":"if on","property":"mode","propertyType":"flow","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":650,"y":140,"wires":[["1b98dd837ce673eb"]]},{"id":"c45a83a3.d00908","type":"ui_group","name":"Heater 1","tab":"80cd4062.93a5","order":1,"disp":true,"width":"12","collapse":false},{"id":"bf885360.b5a32","type":"mqtt-broker","name":"local","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"80cd4062.93a5","type":"ui_tab","name":"Diverter","icon":"flash_on","disabled":false,"hidden":false}]