TPLinkSmartplug 0.9.19 Beta Testers Needed

It didn't shut down after canceling the print and it didn't show anything else for me on starting the next print. When should the double abort windows show up?

I saw it at the end of the next print after cancelling.

Yes. With the PSU plugin, you can set it so that if you turn on your printer(but not start a print), and then you forgot about it, it will shut down after x minutes.

Thanks. New Feature Request added here. Does it also power off if you have been printing and don't do an automatic power off, after a period of time it powers off, or just when you first start the printer and connect OctoPrint?

I believe it doesn’t really even rely on whether or not a print finished. I think that any time the printer is idle for x minutes and the temperature is below the threshold, then it cuts power.

Just a heads up for anyone using this plug. Nothing to do with the plugin directly, just a PSA. If you were using it for something else previously, be sure to cancel any schedules before using it on your printer. I was using my plug to water my plants and I had some schedules to turn it off. And then I had a print fail yesterday because the printer cut off at 10pm sharp.

Oops, good point.

"No plants were harmed in the making of this film."
~ American Plant Humane Society

"Oh, fer fook's sake...!"
~ American 3D Print Job Society

So I just pushed updates to my 0.9.19 branch that totally gets rid of the on print complete option and converts over to the idle timer. After looking at @kantlivelong's PSUControl plugin's implementation it made a lot more sense to have one or the other, but not both.

Good stuff. I’m going to update your plugin and uninstall the PSUplugin. I’ll let you know how it goes.

EDIT: Nevermind, I just installed it from the URL again and it overwrote the plugin and kept the settings. The idle option is there now. And I just tested it and it works. After 3 minutes, it gave me a 1 minute warning, and then it shut down after that minute.

I just checked for updates using the force update check button. It didn’t see an update. It shows I have .9.19 installed.

  • New 16gb microSD card, Raspberry Pi 3B, 10.1" SunFounder TFT, OctoPi 0.17.0 IMG via balenaEtcher, no printer connected, adjust wifi credentials and boot
  • TP-Link SmartPlug HS100 not connected to the Pi (for the moment), configured in KASA app as "my 3D printer" and connected to same wifi zone
