MauroRiboniMX_0-1697096904551.gif

Systematic Reboot with REST API and Node-RED example

MauroRiboniMX
Contributor
Disclaimer

There are many ways to achieve this result. The REST API end-point can be called inside an app or from outside. Someone may want to create an app that is able to manage this task. In this guide we are going to see how this task can be achieved easily with the web-interface and Node-RED. 

Prerequisites
  • Being able to use REST API with Node-RED
  • Basic REST API comprension
Equipment needed
  • ctrlX CORE with 2.02 or higher.
  • Node-RED installed for the last part.
  • Internet access for the palette.
Test the API

To test the reboot API is quite easy! We need to go to the API page, the link is already on the top-right:

REST API linkREST API link

Then we need to select the right API category which is "System-API":

System APISystem API

What we need to do is to create a "reboot task" but first don't forget to authorize using the Authorize button! Authorize ButtonAuthorize ButtonWe're almost done! We have to find the Task section (1) then move to "Create a new task" (2) and select reboot then click on "Try it out" (3).

Try a taskTry a task

Clicking on "Execute" the system will send a post containing the reboot request!

REST API exampleREST API example

Now the system is rebooting!

Automatize with Node-RED 

Here is the final code. Really easy, any time that the "cron-plus" or the "inject" nodes emits a signal the device is rebooted.

Node-Red CodeNode-Red Code

To implement this the "cron-plus" node has been used (just because personally I find it really easy and configurable). To have it we have to install with the palette this extension:

Node-RED Palette CronNode-RED Palette Cron

Once we have it the configuration is really easy, just add the node and configure the schedule!

Configure the scheduleConfigure the schedule

I personally use the "Easy Expression Builder" because I am lazy. Anyway, it is really easy to configure and adjust.

Easy ConfigurationEasy Configuration

Easy Configuration ExampleEasy Configuration Example

Have Fun 😎

MauroRiboniMX
MauroRiboniMX
Hello, I am Mauro a ctrlX DEVELOPR at night and a̶n̶ A̶p̶p̶l̶i̶c̶a̶t̶i̶o̶n̶ E̶n̶g̶i̶n̶e̶e̶r̶ Product Manager during the day 😎 . Ask me anything about ctrlX AUTOMATION but my best topics are IoT, AI, SDK and Communication!
1 Comment
Must Read
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist