How to sniff http request

I use the node node-red-contrib-sun-position to have data of sun and moon position but I would like not use this node but an http request ....

How can I sniff the http request sent by the node node-red-contrib-sun-position?

I don't think it does send a request. I think it just calculates it using suncalc3 - npm

Here is an example of how to use suncalc3 in a function node. You add the module in the function nodes setup tab.

[{"id":"c15cbedc83d28648","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{}","payloadType":"json","x":235.9541015625,"y":4859.02734375,"wires":[["3c3dfdd83b03e76b"]]},{"id":"3c3dfdd83b03e76b","type":"function","z":"d1395164b4eec73e","name":"function 157","func":"const lat = 50.8015;\nconst lon = 0.3170;\nconst dateValue = new Date();\nmsg.payload.moon = suncalc.getMoonPosition(dateValue, lat, lon)\nmsg.payload.sun = suncalc.getPosition(dateValue, lat, lon)\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"suncalc","module":"suncalc3"}],"x":425.9541015625,"y":4859.02734375,"wires":[["7229b6af4a0552b4"]]},{"id":"7229b6af4a0552b4","type":"debug","z":"d1395164b4eec73e","name":"debug 429","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":450,"y":4780,"wires":[]}]

Read here to set up functionExternalModules in settings.js Writing Functions : Node-RED

p.s could you also change the title to how to get sun and moon positions or similar, as the title does not help others search for what this topic is about.

@Colin
@E1cid

Thank you ....

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.