SIMPLE way to restart flows within Node-Red

Latest since making use of the Alexa integration, I found that some flows just ain't quite stable working and, unfortunately, need to be restarted regularly. Therefore I´m looking for an easy way, how to restart all and/or certain flows automatically from within Node-Red. I found a documentation (POST /flows : Node-RED), but I´m afraid it´s way over my head to understand what to actually do :roll_eyes:

Now my question is: Is it really that complicated to achieve this or can somebody show an easy example that even Noops like me can understand? :relaxed:

The only way to restart the flows is to make a call to the Admin API. A POST to the /flows endpoint with the reload flag

https://nodered.org/docs/api/admin/methods/post/flows/

(You will need to get a Admin API access token to make the call if the Admin Auth is enabled, which it probably should be.)

Alright, so no easy way... How do I get the access token?

https://nodered.org/docs/api/admin/oauth

Instead of restarting the flows, why not try and resolve (or handle) the problem instead.
Have you looked at the logs to see why it's unstable.

2 Likes

What exactly is it that stops happening? One of the nodes is presumably not doing what it should, which node is it?

@Colin - It´s mainly the Alexa node that stops working after some time and needs a flow restart to re-initialize. But if it´s that complicated to restart a flow I probably go for the more "radical" solution to re-boot the whole HomeAssistant system, which in the end has the same effect (kind of the nuclear option :bomb:)

It is easy to restart nodered from a flow. How to do it depends on your OS. Search the forum and I am sure you will find how to to it.

Is it a known problem with the Alexa node? I don't use it but probably someone here can comment on that.

@Colin - I searched the forum and all posts point to the following documentations: POST /flows : Node-RED and Authentication : Node-RED.

This might be useful if you are running Node-Red as an individual instance, but doesn´t help me running Node-Red as Add-On on my Home Assistance system.

Anyway, I now created an automation that restarts the whole Node-Red application every night and I hope this will help to stabilize the working of my Alexa based flows (by far not the most beautiful solution to this issue I have to admit :frowning: )

Restarting the whole of node red is what I was referring to.

run Node-RED as a service and then make system commands to reinitialize/restart the service.

I think HA run it in a container so presumably you can also restart that some way.

Sure, the container, I say "service" since I'm in the Windows environment. The container option is probably easier to do. The concept is restart your entity which hosts your Node-RED instance. That can be done by system command.

That would be a brute-force method, I would investigate a means to avoid this since it is uncontrolled shutdown. Perhaps advisable to go to the Alexia Node maintainer on GIT and see if anyone else is having similar trouble.

You can catch the alexa node error/s using the catch node, and reinitialise the alexa authorization.
There is a example of how to initialise the authenication in the read me help info.
(this answer assumes you are using one of the alexa remote2 forks)
here's a link to a thread that talks about alexa node issues.

1 Like

@E1cid - Is it this you are talking about?
Alexa Remote2 stops talking - #30 by E1cid

The whole thread has ideas, but I posted a updated version of that later in the thread. here

2 Likes

I only understand superficially what that flow does but as I didn´t had to enter my Credit Card i trust in you :laughing: Thanks one more time @E1cid for helping me out and on the same sight showing me how little I still know about Node Red

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