sudo service octoprint stop
rm -Rf ~/oprint
virtualenv -p python3 oprint # Python 3.7.3
source ~/oprint/bin/activate
pip install octoprint # OctoPrint 1.4.0
sudo raspi-config # hostname, localization, memory split (300), reboot
sudo apt-get update && sudo apt-get upgrade # reboot
Installing plugin from https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/0.9.19.zip...
/home/pi/oprint/bin/python3 -m pip --disable-pip-version-check install https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/0.9.19.zip --no-cache-dir
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/0.9.19.zip
Downloading https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/0.9.19.zip
Requirement already satisfied: OctoPrint in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint-TPLinkSmartplug==0.9.19) (1.4.0)
Requirement already satisfied: emoji<0.6,>=0.5.4 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.5.4)
Requirement already satisfied: Click<8,>=7 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (7.0)
Requirement already satisfied: netaddr<0.8,>=0.7.19 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.7.19)
Requirement already satisfied: sarge==0.1.5post0 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.1.5.post0)
Requirement already satisfied: filetype<2,>=1.0.5 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.0.5)
Requirement already satisfied: awesome-slugify<1.7,>=1.6.5 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.6.5)
Requirement already satisfied: Flask-Babel<0.13,>=0.12 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.12.2)
Requirement already satisfied: future<0.19,>=0.18.2 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.18.2)
Requirement already satisfied: websocket-client<0.57,>=0.56 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.56.0)
Requirement already satisfied: pyserial<3.5,>=3.4 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (3.4)
Requirement already satisfied: feedparser<5.3,>=5.2.1 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (5.2.1)
Requirement already satisfied: sentry-sdk==0.13.2 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.13.2)
Requirement already satisfied: Flask-Assets<0.13,>=0.12 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.12)
Requirement already satisfied: netifaces<0.11,>=0.10.9 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.10.9)
Requirement already satisfied: requests<3,>=2.22.0 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2.23.0)
Requirement already satisfied: wrapt<1.12,>=1.11.2 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.11.2)
Requirement already satisfied: markdown<3.2,>=3.1 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (3.1.1)
Requirement already satisfied: flask<0.13,>=0.12 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.12.5)
Requirement already satisfied: rsa<5,>=4.0 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (4.0)
Requirement already satisfied: psutil<5.7,>=5.6.5 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (5.6.7)
Requirement already satisfied: regex!=2018.11.6 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2020.2.20)
Requirement already satisfied: PyYAML<6,>=5.1 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (5.3)
Requirement already satisfied: cachelib<0.2,>=0.1 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.1)
Requirement already satisfied: Flask-Login<0.5,>=0.4.1 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.4.1)
Requirement already satisfied: werkzeug<0.17,>=0.16 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.16.1)
Requirement already satisfied: watchdog<0.10,>=0.9.0 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.9.0)
Requirement already satisfied: semantic-version<2.9,>=2.8 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2.8.4)
Requirement already satisfied: frozendict<1.3,>=1.2 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.2)
Requirement already satisfied: blinker<1.5,>=1.4 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.4)
Requirement already satisfied: pkginfo<1.6,>=1.5.0.1 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.5.0.1)
Requirement already satisfied: pylru<1.3,>=1.2 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.2.0)
Requirement already satisfied: Jinja2<2.9,>=2.8.1 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2.8.1)
Requirement already satisfied: tornado==4.5.3 in /home/pi/oprint/lib/python3.7/site-packages (from OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (4.5.3)
Requirement already satisfied: Unidecode<0.05,>=0.04.14 in /home/pi/oprint/lib/python3.7/site-packages (from awesome-slugify<1.7,>=1.6.5->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.4.21)
Requirement already satisfied: Babel>=2.3 in /home/pi/oprint/lib/python3.7/site-packages (from Flask-Babel<0.13,>=0.12->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2.8.0)
Requirement already satisfied: six in /home/pi/oprint/lib/python3.7/site-packages (from websocket-client<0.57,>=0.56->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.14.0)
Requirement already satisfied: certifi in /home/pi/oprint/lib/python3.7/site-packages (from sentry-sdk==0.13.2->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2019.11.28)
Requirement already satisfied: urllib3>=1.10.0 in /home/pi/oprint/lib/python3.7/site-packages (from sentry-sdk==0.13.2->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.25.8)
Requirement already satisfied: webassets>=0.11.1 in /home/pi/oprint/lib/python3.7/site-packages (from Flask-Assets<0.13,>=0.12->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2.0)
Requirement already satisfied: idna<3,>=2.5 in /home/pi/oprint/lib/python3.7/site-packages (from requests<3,>=2.22.0->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2.9)
Requirement already satisfied: chardet<4,>=3.0.2 in /home/pi/oprint/lib/python3.7/site-packages (from requests<3,>=2.22.0->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (3.0.4)
Requirement already satisfied: setuptools>=36 in /home/pi/oprint/lib/python3.7/site-packages (from markdown<3.2,>=3.1->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (45.3.0)
Requirement already satisfied: itsdangerous>=0.21 in /home/pi/oprint/lib/python3.7/site-packages (from flask<0.13,>=0.12->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.1.0)
Requirement already satisfied: pyasn1>=0.1.3 in /home/pi/oprint/lib/python3.7/site-packages (from rsa<5,>=4.0->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.4.8)
Requirement already satisfied: argh>=0.24.1 in /home/pi/oprint/lib/python3.7/site-packages (from watchdog<0.10,>=0.9.0->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.26.2)
Requirement already satisfied: pathtools>=0.1.1 in /home/pi/oprint/lib/python3.7/site-packages (from watchdog<0.10,>=0.9.0->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (0.1.2)
Requirement already satisfied: MarkupSafe in /home/pi/oprint/lib/python3.7/site-packages (from Jinja2<2.9,>=2.8.1->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (1.1.1)
Requirement already satisfied: pytz>=2015.7 in /home/pi/oprint/lib/python3.7/site-packages (from Babel>=2.3->Flask-Babel<0.13,>=0.12->OctoPrint->OctoPrint-TPLinkSmartplug==0.9.19) (2019.3)
Building wheels for collected packages: OctoPrint-TPLinkSmartplug
Building wheel for OctoPrint-TPLinkSmartplug (setup.py): started
Building wheel for OctoPrint-TPLinkSmartplug (setup.py): finished with status 'done'
Created wheel for OctoPrint-TPLinkSmartplug: filename=OctoPrint_TPLinkSmartplug-0.9.19-py3-none-any.whl size=2219124 sha256=1cb20c2551e51ac1ed3458c26cfcf43aa29fb57a4fc7ac1419b0b41cdd4e3d97
Stored in directory: /tmp/pip-ephem-wheel-cache-knmkjumm/wheels/fc/b9/5f/66d3209a3e96e1440dd31e5224e2a6b055dead8dca98358c23
Successfully built OctoPrint-TPLinkSmartplug
Installing collected packages: OctoPrint-TPLinkSmartplug
Successfully installed OctoPrint-TPLinkSmartplug-0.9.19
Done!
  • Restart
  • Visit web interface to see new gray lightning bolt. So of course, I click it and it just spins, doing nothing.
2020-03-07 15:03:07,310 - octoprint.plugins.tracking - INFO - Sent tracking event pong, payload: {'plugins': 'tplinksmartplug:0.9.19'}
2020-03-07 15:03:13,127 - octoprint.plugins.tracking - INFO - Sent tracking event startup, payload: {'version': '1.4.0', 'os': 'linux', 'python': '3.7.3', 'pip': '20.0.2', 'cores': 4, 'freq': 1200.0, 'ram': 738238464, 'pi_model': 'Raspberry Pi 3 Model B Rev 1.2', 'octopi_version': '0.17.0'}
  • Settings -> TP-Link Smartplug -> Click + (no action) -> Click pencil (no action)

Screen Shot 2020-03-07 at 3.08.31 PM

  • Click Close button (no action), Click Save button (button animation but no dismissal of the Settings dialog), Click x in corner (dismisses)
  • Restart OctoPrint
  • Click + (no action)

Screen Shot 2020-03-07 at 3.16.04 PM

Screen Shot 2020-03-07 at 3.17.05 PM

I'm not seeing anything significant happening in the logs.

I note that I now have two gray lightning bolts at the top of my statusbar.

config.yaml

    tplinksmartplug:
        _config_version: 11
        arrSmartplugs:
        -   autoConnect: true
            autoConnectDelay: 10
            autoDisconnect: true
            autoDisconnectDelay: 0
            btnColor: '#808080'
            countdownOffDelay: 1
            countdownOnDelay: 1
            currentState: unknown
            displayWarning: true
            emeter:
                get_realtime: {}
            event_on_disconnect: false
            event_on_error: false
            gcodeEnabled: false
            gcodeOffDelay: 0
            gcodeOnDelay: 0
            icon: icon-bolt
            ip: ''
            label: ''
            powerOffWhenIdle: false
            sysCmdOff: false
            sysCmdOffDelay: 0
            sysCmdOn: false
            sysCmdOnDelay: 0
            sysRunCmdOff: ''
            sysRunCmdOn: ''
            thermal_runaway: false
            useCountdownRules: false
            warnPrinting: false
        -   autoConnect: true
            autoConnectDelay: 10
            autoDisconnect: true
            autoDisconnectDelay: 0
            automaticShutdownEnabled: false
            btnColor: '#808080'
            countdownOffDelay: 1
            countdownOnDelay: 1
            currentState: unknown
            displayWarning: true
            emeter:
                get_realtime: {}
            event_on_disconnect: false
            event_on_error: false
            gcodeEnabled: false
            gcodeOffDelay: 0
            gcodeOnDelay: 0
            icon: icon-bolt
            ip: ''
            label: ''
            sysCmdOff: false
            sysCmdOffDelay: 0
            sysCmdOn: false
            sysCmdOnDelay: 0
            sysRunCmdOff: ''
            sysRunCmdOn: ''
            thermal_runaway: false
            useCountdownRules: false
            warnPrinting: false

What's weird is that the config.yaml now has just this:

    tplinksmartplug:
        _config_version: 11

I note that the bottom of my own USBControl plugin's JavaScript file looks slightly different than your own.

Testing a fresh install now to see where the knockout binding is breaking.

1 Like

I tried modifying your code's JavaScript to look like mine but that didn't help.

Should be fixed now. Just pushed an update to the same branch. It will now default with an empty list of plugs.

1 Like

Manually edited config.yaml and added the TP-Link in question (OFF). The statusbar shows a red lightning bolt. Settings screen shows the label I created (no options). Still missing the view model, of course.

It was a missing value in the dictionary that defines the plug. I just fixed it by removing a blank plug from the default settings, but you may have missed my last reply.

  • Tried looking for an update (none seen)
  • Deleted plugin (with data purge)
  • Reinstalled with same URL as before
  • Restart
  • Comes up with no lightning bolt in the statusbar by default
  • Settings page for this has no mostly-empty entry, as before
  • + brings up a dialog
    • Walking through this, I think it would be good to have the hover-over help text (like what's the difference on some of these?)
  • Same suggestion when I'm back on the main Settings screen (hover-over for each of the checkboxes)

Okay, created one. I clicked the new icon in the statusbar and it changes to green and the TP-Link is now on. Clicking again, I get prompted and it does turn off the device as expected.

Yeah, documenting settings is one thing I don't do so well. I agree that this should be done.

Good news.

Added an HS110 as a second option. It's the one this Raspberry is powered by. Clicking the gray icon at the top animates a spin and stays the same gray. (Obviously, it's on.)

I'm guessing that it can't get the status for this one.

Just enabled Polling for Status @ 15 minutes.
Clicked the Refresh icon in the side panel widget; animation but still gray.

UPDATE: Confirming with my router that the HS110 isn't on the static IP address that I issued earlier. Updating... and immediately, the color follows the status, as expected.

Screen Shot 2020-03-07 at 4.33.10 PM