I'm looking for help with my project

So are your OK now?

  1. is what cronplus is sending what you need to send into the gpio node?

To know what the gpio node needs, you need to read the info tab of the node. Once you know that, you could attach a debug node to the output of the cronplus node to see what it is sending.

if they are the same then you are all set, ifthey are different you will need some logic to change the value coming from the cronplus node so you can send it to the gpoi node.

Just try this flow, worked "out of the box"
Turns on the LED when sun is down. Change coordinates to your location. Could it be simpler?

Also add SunCalc to your settings.js

functionGlobalContext: {
    // octalbonescript:require('octalbonescript'),
    // jfive:require("johnny-five"),
    // j5board:require("johnny-five").Board({repl:false})

[{"id":"62deabc1.443024","type":"cronplus","z":"60f50465.20a53c","name":"","outputField":"payload","timeZone":"","options":[],"x":590,"y":2220,"wires":[["a4ba9e6e.0133b","176e84d.3522d7b"]]},{"id":"4091a3f2.f02f9c","type":"inject","z":"60f50465.20a53c","name":"status-all","topic":"","payload":"{\"command\":\"status-all\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":2250,"wires":[["62deabc1.443024"]]},{"id":"a4ba9e6e.0133b","type":"debug","z":"60f50465.20a53c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":760,"y":2220,"wires":[]},{"id":"176e84d.3522d7b","type":"rpi-gpio out","z":"60f50465.20a53c","name":"","pin":"36","set":false,"level":"1","freq":"","out":"out","x":820,"y":2300,"wires":[]},{"id":"d2c7fadc.0834b8","type":"inject","z":"60f50465.20a53c","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":820,"y":2380,"wires":[["176e84d.3522d7b"]]},{"id":"9cbb07e0.456018","type":"inject","z":"60f50465.20a53c","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":820,"y":2420,"wires":[["176e84d.3522d7b"]]},{"id":"d3f60b7e.c709b8","type":"function","z":"60f50465.20a53c","name":"SunRiseSet","func":"var SunCalc = global.get('SunCalc');\nvar loc = msg.payload.split(';');\nvar times = SunCalc.getTimes(new Date(), loc[0], loc[1]);\nvar sunriseStr = [times.sunrise.getHours().toString(), times.sunrise.getMinutes().toString()];\nvar sunsetStr = [times.sunset.getHours().toString(), times.sunset.getMinutes().toString()];\n\nfunction updateNodeStatus(txt) {\n    node.status({\n    \ttext : txt\n    });\n}\n\nif (sunsetStr[0].length<2){\n    sunsetStr[0]='0'+sunsetStr[0];\n}\nif (sunsetStr[1].length<2){\n    sunsetStr[1]='0'+sunsetStr[1];\n}\nvar sunset = sunsetStr[0]+':'+sunsetStr[1];\n\nif (sunriseStr[0].length<2){\n    sunriseStr[0]='0'+sunriseStr[0];\n}\nif (sunriseStr[1].length<2){\n    sunriseStr[1]='0'+sunriseStr[1];\n}\nvar sunrise = sunriseStr[0]+':'+sunriseStr[1];\n\nlet info = 'sunUp:'+sunrise+' '+'sunDown:'+sunset;\nupdateNodeStatus(info);\n\nlet srh = times.sunrise.getHours();\nlet srm = times.sunrise.getMinutes();\nlet ssh = times.sunset.getHours();\nlet ssm = times.sunset.getMinutes();\n\nlet expr1 = '*/1 0-'+srh.toString()+' * 8-11 *';\nlet expr2 = '0-'+srm.toString()+'/1 '+(srh+1).toString()+' * * *';\nlet expr3 = '*/1 '+ssh.toString()+'-23'+' * * *';\nlet expr4 = ssm.toString()+'-59/1 '+(ssh-1).toString()+' * * *';\n\nlet expr5 = '*/1 '+(srh+2).toString()+'-'+(ssh-2).toString()+' * * *';\nlet expr6 = '';\nif(srm<59){\n    expr6 = (srm+1).toString()+'-59/1 '+(srh+1).toString()+' * * *';\n}\nelse{\n    expr6 = '0';\n}\nlet expr7 = '';\nif(ssm>0){\n    expr7 = '0-'+(ssm-1).toString()+'/1 '+(ssh-1).toString()+' * * *';\n}\nelse{\n    expr7 = '0';\n}\n\nmsg.payload = [\n    {\n        'command': 'add',\n        'name': 'one',\n        'expression': expr1,\n        'payload': '1',\n        'type': 'num',\n    },\n    {\n        'command': 'add',\n        'name': 'two',\n        'expression': expr2,\n        'payload': '1',\n        'type': 'num',\n    },\n    {\n        'command': 'add',\n        'name': 'three',\n        'expression': expr3,\n        'payload': '1',\n        'type': 'num',\n    },\n    {\n        'command': 'add',\n        'name': 'four',\n        'expression': expr4,\n        'payload': '1',\n        'type': 'num',\n    },\n    {\n        'command': 'add',\n        'name': 'five',\n        'expression': expr5,\n        'payload': '0',\n        'type': 'num',\n   },\n    {\n        'command': 'add',\n        'name': 'six',\n        'expression': expr6,\n        'payload': '0',\n        'type': 'num',\n    },\n    {\n        'command': 'add',\n        'name': 'seven',\n        'expression': expr7,\n        'payload': '0',\n        'type': 'num',\n    }\n]\n\nreturn msg;\n","outputs":"1","noerr":0,"x":600,"y":2420,"wires":[["b0b0c10c.ff517"]]},{"id":"b0b0c10c.ff517","type":"rbe","z":"60f50465.20a53c","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":420,"y":2310,"wires":[["62deabc1.443024"]]},{"id":"d878b71b.d4a0d8","type":"inject","z":"60f50465.20a53c","name":"","topic":"","payload":"59.4200;18.0000","payloadType":"str","repeat":"60","crontab":"","once":true,"onceDelay":"","x":340,"y":2420,"wires":[["d3f60b7e.c709b8"]]},{"id":"23e95def.7c8072","type":"inject","z":"60f50465.20a53c","name":"remove-all","topic":"","payload":"{\"command\":\"remove-all\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":2200,"wires":[["62deabc1.443024"]]}]
1 Like

There is also a contrib node for that

Or node-red-node-suncalc

All roads lead to Rome...many ways to solve a task
Thats the beauty!

The problem is that sometimes you find yourself on a diversion via Outer Mongolia.
Though this is not a problem for any users from Outer Mongolia of course.

1 Like

I don't understand your answer. I can only say that not everyone can do everything and the forum serves to ask for help...

Strange, if you have problems getting things working, as I have understood you have, the best is to get a ready made working project served right on your plate to start playing with. If that is not an excellent service, I do not know what it is. Anyway, I would be grateful if I would get that kind of support myself when needed. If you do not understand this, let me know, we might have some language problems

Which answer don't you understand?

Yes, I do. This is a project I want to end but I can't. If anyone could solve it I'd be grateful... so you understand, at work finished, what I did wrong and how it should be solved the problem.

Are you real??? Try the project I provided to you. Learn from there

I find myself in this situation, where ninth I can connect my gpio to the flow. I'm trying all of them, but I just can't. I understand that for you it is simple, but not knowing the cron plus I can not change it.

I took inspiration to change my flow

Check my code in the function node in the project I provided, this shows how you can change the data type sent from cron+
It is also described in the info tab for the node itself
As example:

    'command': 'add',
    'name': 'seven',
    'expression': expr7,
    'payload': '0',
    'type': 'num',

This will send the correct data type supported by the GPIO node

Should the code be placed inside the msg.payload or inject 1/0?

found the codes!

Please study the complete solution I provided, try to understand how it works, study the code in the function node, try to understand how it works, then ask specific questions about it