Any way to reset a flow from another flow?

2,250 views
Skip to first unread message

Toshi Bass

unread,
Dec 8, 2015, 4:55:21 AM12/8/15
to Node-RED
I have 5 sheets with nodes on each sheet that connect to a blink server, so each of the 5 sheet is associated with a separate blynk server.

The problem I have is that occasional/randomly a blynk server will stop working, there is no error in the node-red log and logging off and back on in the blynk iphone app does not restart the server that's not working, the only way for me to restart that server is to do a node-red deploy, then the 5 servers reconnect and the iphone app works fine, obviously this is a pain especially if I am away from my computer when it happens.  

Whilst I understand that this is a blynk issue and needs to be fixed by them, this is a long running issue that has had many attempts to fix it so, I was just wondering if there is a way to write a function or something to automatically redeploy a flow on 1 or more of my sheets when node-red detects that problem, or perhaps manually when say a button on another flow is pressed?

Thanks for any help

Toshi

Nicholas O'Leary

unread,
Dec 8, 2015, 4:15:11 PM12/8/15
to Node-RED Mailing LIst
Hi,

at the moment the runtime is not aware of the different tabs, so there is no convenient way to restart just a particular tab.

As of the latest release, if you do an HTTP Post to the /flows admin end-point with the Node-RED-Deployment-Type HTTP header set to 'reload' it will cause the runtime to reload its flow from storage and restart everything.

The next release will being a finer grained api for working with flows at the individual tab level.

Hope that helps,

Nick

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicholas O'Leary

unread,
Dec 8, 2015, 4:15:40 PM12/8/15
to Node-RED Mailing LIst
Meant to include a link to the relevant admin api docs - http://nodered.org/docs/api/admin/methods/post/flows/

Toshi Bass

unread,
Dec 8, 2015, 6:43:42 PM12/8/15
to Node-RED
Ok thanks I will check this out in a couple of days when I get back from vacation

Toshi 

Eckehard Fiedler

unread,
Nov 13, 2017, 2:22:08 AM11/13/17
to Node-RED
Auto-restart node red:

had a similar issue with a serial input node "hanging" every some hours. I have used a watchdog timer to redeploy the flow after some time of inactivity (node-red-contrib-watchdog). You need a function node and a http-request:

function node:

msg.headers = {
    "Node-RED-Deployment-Type":"reload"
}
return msg;

http-request:

Method: POST


Here ist a flow to test the function:

[{"id":"3b54a219.b12d4e","type":"inject","z":"1c0f9a92.981245","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":145,"y":106,"wires":[["85a767e0.79acf8"]]},{"id":"85a767e0.79acf8","type":"function","z":"1c0f9a92.981245","name":"Reload MSG","func":"msg.headers = {\n    \"Node-RED-Deployment-Type\":\"reload\"\n}\nreturn msg;","outputs":1,"noerr":0,"x":305,"y":106,"wires":[["2c0ba43f.97d61c"]]},{"id":"2c0ba43f.97d61c","type":"http request","z":"1c0f9a92.981245","name":"http: Localhost","method":"POST","ret":"txt","url":"http://localhost:1880/flows","tls":"","x":483,"y":106,"wires":[["4e147d27.754094"]]},{"id":"4e147d27.754094","type":"debug","z":"1c0f9a92.981245","name":"","active":true,"console":"false","complete":"payload","x":658,"y":106,"wires":[]}]

Best regards,
Eckehard
Reply all
Reply to author
Forward
0 new messages