There's an existing topic around this BTW.
Another option is to do this automatically w/o Node-RED if you're familiar with Arduino. There seems to be plenty of tutorials:
- http://www.whatimade.today/make-an-automatic-router-re-starter-for-3-with-an-esp8266-01-and-single-relay/
- https://www.instructables.com/id/ESP8266-Automatic-Router-Restart/
- https://www.programmingelectronics.com/esp8266-auto-router-resetter-student-project/
I was planning to go this route with our cottage LTE router but a firmware upgrade and an UPS solved the problem before I got to it. Power distribution there is spotty and very often the router did not connect after a power outage. Only power cycling fixed the issue.