# Reset modem through node red

**URL:** <https://discourse.nodered.org/t/reset-modem-through-node-red/32778>\
**Category:** General\
**Created:** [12 September 2020 14:22 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778 "2020-09-12T14:22:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![arcegabriel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arcegabriel/32/28485_2.png) [@arcegabriel](https://discourse.nodered.org/u/arcegabriel)\
**Post date:** [12 September 2020 14:22 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/1 "2020-09-12T14:22:40Z")

</div>

I have a TP link TC7650 (cable internet). I noticed frequently all computers have bad latency and the solution is to restart the modem. What I would like to do with node red

1. Regularly check connection latency. I know how to ping but don't find the response time on the output of the ping node
2. If latency is bad I would like node red to use the web interface of the modem and reboot it (click button on web interface)

Is this possible?  
I know I can put a timed switch that turns power off/on to cycle the modem but rather a) do this if/when needed b) do a reboot instead of power off/on

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 September 2020 14:51 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/2 "2020-09-12T14:51:15Z")

</div>

> [@arcegabriel](#):
>
> I know how to ping but don't find the response time on the output of the ping node

[node-red-node-ping](https://flows.nodered.org/node/node-red-node-ping) says it returns the response time in msg.payload.

> [@arcegabriel](#):
>
> If latency is bad I would like node red to use the web interface of the modem and reboot it (click button on web interface)

Googling suggests you can't restart it via a command line i/f (ssh or telnet for example, which is poor) If there is an option in the web interface to do it then you could in theory do the login and so on from node red and navigate to the page and 'press' the button. But since you are asking you obviously don't have experience in that area so it would not be easy. Personally I woujld probably use a Sonoff Basic flashed with Tasmota (or similar) to power cycle it under the control of node-red.

---

<div class="post-metadata">

**Author:** ![arcegabriel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arcegabriel/32/28485_2.png) [@arcegabriel](https://discourse.nodered.org/u/arcegabriel)\
**Post date:** [12 September 2020 15:16 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/3 "2020-09-12T15:16:12Z")

</div>

Colin,  
Thanks, got it on response time. Missed that  
For reboot, understood but it is probably as straightforward as it gets?

1. open 192.168.100.1 and enter password
2. Click reboot icon on next screen. There is no navigation, it is right there  
I've been able to scrub webpages with other scripts but dont know how to click. Also I dont believe there will be ever a change to the web interface (so it will not change). I was hoping I can copy somebody that has done something similar

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 September 2020 17:16 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/4 "2020-09-12T17:16:23Z")

</div>

Some ISP flash modems explicitly to take the reboot from remote option off the table. This happened with my ISP, and even though I own my modem. The solution I did via NR, was to place a smart wifi plug between my modem and its power source. Now I can reboot the modem as and when needed via NR, or even my phone.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 17:16 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/5 "2020-09-12T17:16:44Z")

</div>

Just making sure -have you verified if reboot solves the issue? If it requires a power cycle then it's a waste of time trying to figure out triggering the reboot over the web interface. In any case it might be simpler to use a WiFi controlled socket or a relay on the power line like Colin suggested.

A caveat here is of course that you'll get problems if the modem is also your WiFi router. 🙂

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 September 2020 17:17 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/6 "2020-09-12T17:17:54Z")

</div>

@ristomatti  
Hey, stealing my ideas! LOL!

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 17:18 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/7 "2020-09-12T17:18:58Z")

</div>

I was typing it already! 😖

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 17:24 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/8 "2020-09-12T17:24:07Z")

</div>

There's an [existing topic](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386) 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/](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.instructables.com/id/ESP8266-Automatic-Router-Restart/)
- [https://www.programmingelectronics.com/esp8266-auto-router-resetter-student-project/](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.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 September 2020 17:27 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/9 "2020-09-12T17:27:14Z")

</div>

Does not everyone that gets into NR, at some point write a flow to ping monitor something? Just saying.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 September 2020 17:30 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/10 "2020-09-12T17:30:55Z")

</div>

Speaking of simulation of a mouse click, I did that once a long time ago. There are a few javascript examples of how to do this, basically you just have to pull the page, parse to get the button control identifier and then you post and event to it. Dang, I don't know where i saved that script, will look for it.

Have you seen this?

