LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-09-2024, 03:38 PM   #1
davidwneill
LQ Newbie
 
Registered: Apr 2024
Posts: 3

Rep: Reputation: 0
need usb-controlled 110v switch that can be programatically operated from command line


My provider's modem loses communication, at least weekly.

I have had it replaced, and the problem persists. Could be a problem up-stream of the modem.

A power-cycle brings it back, but sometimes I'm away from home, and would like to log in... I can write the program to check for loss of communications, and send commands to the usb device on my system, but haven't found a controller that does that.

The normal operation would be for power to be on, and only be interrupted for a few seconds, if comms have been down for maybe an hour. Best would be a device that plugs in to normal power outlet, and provides 1 or possibly 2 switchable outlets.

Does anyone know of such an item? Cheap? ;^)
 
Old 04-10-2024, 05:12 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,309

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
I think you're in Catch-22. If you need to reset the isp's modem, you obviously have lost internet access. You said so yourself, because you can't reach your printer.So how can you communicate by wifi to the reset switch??

Even presuming the home setup is over-complicated technically, you don't need such a gimmick at all. Save or email whatever files you want to yourself, and print them when you go home. If your printer is that slow, buy new. If someone is there, let them reset your modem. And give your isp a rocket.

EDIT: It's a good rule to keep gimmicks away from mains. They're a very bad mix, and a fire risk. You could end up explaining to your home insurance company why they should pay up for a fire caused by your gimmick.

Last edited by business_kid; 04-10-2024 at 06:24 AM.
 
Old 04-10-2024, 05:36 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
probably an ups helps. From the other hand an esp32 (or a SBC) and an IoT plug can do that.
like this: https://www.mindolife.com/product/smart-plug/ (I do not suggest it, just show as an example)
 
Old 04-10-2024, 07:07 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,714

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Many smart plugs require the internet or some sort of cloud environment. I found this relay box but you need something like a Pi to control it. A Pi Zero W is only around $15 US but you need the power supply, memory card etc to make it functional which adds up.

https://www.amazon.com/Iot-Relay-Enc.../dp/B00WV7GMA2

There are ethernet and USB relays you can wire up if you want a DIY project.
 
Old 04-10-2024, 07:37 AM   #5
davidwneill
LQ Newbie
 
Registered: Apr 2024
Posts: 3

Original Poster
Rep: Reputation: 0
I found this:
https://pwrusb.com/products/powerusb-basic
which fits the bill, except for cheap...

I guess I wasn't clear enough.. what I want is for the system to
detect loss of internet access (easy enough, ping works), and then,
after a few consecutive failures, to issue the command to power-cycle
the provider's modem.

If it can also power-cycle the wifi router (separate hardware), then
that's ok, but the controlling system is hard-wired to the router,
which is hardwired to the provider's modem.. no wifi involved.
 
Old 04-10-2024, 07:49 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by davidwneill View Post
I found this:
https://pwrusb.com/products/powerusb-basic
which fits the bill, except for cheap...

I guess I wasn't clear enough.. what I want is for the system to
detect loss of internet access (easy enough, ping works), and then,
after a few consecutive failures, to issue the command to power-cycle
the provider's modem.

If it can also power-cycle the wifi router (separate hardware), then
that's ok, but the controlling system is hard-wired to the router,
which is hardwired to the provider's modem.. no wifi involved.
Yes, I think it was ok. You can check it with any esp32 based device or SBC (running on batteries) or similar (like a raspberry pi) and use a "smart" plug to reset the modem. You can use an old laptop for this.

But based on your last post I don't really know what is missing for you.
 
Old 04-10-2024, 08:08 AM   #7
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,372

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
When I have experienced this, I have found that I can still access my modem from a web browser and navigate to a reboot option. I have never tried to do this programmatically, but it may be an approach to consider.
 
Old 04-10-2024, 10:28 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,714

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Quote:
Q2. The software is not working my Linux platform. How do I get it working

A: Since there are many variants of Linux, our software may not be compatible on few versions. We have limited support for Linux. We have shared the source code for shared object (.so) file under www.pwrusb.com/linux/so_source/. You can try to compile it and build the .so file in your environment and your version of linux/ubuntu
It looks good and most likely building from source will work but.
 
Old 04-10-2024, 10:49 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,637

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by allend View Post
When I have experienced this, I have found that I can still access my modem from a web browser and navigate to a reboot option. I have never tried to do this programmatically, but it may be an approach to consider.
Agreed....I'd look at what SNMP options it has, since you may be able to use snmpset to issue a reboot command.

That said, I'd probably first consider telling your provider that the modem you have is junk, and ask for a new one. They often upgrade hardware but don't say anything to older customers since it's cheaper to leave the old stuff there until someone complains.
 
Old 04-10-2024, 10:57 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Quote:
Originally Posted by TB0ne View Post
They often upgrade hardware but don't say anything to older customers since it's cheaper to leave the old stuff there until someone complains.
Yes, probably the cheapest solution is to replace the hardware.
 
Old 04-10-2024, 11:23 AM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,714

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Not necessarily bad hardware. If you have cable internet then your ISP should be able to read the signal level at the MODEM (most other services should be able to as well) and see if it is marginal. Internet needs more signal strength then TV. At one time I had a bad signal but the ISP reading supposedly was acceptable. The true reading with a meter at my house proved it was not. Bad wiring, connector corrosion (my problem), loose connectors or even a bad splitter can cause problems. You can have similar problems with other types of Internet service as well.
 
Old 04-16-2024, 03:12 PM   #12
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
Get a 24 hour timer and let it reboot every day? Some electronic models can be set to a minute. Mechanical might be 15 minutes minimum.
 
Old 04-16-2024, 07:46 PM   #13
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,714

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
The mechanical ones are typically 30 minute intervals and digital by the minute. That would be the simplest although depending when the outage happens it could be after the reset.

I am not suggesting this particular device but there are several USB relays that appear as virtual serial ports. It would not be difficult to write a program to interface with these devices. Be sure if you choose one of these devices it exceeds the current required by your MODEM/router. It would also be a bit of a DIY project to wire up a cable.

https://www.amazon.com/Module-Intell...8235f6f86353c9
 
Old 04-16-2024, 08:31 PM   #14
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
A universal digital timer might cost under $10.

I have some KASA devices that are supposed to work even if it doesn't have wifi. So you can get them and use them on a schedule or if wifi you can control remotely.

Last edited by jefro; 04-16-2024 at 08:32 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Are Program Windows Self Controlled or OS Controlled? bradonomics Linux - Desktop 4 08-05-2015 03:15 PM
Fvwm - Programatically switch virtual desktops devnull10 Linux - Software 1 01-21-2010 03:00 AM
high-tech bolts and latches, which can be operated without being touched Envision5000 General 2 03-31-2006 09:24 PM
rj6 coaxial and 110v rjcrews General 1 11-04-2004 05:04 PM
Anyway to let ONE X clients to see the actions which operated by another X clients? proxyz Linux - Software 0 03-16-2004 12:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration