kantlivelong / OctoPrint-PSUControl

Smart control of your power supply via GPIO, GCODE Command, System Command, or variety of sub-plugins.
GNU Affero General Public License v3.0
202 stars 112 forks source link

Pre-On command #235

Open ray73864 opened 2 years ago

ray73864 commented 2 years ago

So I have this working perfectly with my TP-Link Kasa KP115 smart plug with energy monitoring. I'm using the PSU-Control TP-Link sub-plugin for that.

In my settings I have the switching method set to 'plugin' and the switching plugin set to 'PSU Control - TPLink', I have the IP address set up in the TPLink sub-plugin.

I also have 'Enable switching with G-Code commands' set to on.

I have 'automatically turn PSU on' enabled, and 'Connect when powered on', and 'automatically turn PSU OFF when idle' enabled and set to 5-mins.

One thing I would like to do though, since all the above is working perfectly, is to also control the USB port on the RPi 3 Model B+.

I have uhubctl installed on my Pi, I have the Pi permanently plugged into my Voxelab Aquila printer, however the USB port on the pi keeps the LCD for the printer on.

What I would love to do is a 'pre-on' command or something, so when the TPLink Kasa plug gets switched on, the PSU Control plugin can also do a 'uhubctl -p 2 -a toggle' to turn the USB port on on the pi and similarly when the Kasa plug gets turned off, another run of that command will turn the USB port off.

I realise there are hacks around such as putting electrical tape on the 5V pin inside the USB cable plug, etc... but would love to just have this plugin do the whole thing.