TPLinkSmartplug 0.9.19 Beta Testers Needed

I have to admit, I don't know how you setup all this.

Me: UPS -> TP-Link -> Ikea KAPLA power strip -> printer, Pi power adapter

Are you doing something where you're powering the printer from a TP-Link and toggling it ON/OFF this way?

I suppose some users might want to see pictorial representations of standard setups which you had in mind.

I personally have converted over to a HS300 (thanks to the donations I've received from plugin development). I do know it works on a the smaller 2 port HS107 and I assume the newer 3 port strip as well as any other Kasa based version TPLink smart power device. By having a single strip I'm able to control each of the plugs individually and control both power to the printer, power to the pi4 (with its official power supply of course), power to pretty much anything. I know some people have used it for controlling lights and heaters for dry boxes, enclosures, etc. The whole point is that it's completely open to setting it up the way you think it would be helpful.

I get that it's open. I like that about it. It feels like a Swiss Army Knife in that way. When I push code to the Internet's collection of users, I assume that they really don't know much.

It's like the "hit them with a hammer" documentation approach:

I'm a pretty smart guy and I think it's going to take me a while to figure out how to set all the bells & whistles of your plugin for my situation, whether I need two TP-Links or one, whether I just need to go to Fry's right now and see if they have an HS300 (that sexy beast that it is). I assume that there's some feature which knows that the Pi is powered by the same TP-Link and there's some sort of code behind that which shuts down OctoPrint and then powers off the device.

In your shoes, I'd probably not hand the user a box full of toys. I'd probably instead deliver canned workflows like:

  1. Setup for one ganged TP-Link (all power plugged into a strip which is plugged into a SmartPlug)
  2. Setup for two or more TP-Links
  3. Setup for an HS300 SmartPlug strip

And then of course, let the user change these default settings per your existing interface.

I think I would add a link near the top of the Settings page which takes the user back to the README on the repository. And I would add a tip jar at the bottom of that page, of course. And finally, I think I would add a link to the Plugins sub-forum of the OctoPrint website for support-related questions.

  • Same rig, now with an HS300
  • Issued static IP address to strip, power-cycled and verified IP address
  • Powered up TFT, Pi and Robo board on a ganged strip from Plug 2
  • I'm noting that the earlier HS110 is no longer available on the network since I consolidated things
  • Upon startup, OctoPrint seemed to be taking a long time to get going, throwing some of this:
2020-03-08 12:59:27,507 - tornado.access - WARNING - 404 GET /static/webassets/packed_plugins.css?d1894127 (::ffff:10.20.30.240) 2.63ms
2020-03-08 12:59:27,524 - tornado.access - WARNING - 404 GET /static/webassets/packed_core.js?f52b1299 (::ffff:10.20.30.240) 2.67ms
2020-03-08 12:59:27,613 - tornado.access - WARNING - 404 GET /static/webassets/packed_libs.js?3339d949 (::ffff:10.20.30.240) 2.45ms
2020-03-08 12:59:27,620 - tornado.access - WARNING - 404 GET /static/webassets/packed_client.js?09c75251 (::ffff:10.20.30.240) 3.40ms
2020-03-08 12:59:27,626 - tornado.access - WARNING - 404 GET /static/webassets/packed_plugins.js?8e1f0614 (::ffff:10.20.30.240) 2.41ms
  • Refreshed browser and it's now okay
  • Deleted earlier HS100 from the Settings -> TPLink page
  • I'm trying to add the HS300; I have it's main address but I don't know how to address an individual port on that
  • RTFM'd and figured out that I needed to append a /1 for Port 2 on there (geek much?)
  • Seems to work for turning the Yamaha keyboard ON/OFF (so far)

Ouch...

  • Just setup this, hoping that this would gracefully shutdown OctoPrint 30 seconds before toggling off the Port 2 which it's sitting on

Screen Shot 2020-03-08 at 1.36.10 PM

  • Saved that, went to toggle off power, confirmed yes and instantly power toggled off without shutting down or delaying

Tried this version:

Screen Shot 2020-03-08 at 1.40.45 PM

  • Did gracefully shutdown OctoPrint but didn't toggle off power on the strip itself (presumably the plugin is no longer in control?)

Ok. So I’m not sure if the idle is 100% working. My printer is currently on, and at 23 Celsius for hotend and bed. My idle target temp is set for 33. It has been on since at least this morning. Unfortunately I don’t know when I powered it on.

My idle timeout is set to 3 minutes(for testing) and it still hasn’t shut off. I’m not sure what to try here. Any ideas as to why it wouldn’t have turned off? The printer has definitely been idle. I have done a print in a couple days.

Use Countdown timers if you want to power off after shutting down the pi. Make sure to make the timer delay longer than the system command delay.

Verify you enabled the option on the individual plug's setting. I think it should have transgerred, but just want to make sure. Enabled debug logging and then comb through the plugin_tplinksmartplug_debug.log

Ah. I didn’t realize I needed to enable it on the plug. Sure how it turned off on my first test. I’m guessing the psu plugin was at play.

Because my plugin can control multiple devices I wanted to give the option versus simply powering off every added plug.

It was easier to program versus subtracting 1 from that assignment. The calls to the plug for children (each individual plug) is a 0 indexed array. And obviously I geek a lot, I wrote several plugins to control many various power plug/relay devices.

You know I'm messing with you, right? :wink:

Screen Shot 2020-03-08 at 5.42.53 PM

  • Seems to result in what I'm looking for
  • Shuts down gracefully
  • Seems to take longer than 60 seconds (90 perhaps?) before toggling the power off but I'd rather it err on that side rather than too soon

Next

  • Added GCODE Trigger with 60 second delay on shutdown
  • Reconfigured my TFT shutdown sequence to then send the @TPLINKOFF syntax over to the plugin side of things
  • Was surprised that this was the delay-before-doing-anything sort of delay (making this a two-minute process overall (so I've now knocked that down to 3 seconds, as before)

Just pushed updates to the same branch as before with improved tooltips interface to better explain the settings. I think I got them all in there, including on the plug editor pop-up.

1 Like

I'm noting that in my browser it required a hard-reload to get the new features (defeating the browser's cache).

So for Cost per kWh, I assume that PG&E's $0.20/kWh means that I plug in 0.20 there.

Yeah, force refresh is required when there isn't a version bump. Your assumption is correct for cost.

1 Like

Does this plugin work with the Kasa Power Strip? Amazon has it for $30 bucks today and it would be perfect for my printer, but I just want to make sure it will work before buying it.

Not 100% sure on the smaller 3 port, but I use the bigger brother HS300 and it does. Should in theory work with any kasa based plug/strip.

Thanks. I’m going to pull the trigger on it.

@simpat1zq, please let me know if it does so I can update the readme of known compatible devices.

It's probably an OEM special version of TP-Link's and it's likely compatible.

Did you get a fix for this as my HS110 has stopped working for a couple of weeks now. I get the same grey icon spinning but nothing happens now. Used to work perfectly. The icon used to be green.

Enable debug logging and restart octoprint. Try pressing the gray button and then share your octoprint.log and plugin_tplinksmartplug_debug.log.