Spark Core and Node-RED integration

@krvarma, sorry for the delay. I updated to the 0.0.8 npm and was trying to connect to the local cloud. Unfortunately, I’m not sure how the node works. Can you give me an example of how I can send a command from the node to the Spark? I’ve got my local cloud server running at http://myserver.local:8080, I’ve also obtained my spark ID as well as the access token. How can I now send a signal to the core via Node-red?

@krvarma, it works! Awesome! Thank you so much.

1 Like

@sriram155, great!, it is good to know it is working!

1 Like

@krvarma, it worked and then it stopped :frowning:

@krvarma here are the snapshots of my config. Let me know if I went wrong anywhere.

@sriram155, you have a Spark Core IN node calls the digitalWrite every 5 seconds, but the parameter is blank. So the digitalwrite will not work. It should return some negative value. Also the OUT node always turns on the LED on the second core. Both output to the debug console.

Can you paste what you are seeing on your debug console?

@krvarma, I did put in D7, HIGH in the input node. It worked for me once. However I’m not sure which combo I had. The debug showed me 1 on a loop mode. Now I’m unable to see anything in the debug console. When I deploy, nothing shows up in debug.

ok, can you do one more thing, instead of msg.payload can you output complete object to the debug console and see what is coming?

@krvarma, the complete object is empty too. I’m suspecting that the node is not connecting to the spark.

@krvarma, I deleted the nodes and used only Input node and debug and it worked! Is there a way to get this work with a VPN?

@sriram155, thanks for pointing this issue, you are awesome!, The issue is, when multiple nodes are added then only one will work. In your case I suspect the the OUT node is working. But it is not receiving any input the actual call to the core is not made. I fixed this issue, I will publish after some testing in couple of days.

Regarding the VPN, if you can access the within VPN then you can use the node. Did you try call Spark Cloud using CURL?

hI have you published the fix for this issue yet? I found that the input was working but when I added a spark output function call, it stopped everything from working, the input timers stopped firing. the debug stopped working also, but i could still use an injector as an input to the spark output function and it worked, but obviously its not good that debug and the input timers stopped working. thanks for the useful node-red modules!

@mtnbrit, I haven’t published the fix. I am doing some testing and in couple of days publish it.

@sriram155, @mtnbrit, the multiple Core issue is fixed and updated, version 0.0.9. Can you try now?

1 Like

i seem to still have the same problem of only one node working, how can I check which version is installed and running please?

npm install node-red-contrib-sparkcore should install the latest one.

Hi, I have a fresh install of node-red 0.10.1 and install sparkcore node via npm as suggested. Everything seems to work as expected EXCEPT when I add the device ID and my spark access token to the spark configuration panel it never is saved. So I always get, “No Spark Core Device ID Set” “No Spark Core access token set” errors. I am able, however, to save a function name in the panel.

Thanks for any help!

@szac, these errors are shown when the Node does not have code id and access token, it should not come once you set it correctly.

Which platform you are working, Raspberry Pi, Linux, etc… also can you make sure your are using the latest version, you can get it using NPM

npm install node-red-contrib-sparkcore

Thanks @krvarma. The panel does not save the core id and device id when I add it. it’s saves the payload field however. In other words, I am adding both the core ID and the spark access token, but Node-Red does not save it. I’m using it on Linux.

Node Red - 0.10.1
Nodejs 0.10.33
NPM 1.4.xx (I think)
Linux Ubuntu Precise

Note that I successfully used your spark core node in the past on a raspberry pi and a different machine running linux. The difference was that I was running the previous version of Node-Red.

Thanks!
Joe

@szac, I am working on Windows and Raspberry Pi and working fine, let me check with Ubuntu and get back to you.

1 Like