Code Monkey home page Code Monkey logo

Comments (6)

dirkjanfaber avatar dirkjanfaber commented on August 10, 2024

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.

from node-red-contrib-eskomsepush.

Johan-Bo avatar Johan-Bo commented on August 10, 2024

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.

from node-red-contrib-eskomsepush.

dirkjanfaber avatar dirkjanfaber commented on August 10, 2024

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.

from node-red-contrib-eskomsepush.

Johan-Bo avatar Johan-Bo commented on August 10, 2024

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

from node-red-contrib-eskomsepush.

dirkjanfaber avatar dirkjanfaber commented on August 10, 2024

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.

from node-red-contrib-eskomsepush.

Johan-Bo avatar Johan-Bo commented on August 10, 2024

Thank you very much.

Will definitely have a look.

from node-red-contrib-eskomsepush.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.