
A smart plug to monitor your router and automatically reset power if WiFi fails - lukashed
https://plus.google.com/communities/115308608951565782559
======
yoda_sl
Interesting to see that. It turns out that around a month ago after seeing the
Raspberry Pi project that send a tweet to Comcast when internet connection is
slow, it gave me the motivation to use my Raspberry Pi 2 to do the following:

A- every 15 minutes check my internet connection: connectivity (reaching
Goodle DNS host),

B- if connectivity fail, execute D-2 below, if not see next step below

C- then use SpeedTest download / upload; if download/upload speed are too slow
then attempt a second test 30 seconds later

D- if the second attempt fail again then:

1- send an SMS with Twilio to my cell phone to let me know the modem will
reboot, and wait 10 seconds

2- issue a "off" command to my Belkin Wemo (cable modem plugged into it), then
wait another 30 seconds and issue a "on" command

On top of that I have installed InfluxDB + Grafana on my Pi so I can log the
connection latency to Google DNS, and the download/upload speed. Example:

[https://imgur.com/gallery/dgeFR](https://imgur.com/gallery/dgeFR)

The Belkin Wemo command do use only my local Wifi, so even if the modem is
down since my Pi is on the same LAN it can control the Wemo without problem.

It was a fun little project for my Pi. All written in Python. If anyone
interested I can probably post the code somewhere.

[ _updated for formatting_ ]

~~~
cmdrfred
How do you get to twilio when the internet is down?

------
LukeB_UK
This is just the American version of the Kankun wireless plug with a script on
it. The Kankun plug is like 1/4 of the price:
[http://m.aliexpress.com/item/32613551938.html](http://m.aliexpress.com/item/32613551938.html)

There's a whole community about hacking these plugs:
[https://plus.google.com/communities/115308608951565782559](https://plus.google.com/communities/115308608951565782559)

~~~
dang
Thanks! We changed the URL to that second link, which seems like it might be
the most substantive. The originally posted URL was
[http://www.amazon.com/gp/product/B01BU2ALGO/](http://www.amazon.com/gp/product/B01BU2ALGO/).

~~~
qb45
Would be nice if this information was more visible.

I was quite surprised that the link leads to some random G+ page about
"smartplug" hacking while people here are talking as if it was a commercial
product.

------
benmorris
A neat idea but why not take that $60 and buy a router that didn't require
resetting. They do exist. My Asus router just never needs reset. I have it on
an ups unit and the only time it is reset is to do firmware upgrades.

~~~
Filligree
How are you supposed to find out which ones don't?

~~~
tarikjn
Look at the brands that focus on quality/software vs. releasing new models
every 3 months.

In my experience Pepwave/Unifi/Microtik are good prosumer brands.

For more consumer-y stuff, it might be worth it to have a look at the
Apple/OnHub routers too.

You can also pick up enterprise gear on eBay at pretty good prices, brands
such as Cisco/HP/Aerohive/Ruckus etc., but configuring/updating might be a
pain.

~~~
sbierwagen
I've bought Ubiquiti point-to-point wireless gear before, and really liked it,
but note that their APs don't do well with many simultaneous clients:
[http://www.wlanpros.com/wp-content/uploads/2015/06/Wi-Fi-
Str...](http://www.wlanpros.com/wp-content/uploads/2015/06/Wi-Fi-Stress-Test-
Report.pdf) (page 30)

This isn't so much a problem with the regular UniFi APs, but the UniFi AC AP
costs $300!

~~~
ac29
I picked up a UniFi AP AC Lite for $84 a couple months ago and couldn't be
happier with it. For home use, the full version is probably overkill.

------
justin_vanw
Just buy a new router if you have a buggy one that needs restarted all the
time.

This is silly and illogical, if you have a reliability problem fix it, adding
more parts is not likely to help. What happens when this smart plug
malfunctions and restarts your router every 5 minutes?

~~~
RKearney
Agreed. Without naming the brand of router I have in an effort to not start a
brand debate, I must say when you actually end up spending more than $40 on a
wireless router, the quality greatly improves. When I lived with my family, I
thought resetting wireless routers was the norm (all my friends agreed it was
a normal thing). Then I moved out and bought my own equipment. 5 years and
counting and the only time this thing has been power cycled is when my home
lost power in a storm.

You'd be far better off putting the money you'd spend on this gadget towards a
better wireless router and call it a day.

~~~
qb45
> I thought resetting wireless routers was the norm (all my friends agreed it
> was a normal thing).

Trust me, hanging or rebooting is the best of the bad things your router can
do to you.

I had one which would pass LAN->WAN packets without NAT translation if the
_endian-swapped_ destination address matched the LAN address block. Want to
access X.1.168.192 on default settings? Sorry, not today.

And, of course, I didn't use 192.168.1.0/24 but 10.0.0.0/8\. It took me
_weeks_ to figure out that the thing those few websites which suddenly stopped
working had in common was IPs ending with .10 .

This was few years ago and since then I haven't bought a single router which
wouldn't run OpenWRT or at least DD-WRT.

------
damian2000
For half the price you could buy a Raspberry Pi that just runs a simple
watchdog program doing the internet connectivity check. Upon a problem, it
could connect to your modem's web admin page and launch a restart from there.

~~~
whoiskevin
And if the modem is not available?

~~~
swiley
Connect a transistor to a gpio pin to drive a relay and power the modem
through that.

~~~
yoda_sl
Something I need to try... I haven't yet dig into all the wonders of the Pi
gpio and that sounds like a fun project.

------
mdip
I'm a little skeptical about this product having had experience with some of
these WiFi plug devices and as echoed by others, the price of this device is
much higher than it should be.

I've been using Ankuoo and Maginon devices quite a bit at home -- they run
around $25, are easy to setup, conveniently communicate information to Chinese
owned domains (ok, that bit bugs me, but I've blocked the communication) and
they are a script away from this product.

If this is based on the Marvell Chipset that so many of these devices are
based on, I wonder how frequently it'll reset the router not because WiFi went
out but because the device dropped off the network due its own problems. I've
had some _very_ spotty results with a device that I had plugged into the same
power strip as my router and a large number of other devices. Despite being 4
feet from the router, it continually dropped off the network until I moved it
to a wall outlet far away from the power strip (I'm guessing interference from
the myriad of moderately high wattage equipment I had plugged in but I'm no
EE).

Something like this could be made on-the-cheap with a CHIP and a relay ($10
for the CHIP $5-10 for the relay, $~1-5 for USB power) and a little bit of
scripting. Personally, I've wanted a feature like this since my router and
cable modem are not easy to get to when I (rarely) need to cycle them. I
purchased a 4-port relay and plan to pair it with a Banana Pro, wire it to
Ethernet, set it up on WiFi and coupled with software running on my OpenWRT
router, have it decide which to cycle in the event of an outage. Even with
that complex of a build, I'm looking at $55.00 including power (which doesn't
count much for me since I've got a USB block with an available port that I
plan to use).

------
lordnacho
The WiFi may work without the internet working. Is there a plug that checks
that? I get a lot of outages on the internet link side of things, not so many
on the local wireless.

------
SideburnsOfDoom
The @internetofshit Twitter account is already on this one:

[https://twitter.com/internetofshit/status/708565761330176000](https://twitter.com/internetofshit/status/708565761330176000)

"On one level: this is a great idea On another level: WiFi routers shouldn't
be so shit that this exists"

"So many people saying they actually want this thing?! It's apparently real"

------
draw_down
Is it normal for routers to need to be reset periodically? Seems like a pain.

~~~
anotheryou
I have one that looses the internetz when a newer macbook or an iphone cause
noticeable traffic. After a reboot it's fine for a while.

ISPs in Germany can force you to use their router. I have a proper one which
remains unused :/

~~~
vetinari
Just connect your own router to ISPs one, set it to the bridge mode and
disable wifi on the ISP router. Done.

~~~
anotheryou
It's not actually the wifi that fails, it's the internet connection. tried
that

------
dkopi
This is one of those ingenious inventions that make you ask: "Where have you
been all of my life". Perfect for coffee shops, or when the router's in a room
that you can't access without waking anyone up.

Of course in an ideal world, wireless routers would be smart enough to reset
themselves, without having to add another $60 to their price. But we are only
in 2016.

~~~
RGamma
No, in an ideal world companies would stop making cheap, untested consumer
shit that degrades after a few weeks uptime (looking at you, TP-Link). Luckily
products unlike these exist, but not many might know about them, so this is a
completely unnecessary product (hilariously overpriced as well) profitting
from the ignorance of end users...

~~~
chris_wot
Isn't this just an example of the halting problem? As in, you can't prove that
a program won't ever halt.

~~~
icebraining
The halting problem doesn't say that you can never prove that any given
program won't ever halt, just that some programs (written in a Turing-complete
language) are undecidable. You _can_ write a program which can be proven will
or won't ever halt.

But the typical solution to this particular problem is to correctly employ a
watchdog[1] that will restart your program if it halts. In fact, this wifi-
monitoring plug is serving as a watchdog itself.

[1]
[https://en.wikipedia.org/wiki/Watchdog_timer](https://en.wikipedia.org/wiki/Watchdog_timer)

------
bhouston
D-Link routers are the worst for this. About every 2 weeks it would require a
set. I found ASUS to be way more reliable.

------
roylez
Interestingly, this thing, made in China, has almost zero sales in China. Its
price is a bit high, if compared to TL WR703n, which can do a lot more things.
[http://world.taobao.com/search/search.htm?_ksTS=145780791366...](http://world.taobao.com/search/search.htm?_ksTS=1457807913660_20&spm=a21bp.7806943.20151106.1&search_type=0&_input_charset=utf-8&navigator=all&json=on&q=kankun&cna=ZcrJDkAKZxgCAUCmbHpzICzD&callback=__jsonp_cb&abtest=_AB-
LR517-LR854-LR895-PR517-PR854-PV895_2461)

------
acd
You can also add a watch scripts that pings a known address and if does not
work it reboots the router. Zero hardware required which is better than
throwing electronic waste in the environment.

------
MrQuincle
"Identification of a modem: automatically reset modem when anomalous behavior
is detected."

[https://www.kickstarter.com/projects/dobots/crownstone](https://www.kickstarter.com/projects/dobots/crownstone)

Prior art. So you can just get our open source power outlets without patent-
pending stuff.

------
lttlrck
A super cheap way to do this is proactively reset your router every night at
3am by power cycling it with a $12 plug-in timer. Of course it doesn't fit
every use case and it doesn't solve every problem , but it will alleviate
problems related to long running that all to many routers seem to suffer.

------
jarnix
Where/when do you live guys ? Who buys a router that needs to be restarted
(and even fails) ? :) I have a Netgear something that acts as a wifi router
and I do not have to restart it, I don't understand :)

------
DiabloD3
I have a Netgear WNDR4300.

I reboot it about once a year, as in, it has been rebooted three times that
didn't involve firmware updates in its entire life, or about five times total.

If your router is that flakey, just replace the router.

------
jkot
Simpler version is mechanical timer with reset every N hours.

~~~
fpoling
In case of TP-Link routers in crowded WiFi space that would be 15 mintes.

~~~
damian2000
I've never had a problem with TP-Link over about the last ten years and 3
modem/routers. I have heard lots of other people complaining about them
though.

~~~
nier
What’s different about your setup? Do you filter electricity with an
uninterruptible power supply? Cable lengths? No other equipment nearby? Good
ventilation?

~~~
jdpage
I have a pair of TP-Link WDR-3600s. Both run OpenWRT "Barrier Breaker" and
they've been rock-solid. One is on a filtered UPS (the main router), but the
other one is just plugged into the wall and usually has a loaf of bread on top
of it (the wireless relay in the pantry). Both have been fine, so I don't
think it's the power supply.

------
chris_wot
Oh great, there's a patent pending.

------
swiley
SBCs are so cheap at this point just grab one of those and put hostapd and
iptables on it.

~~~
recursive
In order to do that, I'd first have to learn what any of those things are, and
why I'd want to do that.

------
lucio
It's like a physical IISreset. A recognition and acceptance of failure and/or
generalized bad quality.

------
nolite
Where's the EU version?

------
rythie
I'd prefer a router with a AA battery slot, so it doesn't go down in the first
place.

~~~
ethbro
Different problem.

To summarize: many consumer level routers tend to lock up due to firmware
bugs, hardware defects, or overheating. Because they're closed devices, the
solution is usually power off/power on & let the restart clear up any issues
and restore proper wifi functionality. This device ingeniously automates that
step.

