I was able to install the NodeRed snap on my CtrlX promoter demo by downloading the snap file from Snapcraft. I was then able to add the CtrlX Datalayer node that is on Github to my install of Node Red. I've working on building a dashboard to go with my demo so I have web HMI / Dashboard for controlling the demo. I can read values from the CtrlX core including PLC variables and drive status but am having trouble figuring out how command/control/write to the core. Does anyone have a sample Node Red Flow or JSON file they could share that I could take a look at?
Solved! Go to Solution.
First of all please have a look to the post "How-to use the REST API" for more information. Please also check the notes at the bottom of the post.
For further questions please get in touch with the Sales Technical Support STS.
As a suplement to the official "how-to" mentioned by CodeShepherd, see attached. Some write (PUSH, PUT) examples are included.
The REST API info was sort of helpful. The only real helpful thing there was to use the Developer Tools while using the CtrlX web interface to see how pushing buttons send commands to the CtrlX Core. My Bosch Rexroth local support sent me some screenshots of using HTTP requests (which use the REST API directly) to request data and command the drive. However, none of that worked. I did end up adding the CtrlX Node to the Node Red pallete in my implementation available on Github. Using the CtrlX node I was able to get all communication working. I believe this node sets up some of the base functions needed to communicate to the core with the REST API. It wasn't easy but I learned a lot along the way. The only issue I'm still having is with regards to the output of the CtrlX node. The help for the node shown in Node Red states that the node can be configured to return the data as a string, attempt to parse it as a JSON string or leave it as a binary buffer. However, the node does not show anyway to configure the output. Has anyone been able to configure the output of the CtrlX Node?
Sorry for the confusion. Configuration of the output format is a planned feature, but not yet part of this releases. Looks like the documentation was faster than the implementation.
For the moment, the data is always returned as a json object. For simple data types this consists of type and value. For complex types, the data object is returned directly as json.
For the planned feature we will make it configurable to return JSON (with type info), value only (as string), binary format (with type info, probably encoded as flatbuffer).
I'd like to share my Node Red project for CtrlX. I created two dashboards that allow you to jog a real axis and two virtual axes. I also have a dashboard for position control of those axes. You'll also see a dashboard for controlling a Balluff IO-Link master and the IO-Link devices attached to it in my JSON file. I plan to do more with Node Red and CtrlX development but thought this would be a good point to share so others do not spend as much time as I did getting this all working. I went into this with minimal knowledge of Node Red and learned a ton along the way. The internet is a helpful place and there's lots of good info out there on Node Red. I should note that you'll need to install the node-red-contrib-ctrlx-automation node, the node-red-contrib-ui-led node, and the node-red-contrib-ui-level to your Node Red palette. Please install those nodes before importing the JSON file contained below. I should also note that to change the background image of the dashboard you'll need to copy and paste the provided settings.js file and the pic.jpg file to your .node-red file. For me that folder was located in C:\Users\<your user name>\.node-red. Please reach out with any questions.
Thank you for your post.
I have tried to install the node-red-contrib-ctrlx-automation node from the pallette on my CtrlX Demo unit, but it fails, I also cannot update any of the existing nodes, everytime, I get the below error log. I am running NodeRed 1.0.3.
Any help would be appreciated.
2021-03-04T05:19:50.550Z Install : node-red-dashboard 2.28.1
2021-03-04T05:20:13.816Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production email@example.com
2021-03-04T05:20:17.929Z [err] npm
2021-03-04T05:20:17.931Z [err] ERR! code EAI_AGAIN
2021-03-04T05:20:17.931Z [err] npm
2021-03-04T05:20:17.931Z [err] ERR! errno EAI_AGAIN
2021-03-04T05:20:17.935Z [err] npm
2021-03-04T05:20:17.936Z [err] ERR! request to https://registry.npmjs.org/node-red-dashboard failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
2021-03-04T05:20:17.959Z [err] npm ERR! A complete log of this run can be found in:
2021-03-04T05:20:17.959Z [err] npm ERR! /root/snap/rexroth-node-red/x1/.npm/_logs/2021-03-04T05_20_17_942Z-debug.log
Please beware that your ctrlX CORE has to be connected to an open internet to be able to download extensions or updates inside of Node-Red.
The notebook that I was working form had open internet access, but I am not sure if I need to connect the CtrlX directly to the router? If so, do I need to change port XF10 to DHCP enabled?
Yes the ctrlX CORE needs to be connected to the router. It doesn't have to be DHCP enabled, you could have a static IP and set the Gateway = IP address of your router which provides internet access.
Your engineering PC as well as the ctrlX CORE (in standard XF10) have to be connected to the internet. The IP can be static but mus fit to your local subnet of your router or like descriped above a gateway could be used.
So I had the background image working when I had Node Red running on my computer and had it talking to the datalayer to control the CtrlX Core. I had to use a UI-Template node and then had a setting file and the image I used in a specific folder on my computer. Now we have the Node Red app that we can install on the CtrlX Core I've lost the ability to drop the settings and image file onto the CtrlX Core in the correct folder. I used to be able to SFTP into the CtrlX Core but that functionality seems to be locked down now.
If you run Node Red on your computer instead of the CtrlX Core have a look at the below link on how to setup the background picture.
I'll let you know if I figure out how to add a background image to the CtrlX Core based Node Red application.