You can not always be busy with our hobbies and for sure, business, family, etc has priority.
The result is very promising and there is only 1 small step to go.
You can create 3 additional "Custom" sensors. You can use "Scale" for that "Factory" and KG, but I would use "Custom" sensors and give the axis the following names: L, Trees, Kg.
Code: Select all
[{"id":"63bcbc31.eb708c","type":"http request","z":"d243b84a.4ac438","name":"HTTP AP Systems Production Request","method":"GET","ret":"txt","paytoqs":false,"url":"https://mbernard.home.xs4all.nl/youless/http%20_192.168.2.88_index.php_realtimedata.htm","tls":"","proxy":"","x":420,"y":440,"wires":[["c3df4a05.c383"]]},{"id":"d5e45a3a.244e5","type":"debug","z":"d243b84a.4ac438","name":"HTML Output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":720,"y":500,"wires":[]},{"id":"8501a12b.61eb4","type":"inject","z":"d243b84a.4ac438","name":"5 MIn Tick","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":"","x":140,"y":360,"wires":[["d1c96d07.95888"]]},{"id":"c3df4a05.c383","type":"html","z":"d243b84a.4ac438","name":"Scrape inverter","property":"payload","outproperty":"payload","tag":"td","ret":"html","as":"single","x":720,"y":440,"wires":[["d5e45a3a.244e5","80391cd8.5820d8"]]},{"id":"80391cd8.5820d8","type":"function","z":"d243b84a.4ac438","name":"Create Inverter Array","func":"var i;\nfor (i = 0; i < msg.payload.length/9; i++) {\nvar InverterIDA = msg.payload[9*i+0];\nvar CurrentPowerA = msg.payload[9*i+1];\nvar GridFreq = msg.payload[9*i+2];\nvar GridVoltageA = msg.payload[9*i+3];\nvar GridTemp = msg.payload[9*i+4];\nvar GridReportTime = msg.payload[9*i+5];\nvar InverterIDB = msg.payload[9*i+6];\nvar CurrentPowerB = msg.payload[9*i+7];\nvar GridVoltageB = msg.payload[9*i+8];\nnewMsg = {payload: ([InverterIDA.substr(0,12),CurrentPowerA.slice(0,-2),GridVoltageA.slice(0,-2),CurrentPowerB.slice(0,-2),GridVoltageB.slice(0,-2),GridFreq.slice(0,-3),GridTemp.slice(0,-8)])}\nnode.send(newMsg);\n}","outputs":1,"noerr":0,"x":960,"y":440,"wires":[["7d148fd5.6837a8","752a8421.e09cf4"]]},{"id":"7d148fd5.6837a8","type":"debug","z":"d243b84a.4ac438","name":"Output APS Array","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1310,"y":440,"wires":[]},{"id":"752a8421.e09cf4","type":"function","z":"d243b84a.4ac438","name":"Solar Production Inverters to Domoticz","func":"var msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\nvar msg4 = {};\nvar msg5 = {};\nvar msg6 = {};\n\nswitch (msg.payload[0]) {\n\n case \"404000191265\": //Inverter 1\n msg1.payload = {\"command\":\"udevice\",\"idx\":1001,\"nvalue\":0,\"svalue\":(msg.payload[1] + \";0\")}; //Current Power A\n msg2.payload = {\"command\":\"udevice\",\"idx\":1002,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //Voltage A\n msg3.payload = {\"command\":\"udevice\",\"idx\":1003,\"nvalue\":0,\"svalue\":(msg.payload[3] + \";0\")}; //Current Power B\n msg4.payload = {\"command\":\"udevice\",\"idx\":1004,\"nvalue\":0,\"svalue\":(msg.payload[4])}; //Voltage B\n msg5.payload = {\"command\":\"udevice\",\"idx\":1005,\"nvalue\":0,\"svalue\":(msg.payload[5])}; //Frequency\n msg6.payload = {\"command\":\"udevice\",\"idx\":1006,\"nvalue\":0,\"svalue\":(msg.payload[6])}; //Temperature\n break;\n\n case \"404000191123\": //Inverter 2\n msg1.payload = {\"command\":\"udevice\",\"idx\":2001,\"nvalue\":0,\"svalue\":(msg.payload[1] + \";0\")}; //Current Power A\n msg2.payload = {\"command\":\"udevice\",\"idx\":2002,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //Voltage A\n msg3.payload = {\"command\":\"udevice\",\"idx\":2003,\"nvalue\":0,\"svalue\":(msg.payload[3] + \";0\")}; //Current Power B\n msg4.payload = {\"command\":\"udevice\",\"idx\":2004,\"nvalue\":0,\"svalue\":(msg.payload[4])}; //Voltage B\n msg5.payload = {\"command\":\"udevice\",\"idx\":2005,\"nvalue\":0,\"svalue\":(msg.payload[5])}; //Frequency\n msg6.payload = {\"command\":\"udevice\",\"idx\":2006,\"nvalue\":0,\"svalue\":(msg.payload[6])}; //Temperature\n break;\n\n case \"404000193004\": //Inverter 3\n msg1.payload = {\"command\":\"udevice\",\"idx\":3001,\"nvalue\":0,\"svalue\":(msg.payload[1] + \";0\")}; //Current Power A\n msg2.payload = {\"command\":\"udevice\",\"idx\":3002,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //Voltage A\n msg3.payload = {\"command\":\"udevice\",\"idx\":3003,\"nvalue\":0,\"svalue\":(msg.payload[3] + \";0\")}; //Current Power B\n msg4.payload = {\"command\":\"udevice\",\"idx\":3004,\"nvalue\":0,\"svalue\":(msg.payload[4])}; //Voltage B\n msg5.payload = {\"command\":\"udevice\",\"idx\":3005,\"nvalue\":0,\"svalue\":(msg.payload[5])}; //Frequency\n msg6.payload = {\"command\":\"udevice\",\"idx\":3006,\"nvalue\":0,\"svalue\":(msg.payload[6])}; //Temperature\n break;\n\n case \"404000191257\": //Inverter 4\n msg1.payload = {\"command\":\"udevice\",\"idx\":4001,\"nvalue\":0,\"svalue\":(msg.payload[1] + \";0\")}; //Current Power A\n msg2.payload = {\"command\":\"udevice\",\"idx\":4002,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //Voltage A\n msg3.payload = {\"command\":\"udevice\",\"idx\":4003,\"nvalue\":0,\"svalue\":(msg.payload[3] + \";0\")}; //Current Power B\n msg4.payload = {\"command\":\"udevice\",\"idx\":4004,\"nvalue\":0,\"svalue\":(msg.payload[4])}; //Voltage B\n msg5.payload = {\"command\":\"udevice\",\"idx\":4005,\"nvalue\":0,\"svalue\":(msg.payload[5])}; //Frequency\n msg6.payload = {\"command\":\"udevice\",\"idx\":4006,\"nvalue\":0,\"svalue\":(msg.payload[6])}; //Temperature\n break;\n\n case \"404000192992\": //Inverter 5\n msg1.payload = {\"command\":\"udevice\",\"idx\":5001,\"nvalue\":0,\"svalue\":(msg.payload[1] + \";0\")}; //Current Power A\n msg2.payload = {\"command\":\"udevice\",\"idx\":5002,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //Voltage A\n msg3.payload = {\"command\":\"udevice\",\"idx\":5003,\"nvalue\":0,\"svalue\":(msg.payload[3] + \";0\")}; //Current Power B\n msg4.payload = {\"command\":\"udevice\",\"idx\":5004,\"nvalue\":0,\"svalue\":(msg.payload[4])}; //Voltage B\n msg5.payload = {\"command\":\"udevice\",\"idx\":5005,\"nvalue\":0,\"svalue\":(msg.payload[5])}; //Frequency\n msg6.payload = {\"command\":\"udevice\",\"idx\":5006,\"nvalue\":0,\"svalue\":(msg.payload[6])}; //Temperature\n break;\n\n case \"404000191779\": //Inverter 6\n msg1.payload = {\"command\":\"udevice\",\"idx\":6001,\"nvalue\":0,\"svalue\":(msg.payload[1] + \";0\")}; //Current Power A\n msg2.payload = {\"command\":\"udevice\",\"idx\":6002,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //Voltage A\n msg3.payload = {\"command\":\"udevice\",\"idx\":6003,\"nvalue\":0,\"svalue\":(msg.payload[3] + \";0\")}; //Current Power B\n msg4.payload = {\"command\":\"udevice\",\"idx\":6004,\"nvalue\":0,\"svalue\":(msg.payload[4])}; //Voltage B\n msg5.payload = {\"command\":\"udevice\",\"idx\":6005,\"nvalue\":0,\"svalue\":(msg.payload[5])}; //Frequency\n msg6.payload = {\"command\":\"udevice\",\"idx\":6006,\"nvalue\":0,\"svalue\":(msg.payload[6])}; //Temperature\n break;\n\n}\nreturn [[msg1,msg2,msg3,msg4,msg5,msg6]];","outputs":1,"noerr":0,"x":1020,"y":500,"wires":[["5bea947.a4ba1ec"]]},{"id":"5bea947.a4ba1ec","type":"debug","z":"d243b84a.4ac438","name":"Domoticz In","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1310,"y":500,"wires":[]},{"id":"a1776ce7.3be728","type":"http request","z":"d243b84a.4ac438","name":"HTTP AP Systems Overview Request","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.2.88/index.php/home","tls":"","proxy":"","x":420,"y":280,"wires":[["f9cd660b.5528c","9da26ffb.4f20e"]]},{"id":"f9cd660b.5528c","type":"html","z":"d243b84a.4ac438","name":"Scrape overview","property":"payload","outproperty":"payload","tag":"td","ret":"html","as":"single","x":730,"y":260,"wires":[["f3c1c3d6.06c7b"]]},{"id":"4f709cae.43ea9c","type":"debug","z":"d243b84a.4ac438","name":"Output Overview Array","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1270,"y":260,"wires":[]},{"id":"d1c96d07.95888","type":"time-switch","z":"d243b84a.4ac438","name":"Day Time switch","lat":"52.179281","lon":"5.606528","startTime":"sunrise","endTime":"sunset","startOffset":"-30","endOffset":"+30","x":350,"y":360,"wires":[["63bcbc31.eb708c","a1776ce7.3be728"],[]]},{"id":"f3c1c3d6.06c7b","type":"function","z":"d243b84a.4ac438","name":"Create Overview Array","func":"var LifeTimeGen = msg.payload[1];\nvar LastSystemPower = msg.payload[2];\nvar CurDayGen = msg.payload[3];\nnewMsg = {payload: ([LifeTimeGen.slice(0,-4),LastSystemPower.slice(0,-2),CurDayGen.slice(0,-4)])};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":970,"y":260,"wires":[["364dfbb1.e2d524","4f709cae.43ea9c"]]},{"id":"9da26ffb.4f20e","type":"html","z":"d243b84a.4ac438","name":"Scrape environment","property":"payload","outproperty":"payload","tag":"center","ret":"html","as":"single","x":740,"y":300,"wires":[["dadfb540.a207a"]]},{"id":"fed6502.196f5b","type":"debug","z":"d243b84a.4ac438","name":"Output Environmental Array","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1260,"y":300,"wires":[]},{"id":"364dfbb1.e2d524","type":"function","z":"d243b84a.4ac438","name":"Solar Overview to Domoticz","func":"var msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\n\nmsg1.payload = {\"command\":\"udevice\",\"idx\":7001,\"nvalue\":0,\"svalue\":(msg.payload[0])}; //Lifetime generation\nmsg2.payload = {\"command\":\"udevice\",\"idx\":7002,\"nvalue\":0,\"svalue\":(msg.payload[1] + \";0\")}; //Last System Power\nmsg3.payload = {\"command\":\"udevice\",\"idx\":7003,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //Generation of Current Day\n\nreturn [[msg1,msg2,msg3]];","outputs":1,"noerr":0,"x":980,"y":200,"wires":[["d97e6cb5.c7c25"]]},{"id":"d97e6cb5.c7c25","type":"debug","z":"d243b84a.4ac438","name":"Domoticz In","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1310,"y":160,"wires":[]},{"id":"8321d666.fac028","type":"function","z":"d243b84a.4ac438","name":"Solar Environmental to Domoticz","func":"var msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\n\nmsg1.payload = {\"command\":\"udevice\",\"idx\":8001,\"nvalue\":0,\"svalue\":parseFloat(msg.payload[0] * 3,78541178).toFixed(1)}; //CO2 Car (L)\nmsg2.payload = {\"command\":\"udevice\",\"idx\":8002,\"nvalue\":0,\"svalue\":(msg.payload[1])}; //CO2 Tree\nmsg3.payload = {\"command\":\"udevice\",\"idx\":8003,\"nvalue\":0,\"svalue\":(msg.payload[2])}; //CO2 Factory (Kg)\n\nreturn [[msg1,msg2,msg3]];","outputs":1,"noerr":0,"x":1000,"y":360,"wires":[["93b122ab.4b1ae"]]},{"id":"dadfb540.a207a","type":"function","z":"d243b84a.4ac438","name":"Create Environmental Array","func":"var CO2Car = msg.payload[1];\nvar CO2Tree = msg.payload[2];\nvar CO2Factory = msg.payload[3];\nnewMsg = {payload: ([CO2Car.slice(0,-12),CO2Tree.slice(0,-10),CO2Factory.slice(0,-7)])};\nreturn newMsg;\n","outputs":1,"noerr":0,"x":980,"y":300,"wires":[["8321d666.fac028","fed6502.196f5b"]]},{"id":"93b122ab.4b1ae","type":"debug","z":"d243b84a.4ac438","name":"Domoticz In","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1290,"y":400,"wires":[]},{"id":"b0d7a44d.92a2b8","type":"comment","z":"d243b84a.4ac438","name":"Poll Home Page","info":"This node polls http://<ip address>/index.php/home","x":340,"y":220,"wires":[]},{"id":"bce11b22.56815","type":"comment","z":"d243b84a.4ac438","name":"Poll Inverter Page","info":"This node polls http://<ip address>/index.php/realtimedata","x":350,"y":500,"wires":[]}]
However, if you copy this complete flow, you have to replace all your IDX numbers again.
1. Replace the IDX with your IDX in "Solar Environmental to Domoticz".
2. I have converted the US Gallons to L, and rounded it to 1 digit after . Please check that in the debug node, connected to the previous node.
3. If this one looks error free, and similar to the others, connect the output of the node to Domoticz In.
If you are looking for some nice icons (You can create these yourself, see Wiki) this is a nice link:
At the end, it is possible to delete all those green debug nodes. That cleans-up the flow a little, but I suggest you deactivate the, as they might be needed in case of changes or problems.
Looking forward for feedback.
Regards and a nice weekend.