Controlling gopro camera

Looking around the web it surprises me that there are no search results showing any succes on controlling a gopro camera with node-red.
Does anyone have experience with this?

And is it possible to use this on node-red?
https://www.npmjs.com/package/gopro-js

Thanks

I am not sure I am the right person to be advising on this :sweat_smile: But I did something similar with a nodejs dependency and it worked great. I added the dependency to the settings.js file, then used a function node to test small snippets of the example code to get basic functions and then expanded this to provide the functions I wanted. Once this is working it would be possible to create a node for the community

I’m also very interested in learning how to use another node.js modules in node red but have no clue, will be great if someone someday makes a bit of tutorial.

This will drastically increase the capabilities of node red for those who have not a deep knowledge.

Regards

The main route to using any node module in Node-RED is for someone to wrap the module in a node-red node. That requires some time and effort to do right.

It is also possible to load additional node modules and access them from within a Function node. This is described, slightly obliquely here: https://nodered.org/docs/writing-functions#global-context

You do it by loading the module in your settings.js file, and adding it to the functionGlobalContext setting. The Function node can then access the module via global context. The docs have an example of doing that with the built-in os module.

As an example of the sort of function Nick describes, here is one that uses the suncalc library to give sunrise and sunset times. The settings.js file contains suncalc:require('suncalc') in the functionGlobalContext setting. In this case the necessary library is already loaded, but in general this will not be the case.

[{“id”:“5cde35.f4ac39cc”,“type”:“function”,“z”:“bcb38183.51814”,“name”:“sunrise/set”,“func”:“var sunCalc = global.get(‘suncalc’);\nvar times = sunCalc.getTimes(new Date(), 38.8975,-77.0365);\nvar rise = times.sunrise.toTimeString().substr(0,5);\nvar set = times.sunset.toTimeString().substr(0,5);\nmsg.payload = rise + ’ / ’ + set;\nreturn msg;”,“outputs”:1,“noerr”:0,“x”:300,“y”:60,“wires”:[[“f1e49d3e.e12018”]]}]

While we are on the subject could I ask a question again (I have posted this before). I have used the approach to add a dependency to the settings.js and then created a function node that works fine. When I try to create a node with this functionality node red crashes. The logic is that a function node in a flow must execute this differently. Is there anywhere I could read to understand what these differences may be to fix the problem. Thanks

While we are on the subject

well, no, this topic is about the gopro camera module and how to use it. We can continue with your questions in your other topic - Custom Node code