> **[How to simulate a click with JavaScript ? - GeeksforGeeks](https://www.geeksforgeeks.org/how-to-simulate-a-click-with-javascript/)**
>
> A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

My modem happens to use JS, so when I could click the reboot button, I did similar to this example.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 17:38 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/11 "2020-09-12T17:38:49Z")

</div>

There's also browser automation libraries for Node.js (used for automated testing, web crawling). Some seem to have contrib node wrappers also:

- [https://flows.nodered.org/node/node-red-contrib-puppeteer-new](https://flows.nodered.org/node/node-red-contrib-puppeteer-new)
- [https://flows.nodered.org/node/node-red-contrib-nbrowser](https://flows.nodered.org/node/node-red-contrib-nbrowser)
- [https://flows.nodered.org/node/node-red-contrib-selenium-webdriver](https://flows.nodered.org/node/node-red-contrib-selenium-webdriver)

The first one is quite recent and Puppeteer is one of the most modern libraries for the purpose so it might even work. 🙂

The newest AFAIK is [Playwright](https://github.com/microsoft/playwright) made by the same team as Puppeteer but I doubt there's a NR wrapper for it.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 September 2020 17:39 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/12 "2020-09-12T17:39:52Z")

</div>

Nice. Good idea too.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 September 2020 17:41 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/13 "2020-09-12T17:41:30Z")

</div>

You just gave me an idea how to drive my dashboard my invisible hand.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 17:50 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/14 "2020-09-12T17:50:17Z")

</div>

If you're wishing to run these on a Raspberry it might not be straightforward as they might depend on native code (often i686/x86\_64) for the browser part. I just remembered I did a quick test using function node and Playwright on a Raspberry Pi to answer a question on the forum: [Automate a screen capture?](https://discourse.nodered.org/t/automate-a-screen-capture/27433). This might help if the contrib node's don't work.

Edit: Oops, I remembered wrong and I didn't get it to work on a Raspberry as I mention on the topic. 🙄

Edit 2: Nightmare.js used by the nbrowser node [seems to run on a Raspberry](https://github.com/segmentio/nightmare/issues/1461) (based on the latest comments) but the version required by contrib-nbrowser is 2.x while the newest is 3.x. I doubt it will work either.

Edit 3: Some say they've [got it to work on a Raspberry](https://github.com/Steveorevo/node-red-contrib-nbrowser/issues/17) with some hurdles.

---

<div class="post-metadata">

**Author:** ![arcegabriel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arcegabriel/32/28485_2.png) [@arcegabriel](https://discourse.nodered.org/u/arcegabriel)\
**Post date:** [12 September 2020 18:39 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/15 "2020-09-12T18:39:40Z")

</div>

Thanks yes need to verify which resolve the issue:

1. Reboot router
2. Power off/on router
3. Reboot modem
4. Power off/on modem (confirmed)

Today power off/on modem completely resolved the issue. Before ping to google between 90-250ms. After ping 13-17ms. Router is on dd wrt and I could event have reboot every night if needed or use some smartphone based automations with tasker.  
I have node red running on windows 10 computer.  
Thanks for the comment. I would need to resolve entering password on login screen and then clicking on the second screen. I inspected the page and can see javascript called out but I am not smart enough to get the function/event. I will check with a friend.

---

<div class="post-metadata">

**Author:** ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)\
**Post date:** [12 September 2020 18:51 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/16 "2020-09-12T18:51:35Z")

</div>

> [@arcegabriel](#):
>
> I have node red running on windows 10 computer.

In this case you might very well have success with the puppeteer node I linked earlier. Based on a quick glance it seemed to have quite a comprehensive set of nodes to work with but it will for sure require some probing with the browser development tools (F12 on Chrome) which you might or might not be familiar with.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [13 September 2020 00:35 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/17 "2020-09-13T00:35:10Z")

</div>

My ISP loves me and hates me. I have a python script (which this week I retired for NR flow) that captures the entire state of the modem, logs, statistics, etc., it all gets dropped into a maria DB instance. For about 10 years, I have had to prove various times, that my ISP is doing some odd things, that my local AMP was failing, that the wiring (external to my house) trunk line was failing, etc. The average tech for ISP would come out, do a spot check, declare that I was smoking the coax cable insulation, and claim the issue was resolved and leave. Well of course it was not fixed. Hence I collect the data, and proved the trending evidence... which can be done if you have the data, and get a tech that will listen.

About 2 years ago, a very good tech happened to answer an issue call I made, he told me flat out, I was 'known' to the local ISP tech team as 'trouble' maker, and because I am an IT guy and an avid online gamer, I was always griping about something. I challenged him, and pulled my data. I asked him to look at the down and up signal strength, channel jumps, noise ratios, line resets, etc.

After a few minutes, he said he would be back. Wow, what a difference, he replaced the AMP, he line balanced the signal loading so the cable modem had appropriate leveling, and the modem was no longer screaming back at the ISP because of the significant uncorrectable codeword errors, and of course noise ratio was insane.

While he watched, the number of line resets continued however, as everything else improved with each change he did. Then he walked down the street and opened the local hub junction, and in seconds was in his van, grabbing a spool of coax, and additional tools. In short, he told me the local hub had several damaged terminations, including mine, and because he knew I was a gamer, changed to order of connections in the hub, so I was inline first on the given bus line, in short I get bandwidth before any of my other 7 neighbors... Don't tell them I know this. Even the odd pixelation on my various TVs improved as he validated the new AMP configuration.

I know this is a long story or comment, but it was what he said as he left, that really nailed this entire visit in my memory... "And you'd show this collection of data to other techs that came before?" I replied "I tried." He picked up his tools, told me to call him directly if there were any issues, and as he walked away, said, I am sure just loud enough for me to here, one word, "Idiots."

---

<div class="post-metadata">

**Author:** ![arcegabriel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arcegabriel/32/28485_2.png) [@arcegabriel](https://discourse.nodered.org/u/arcegabriel)\
**Post date:** [13 September 2020 16:28 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/18 "2020-09-13T16:28:07Z")

</div>

Thanks  
For me it is still puzzling that there are no well / widely known ways to check internet quality. For a service that has more than 95% penetration. Speed test is of course of no use  
What i have been using to test so far is MOS from pingplotter and also the puma modem test from dslreports. (I have a non puma modem)  
Please let me know if you know of another way  
I did notice poor MOS when my video call quality was crap

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [14 September 2020 04:37 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/19 "2020-09-14T04:37:11Z")

</div>

#1 thing to check is the up and down stream signal values and the DB noise ratio. That is the place to start, that tells you what your modem is doing. If the noise ratio is outside of about -10 to +10, and you have a lot of channel number changes over time, or device resets, then you uncorrectable codeword errors are high, meaning counting up frequently... you should be able to prove to your ISP that they have work to do. If you do a lot of vidoe streaming... it buffers and thus hides a lot of ugly issues. But if you are a gamer, and the upload bandwidth and stability is bad, it makes game play horrible. This is easier to spot as well but because buffering is not usually done with gaming.

The big deal, is to set a baseline, and watch how things change from the base line over time. This data should be applicable to any discussion you have with your ISP. Also, when you talk to the ISP, ask for a level 2 support tech, so you get past the call center script readers... 1st level support, and get to someone that actually knows how things work, not just canned information echo back to you.

---

<div class="post-metadata">

**Author:** ![arcegabriel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arcegabriel/32/28485_2.png) [@arcegabriel](https://discourse.nodered.org/u/arcegabriel)\
**Post date:** [14 September 2020 17:48 UTC](https://discourse.nodered.org/t/reset-modem-through-node-red/32778/20 "2020-09-14T17:48:36Z")

</div>

Thanks, Right now my internet was a bit iffy (some lite distortion during voip call). I am not restarting since my daughter is in the middle of a lecture.  
I just checked (wired LAN) ping to google and it is all over the place between 16ms and 160ms. Other runs have similar spread. After a fresh modem reboot ping to google was 13-18ms very solid  
Right now below is what I see on my modem. Would you be able to advise what are the red flags? I have done page scrubbing with node red and maybe I can set alarm from returned values below. I am not sure how to interpret your NR because the SNR below is in dB

### Start Up Procedure

| Procedure | Status | Comment |
| --- | --- | --- |
| Acquire Downstream Channel | 621000000 Hz | Locked |
| Connectivity State | OK | Operational |
| Boot State | OK | Operational |
| Configuration File | OK | bac10c000106c47154183cb2 |
| Security | Enabled | BPI+ |

### Downstream Bonded Channels

| Channel | Status | Modulation | Channel ID | Frequency | Power | SNR |
| --- | --- | --- | --- | --- | --- | --- |
| 1 | Locked | QAM256 | 12 | 621000000 Hz | -3.8 dBmV | 40.2 dB |
| 2 | Locked | QAM256 | 5 | 579000000 Hz | -3.3 dBmV | 40.6 dB |
| 3 | Locked | QAM256 | 6 | 585000000 Hz | -3.1 dBmV | 40.7 dB |
| 4 | Locked | QAM256 | 7 | 591000000 Hz | -3.2 dBmV | 40.5 dB |
| 5 | Locked | QAM256 | 8 | 597000000 Hz | -3.5 dBmV | 40.3 dB |
| 6 | Locked | QAM256 | 9 | 603000000 Hz | -3.6 dBmV | 40.3 dB |
| 7 | Locked | QAM256 | 10 | 609000000 Hz | -3.3 dBmV | 40.4 dB |
| 8 | Locked | QAM256 | 11 | 615000000 Hz | -3.4 dBmV | 40.2 dB |
| 9 | Locked | QAM256 | 1 | 279000000 Hz | -3.8 dBmV | 39.8 dB |
| 10 | Locked | QAM256 | 13 | 633000000 Hz | -4.2 dBmV | 39.9 dB |
| 11 | Locked | QAM256 | 14 | 639000000 Hz | -4.3 dBmV | 38.0 dB |
| 12 | Locked | QAM256 | 15 | 645000000 Hz | -4.0 dBmV | 40.0 dB |
| 13 | Locked | QAM256 | 16 | 651000000 Hz | -3.9 dBmV | 39.9 dB |
| 14 | Locked | QAM256 | 17 | 657000000 Hz | -3.7 dBmV | 39.9 dB |
| 15 | Locked | QAM256 | 18 | 663000000 Hz | -4.0 dBmV | 39.7 dB |
| 16 | Locked | QAM256 | 19 | 669000000 Hz | -4.2 dBmV | 39.7 dB |
| 17 | Locked | QAM256 | 20 | 675000000 Hz | -4.2 dBmV | 39.0 dB |
| 18 | Locked | QAM256 | 21 | 681000000 Hz | -4.0 dBmV | 39.3 dB |
| 19 | Locked | QAM256 | 22 | 687000000 Hz | -3.7 dBmV | 39.4 dB |
| 20 | Locked | QAM256 | 23 | 693000000 Hz | -3.8 dBmV | 39.5 dB |
| 21 | Locked | QAM256 | 24 | 699000000 Hz | -3.9 dBmV | 39.4 dB |
| 22 | Locked | QAM256 | 25 | 705000000 Hz | -3.8 dBmV | 39.4 dB |
| 23 | Locked | QAM256 | 26 | 711000000 Hz | -3.4 dBmV | 39.6 dB |
| 24 | Locked | QAM256 | 27 | 717000000 Hz | -3.2 dBmV | 39.9 dB |

### Upstream Bonded Channels

| Channel | Status | Channel Type | Channel ID | Symbol Rate | Frequency | Power |
| --- | --- | --- | --- | --- | --- | --- |
| 1 | Locked | ATDMA | 4 | 5120 ksym/sec | 38700000 Hz | 46.3 dBmV |
| 2 | Locked | ATDMA | 2 | 5120 ksym/sec | 25900000 Hz | 46.5 dBmV |
| 3 | Locked | ATDMA | 3 | 5120 ksym/sec | 32300000 Hz | 47.0 dBmV |
| 4 | Locked | TDMA and ATDMA | 1 | 2560 ksym/sec | 21100000 Hz | 45.8 dBmV |
| 5 | Not Locked | Unknown | 0 | 0 ksym/sec | 0 Hz | 0.0 dBmV |
| 6 | Not Locked | Unknown | 0 | 0 ksym/sec | 0 Hz | 0.0 dBmV |
| 7 | Not Locked | Unknown | 0 | 0 ksym/sec | 0 Hz | 0.0 dBmV |
| 8 | Not Locked | Unknown | 0 | 0 ksym/sec | 0 Hz | 0.0 dBmV |

[Next page](https://discourse.nodered.org/t/reset-modem-through-node-red/32778.md?page=2)
