need usb-controlled 110v switch that can be programatically operated from command line
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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)
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.
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.
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.
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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.