create account

Restart Modem/Router with a smart plug if internet is down by emrebeyler

View this thread on: hive.blogpeakd.comecency.com
· @emrebeyler · (edited)
$46.23
Restart Modem/Router with a smart plug if internet is down
The best part of having a *smart* home is the ability to monitor the house remotely. Especially, if you have a little anxiety, like me. ("Did I lock the door?", "What about the windows?", etc.  These questions are easy to answer.)

This comes with a requirement though, you need a stable internet connection.

I have a 250 Mbit/s internet at home, which is quite okay for personal use. However, the modem provided by [Ziggo](http://ziggo.nl/) is not the best, it goes down from time to time and needs a manual restart.

Imagine you're on your summer holiday, a manual reboot is not really an option. When I try to think a solution for that, the first thing that came into my mind that I can use a smart plug for the modem, and activate/deactivate it if the internet link is down.


![script-logs.png](https://images.hive.blog/DQma8qnmywJJ8kkbimxXiEAAL5eaW9jNTfAMm8KjiTaZQ25/script-logs.png)


I have a couple of smart plugs (IKEA, Heiman, Hue, etc.) that I can use with my Zigbee gateway, Conbee. Since they're controlled in Zigbee protocol, it can be controlled on localhost. I have also a couple of Raspberry Pi's hanging around so I can use one of them to run a Python script which:

- checks if the internet is down
- If it's down, deactivate the plug, wait 60 seconds, activate again.

Using a couple of extra libraries, it was quite easy to implement something like that. [Here](https://gist.github.com/emre/90531b4a501182da62e0207889a0ec12),  is the prototype implementation that I've been experimenting at the moment.

This script can be triggered via a crontab entry in a periodic interval. (I don't want a long-running script to keep things simple and stateless.) I execute it in every hour via [CRON](https://crontab.guru/every-1-hour).


<center>![Screen Shot 2020-07-24 at 17.39.47.png](https://images.hive.blog/DQmWDpF7TNaGauWjGKjw2XQNe7SHjuiAFQCCJW3UsFqdYCA/Screen%20Shot%202020-07-24%20at%2017.39.47.png)</center>

You have any backup plans for cases like that in your home? *"High-availability"* on Smart homes should be a thing in the near future. :)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 293 others
👎  
properties (23)
authoremrebeyler
permlinkrestart-modem-router-with-a-smart-plug-if-internet-is-down
categoryhive-102496
json_metadata{"app":"hiveblog/0.1","format":"markdown","image":["https://images.hive.blog/DQma8qnmywJJ8kkbimxXiEAAL5eaW9jNTfAMm8KjiTaZQ25/script-logs.png","https://images.hive.blog/DQmWDpF7TNaGauWjGKjw2XQNe7SHjuiAFQCCJW3UsFqdYCA/Screen%20Shot%202020-07-24%20at%2017.39.47.png"],"links":["http://ziggo.nl/","https://gist.github.com/emre/90531b4a501182da62e0207889a0ec12","https://crontab.guru/every-1-hour"],"tags":["smart-home","python","modem"]}
created2020-07-24 15:39:48
last_update2020-07-24 15:48:21
depth0
children14
last_payout2020-07-31 15:39:48
cashout_time1969-12-31 23:59:59
total_payout_value26.418 HBD
curator_payout_value19.810 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,068
author_reputation438,133,098,570,236
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,695,550
net_rshares120,607,503,052,147
author_curate_reward""
vote details (358)
@askmihai ·
You're right: it's good to be smart about all aspects of your life.
How's the lockdown going?
properties (22)
authoraskmihai
permlinkqe0y35
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-25 12:16:18
last_update2020-07-25 12:16:18
depth1
children0
last_payout2020-08-01 12:16:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length93
author_reputation3,465,260,472,360
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,709,474
net_rshares0
@chitty ·
I have picked your post for my daily hive voting initiative, Keep it up and Hive On!!
properties (22)
authorchitty
permlinkre-restart-modem-router-with-a-smart-plug-if-internet-is-down-20200726t000257
categoryhive-102496
json_metadata""
created2020-07-26 00:03:00
last_update2020-07-26 00:03:00
depth1
children0
last_payout2020-08-02 00:03:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length86
author_reputation86,901,300,608,582
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,719,036
net_rshares0
@cryptoknight12 ·
Here on Hive you can learn so much! I had no idea you could do this!
properties (22)
authorcryptoknight12
permlinkqdzi0g
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-24 17:31:30
last_update2020-07-24 17:31:30
depth1
children0
last_payout2020-07-31 17:31:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length68
author_reputation77,839,196,919,506
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,697,286
net_rshares0
@deathwing ·
Imagine programming an auto-restart rather than buying a good ol' new router. Get an USG or hEX @emrebeyler!
properties (22)
authordeathwing
permlinkre-emrebeyler-qe1b6e
categoryhive-102496
json_metadata{"tags":["hive-102496"],"app":"peakd/2020.07.1"}
created2020-07-25 16:59:03
last_update2020-07-25 16:59:03
depth1
children0
last_payout2020-08-01 16:59:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length108
author_reputation262,539,750,016,216
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,713,417
net_rshares0
@drutter ·
"The best part of having a smart home is the ability to monitor the house remotely."

Suspicious girlfriends, hackers, and deep state agree 100%. You're making a lot of people happy with that.
properties (22)
authordrutter
permlinkqe0nzg
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-25 08:38:12
last_update2020-07-25 08:38:12
depth1
children1
last_payout2020-08-01 08:38:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length192
author_reputation196,851,105,714,779
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,707,183
net_rshares0
@emrebeyler · (edited)
All my gadgets don't have access to my WIFI network. They connect and report to a HUB which communicates with my phone in a secure way. (end-to-end encryption)

Of course, if you go into the "deep-state" shit, there is no %100 security. You're being tracked by using a laptop/pc/mobile device. You're making "deep-state, "hackers", "stalkers" happy. :)
👍  
properties (23)
authoremrebeyler
permlinkqe1nqh
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-25 21:28:45
last_update2020-07-25 21:30:54
depth2
children0
last_payout2020-08-01 21:28:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length352
author_reputation438,133,098,570,236
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,717,191
net_rshares3,051,827,605
author_curate_reward""
vote details (1)
@foxon ·
I don't today... but I will soon now that I've seen you doing it :D

My router is solid, but the modem gets crabby from time to time. A solution should be pretty simple

Thanks for the inspiration! I feel kind of silly that this hadn't already occurred to me. Well done
properties (22)
authorfoxon
permlinkre-emrebeyler-qe03jw
categoryhive-102496
json_metadata{"tags":["hive-102496"],"app":"peakd/2020.07.1"}
created2020-07-25 01:16:45
last_update2020-07-25 01:16:45
depth1
children2
last_payout2020-08-01 01:16:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length269
author_reputation9,226,931,685,882
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,703,523
net_rshares0
@emrebeyler ·
What do you have in your mind? :)
properties (22)
authoremrebeyler
permlinkqe1nvo
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-25 21:31:54
last_update2020-07-25 21:31:54
depth2
children1
last_payout2020-08-01 21:31:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length33
author_reputation438,133,098,570,236
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,717,244
net_rshares0
@foxon ·
I've got a spare WiFI plug flashed to run MQTT around here somewhere. Plug the modem into that, setup a script on the Pi that runs all the home automation stuffs to check for external connectivity, after x minutes of no external connectivity, power cycle the modem. This will likely be schedule by cron, but managed within OpenHAB since that's where the mqtt bridge is managed

All the times that I've rushed back to see if it's the frickin' modem again, power cycled it, and sat there watching the lights blink.... and it never occurred to me that I could just monitor connectivity and bounce the modem. It's nearly humiliating 😂
properties (22)
authorfoxon
permlinkre-emrebeyler-qe1opy
categoryhive-102496
json_metadata{"tags":["hive-102496"],"app":"peakd/2020.07.1"}
created2020-07-25 21:51:36
last_update2020-07-25 21:51:36
depth3
children0
last_payout2020-08-01 21:51:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length630
author_reputation9,226,931,685,882
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,717,539
net_rshares0
@kingscrown ·
easy and rocking ;)
properties (22)
authorkingscrown
permlinkre-emrebeyler-2020725t75250475z
categoryhive-102496
json_metadata{"tags":["smart-home","python","modem"],"app":"esteem/2.2.7-surfer","format":"markdown+html","community":"esteem.app"}
created2020-07-25 05:52:54
last_update2020-07-25 05:52:54
depth1
children0
last_payout2020-08-01 05:52:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length19
author_reputation2,123,419,067,549,261
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,705,910
net_rshares0
@r351574nc3 ·
If you DIY tomato router, you don't have to use a RPI. You can just have the router restart itself.

https://advancedtomato.com/

You can also hack your router to do so much more regarding environment changes. As well, as prioritization of data on the fly.
👍  
properties (23)
authorr351574nc3
permlinkqdzjwm
categoryhive-102496
json_metadata{"links":["https://advancedtomato.com/"],"app":"hiveblog/0.1"}
created2020-07-24 18:12:21
last_update2020-07-24 18:12:21
depth1
children2
last_payout2020-07-31 18:12:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length256
author_reputation169,747,269,306,049
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,697,916
net_rshares18,248,329,888
author_curate_reward""
vote details (1)
@emrebeyler ·
$0.02
Looks like a great project, thanks!
👍  
👎  
properties (23)
authoremrebeyler
permlinkqdzubk
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-24 21:55:48
last_update2020-07-24 21:55:48
depth2
children1
last_payout2020-07-31 21:55:48
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length35
author_reputation438,133,098,570,236
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,701,306
net_rshares114,752,830,948
author_curate_reward""
vote details (2)
@r351574nc3 ·
Tomato blogpost inbound, right? LOL
properties (22)
authorr351574nc3
permlinkqe092i
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-25 03:15:51
last_update2020-07-25 03:15:51
depth3
children0
last_payout2020-08-01 03:15:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length35
author_reputation169,747,269,306,049
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,704,695
net_rshares0
@rcaine ·
Wow!  I did not realize what was available out there. Thanks
properties (22)
authorrcaine
permlinkqe02lb
categoryhive-102496
json_metadata{"app":"hiveblog/0.1"}
created2020-07-25 00:56:00
last_update2020-07-25 00:56:00
depth1
children0
last_payout2020-08-01 00:56:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length60
author_reputation71,492,578,717,582
root_title"Restart Modem/Router with a smart plug if internet is down"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id98,703,314
net_rshares0