Exactly! Currently my bash script runs locally (on 2 Fedora PCs) and does this:
- checks is there is a ‘on file’ to know if the printer has been turned on
- if on, then the rPi is being switch off through ssh, the bash script waits then runs a pip package to turn off the plug
- if off, then the bash script turns on the plug through that pip package, creates an ‘on (empty) file’.
Problem is that with 2 PC you don’t know about the printer status and worst case you will just turn a switch on which is already on.
I kind of thought it “wouid be nice” to have a small icon on my top bar to tell me if the printer is on or off and eventually allow me to switch it on or off. This means I cannot use a local ‘on file’.
My thoughts were initially to ping the printer and see if it’s on, but that seems to be a bad idea. I now have the options of either creating that empty file on a network shared server, or querying the plug through that python program and get an on or an off back.
Apparently there are other libraries (requiring node.js) and therefore using different languages. Maybe I should go that way?
I will still need to turn off the Pi (that’s really the main issue) to avoid damaging the SD card over time, and be able to run a SSH command from that extension.
As you can feel (maybe not), I just wanted an extension and the ability to share that printer easily over my network. I thought it would not be that hard or need a rewrite. Was I wrong?
With more specifications, do you have specific recommendations toward the path I should take?
Thank you.