dirkjanfaber / node-red-contrib-eskomsepush

Node-RED node for the EskomsePush API
MIT License
7 stars 2 forks source link

EskomSePush integration with inverter on/off 10 min prior Loadshedding/Grid return #8

Closed Johan-Bo closed 1 year ago

Johan-Bo commented 1 year ago

Hi Dirkjanfaber

Can you please help me. I'm trying to integrate with your EskomsePush by using your second output. How and what do I use to get the start and end time of the current load-shedding as well as the time for the next expected load-shedding. I want to use this to switch off the inverter before load-shedding starts (10min prior) and reconnect the inverter after 10min once grid has returned. I'm experiencing huge surges and want to avoid them before load-shedding happens and after grid returned. The Eskomsepush node is up and running and is showing the current stage and time in my area just need to know how to get those info as mentioned above.

Kind Regards, J

dirkjanfaber commented 1 year ago

I think you can do that by connecting the following flow to the first output.

[{"id":"ca967a45ba37a9e7","type":"debug","z":"eaee9d3c1cc45b6f","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":220,"wires":[]},{"id":"8a7d712fa0f6be49","type":"function","z":"eaee9d3c1cc45b6f","name":"Switch inverter","func":"let d = new Date()\n\nif ((msg.calc.next.start - d) <= 600000) {\n    node.warn(\"Switch off\")\n    return { payload : 0 }\n}\n\nif ((d - msg.calc.end) > 600000) {\n    node.warn(\"switch on\")\n    return { payload: 1 }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":220,"wires":[["ca967a45ba37a9e7"]]}]

You can import this via the ctrl-i and pasting it.

Johan-Bo commented 1 year ago

Can you maybe explain what the Node.warn("switch off") & Node.warn("switch on") command does? I was expecting to use a "switch" and maybe a "change" to control the victron ve.bus node to switch it between inverter only etc.

dirkjanfaber commented 1 year ago

A node.warn gives an output on the debug tab. It is not needed, but gives some more helpful info.

If you want to connect it to a VE.bus control node, you can do something like:

[{"id":"d0a631a3bcfeaff0","type":"victron-output-vebus","z":"445e5751bfe59577","service":"com.victronenergy.vebus/276","path":"/PvInverter/Disable","serviceObj":{"service":"com.victronenergy.vebus/276","name":"MultiPlus-II 48/3000/35-32"},"pathObj":{"path":"/PvInverter/Disable","type":"enum","name":"Disable PV inverter","enum":{"0":"No","1":"Yes"},"writable":true},"initial":"","name":"","onlyChanges":false,"x":560,"y":340,"wires":[]},{"id":"8a7d712fa0f6be49","type":"function","z":"445e5751bfe59577","name":"Switch inverter","func":"let d = new Date()\n\nif ((msg.calc.next.start - d) <= 600000) {\n    // disable inverter\n    return { payload : 1 }\n}\n\nif ((d - msg.calc.end) > 600000) {\n    // enable inverter\n    return { payload: 0 }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":240,"y":340,"wires":[["d0a631a3bcfeaff0"]]}]

The VE.Bus inverter accepts a number as input, so no need for a switch of change node.

Johan-Bo commented 1 year ago

Hi Dirkjanfaber

Excellent thank you so much for this will keep you posted if I struggle with anything else. Took my the whole day to try and figure something out on NodeRed where it took you a few minutes truly a wizard. How and where did you learn all of this? Is there a website or something which I can study to get a better understanding of NodeRed etc.

Kind Regards, J

dirkjanfaber commented 1 year ago

You are welcome. I've learned it by using and playing with Node-RED for a few years. And I have a computer science background, which also helps. The cookbook on https://nodered.org/docs/ is quite helpful. And on the node-red-contrib-victron wiki I've put links to a webinar about Node-RED and Victron. And there are some example flows there too. That might also help.

Johan-Bo commented 1 year ago

Thank you very much.

Will definitely have a look.