I have two of the HS100 version and one of the HS105. Both have the standard three-prong power plugs. The first one seems a little heftier.
The KASA phone app couldn't be simpler.
The Alexa phone app involves going into Settings and choosing Smart Home -> Add Device. The registration process involves using your Amazon ID. This is how all your Echo (and similar) devices know that you have this particular TP-Link and it will add it to your Alexa inventory, if you will.
I have one of the HS100 connected to a light in the living room, a.k.a. "light". The one associated with the printer I've named "my 3D printer". The one associated with the octo-proxy is the HS105 but I rarely toggle that one.
There are some photos here in a talk I did in San Diego on the subject.
Thanks for the shoutout @OutsourcedGuru. Yes, I've developed a tasmota plugin that will control sonoff devices as @supertaz linked flashed with tasmota firmware. I've created a TPLink plugin that will control the plugs @OutsourcedGuru mentioned, with recent updates for cleanly shutting down a pi prior to power off. I also have tasmota MQTT plugins that control tasmota devices via MQTT protocol. Another one that can control any type of switch that is controllable via Domoticz server and finally a beta Wemo plugin that can in theory work with Wemo plugs but have yet to find anyone to test it for me, so haven't released it to the plugin repository.
I just leave my pi on unless I go on vaycay or something (current image saved). Use the pi to auto control power to printer for controled startup in stages and shutdown using relays. Also, complete control and monitor via Printoid app. There's a ton of info on the interweb for whatever suits your needs. Just need to research and get the right plugins.
I've been trying to read all the topics related to powering off the printer and raspberry through a command, using relays or similar. In my case, raspberry is fed from the printers PSU and a sonoff switch powers the printer (and hence the raspberry)
I can do all I want manually and remotely, by using e.g. Printoid to shutdown the Pi and the sonoff interface to shutdown.
now, if I flash the Sonoff, I can from the Pi issue a (Sonoff) poweroff.
I see two problems with this:
when issuing the (Sonoff) poweroff, the Pi kills its own power before it can shutdown.
power down with a hot extruder is not recommended, as the extruder cooling fan will also stop.
So my questions are:
Is there a solution for operating a modified switch as discussed here that also cuts of power to the pi?
Do the shutdown procedures discussed here consider the extruder temperature in a safe manner?
Sorry if I missed possible answers on this in the forum, but I couldn't find any: my bad...
Maybe this one is a step into your direction. Instead of controling an ATX PS, you also can use relays to control regual PS.
There is also a plugin that shuts down the RasPi at the desired nozzle temperature.
Thanks for looking into it and for your answers. I am also happy that there wasn't a quick solution that I had overlooked...
That looks indeed like one step. In fact, given the fact that a Sonoff switch is programmable and we flash it we could change the Arduino code and include this timer function. Maybe it is even there already, as the Sonoff in its natural form supports scheduled switch off. So you can program it to switch off in like a minute later...
Unfortunately, the ATX provides me another problem, as my printer is a Prusa MK3/MMU it runs on 24V.
The plugin for the temperature controlled shutdown, targets a TPLink device, might need to get that one, though I like seeing how much kWh my printer consumes, the Sonoff I currently use does that. Note that however it does not prevent shutdown when temperature is too high, but at least it schedules it.
Coming to think of it, I think it needs a script that ideally:
Registers a desired shutdown, either by a button, or from a remotely operated script.
Ensure that temperature is going down, by aborting an active print
Schedule a temperature 0 (in case no print was active, but it was e.g. preheating)
Wait till the temperature is lower then 50 C
Schedule a timed power off to the external relay device
shutdown the rpi
The plugin that you pointed out is pretty close and has most building blocks in it, be it there are still pieces missing as far as I can see.
If I take them step by step, in bold the problematic ones:
register shutdown: a button connected to a GPIO.
Script: you can run a python script to make the software believe a GPIO is triggered. - Schedule shutdown: can we abort an octoprint job from the command line? We could abort the whole octoprint, but then we cannot easily monitor the temperture... So it needs to specifically stop streaming print commands.
Schedule the temperature 0: send one Gcode for doing that. - Wait till temperature lower then 50C: the plugin could do that. - Schedule timed out power off to an external relay: your hardwareseems to do exactly that, but it would need to drive a relay.
shutdown rpi: piece of cake, sudo shutdown now
Maybe there is even something closer out there living in the unknown?
This one is tricky because you are powering the pi from the printer's board. I accounted for this in my TPLinkSmartplug plugin by utilizing it's built-in scheduling/timer/countdown functions. I might be able to do the same for a sonoff flashed with Tasmota, assuming Tasmota has that functionality, I'd have to investigate.
That plugin will actually work with a wide variety of devices, as long as their is an API available to use. It's worked with my Tasmota, Domoticz, and TPLinkSmartplug plugins. It was a plugin developed to add additional functionality to the ones I had programmed and then expanded to include generic api/web calls, etc. There's better documentation on the repository's page.
From what I can see in the Tasmota.ino, there is support for a feature called "PULSETIMER", however that allows for switching the relay off after a configured time of switching in on. This might allow for a switch that is regularly on, to send it another "switch on" with pulsed switch off, but I'm guessing here.
Some Tasmota issues request implementation of scheduling, but they are rejected, and are recommended to do from a server.
Other entries suggests there is scheduling functionality now, but I could not find it on their wiki. In the Tasmota.ini there is an interpretation for calender date and time, which indicates some functionality, but that could also be related to MQTT support..
Well... to make a long story short: I found a forgotten Raspberry Pi powered USB-HUB with UPS. It has a 3.7Ah Lipo battery (which was dead now, so I hope it still works). I'll stick the Pi to that hat and then can power off the printer and then take all the time I need to shutdown the Pi...
Indeed, these rules look very promising, more options now then I can implement in a short time. That would then the only thing I now need: a few buckets of time...
Why are you powering your pi from the printer PSU? That is the issue. Move it to it's own quality supply and then you can control everything how you want with relays.
This then is combined with the KASA App and/or the Alexa skill (Echo Dot next to printer) to turn on/off the TP-Link device with voice control.
In turning it off, there's a separate Alexa skill for "shutdown the printer completely" (shutdown OctoPrint) followed by "turn off the 3D printer" to toggle the power.
I participated in this dialog before, and did not want to go the Tasmota route for my Sonoff plugs. Instead of going down that road, I directly implemented *all activities in the plug itself. The plug even shows messages on the LCD, to better understand what (will) happen(s). You find the sketch here: https://github.com/ruedli/OctoPlugout There are also detailed instructions / steps to follow. It will work for any ESP8266 / ESP32 relay, as long as you configure the pins that are used. As provided it supports Sonoff devices.
Thnx for looking into this! I reviewed the links you provided, but have trouble envisioning how to exploit this. In principle I can GET information from the API and also POST data (for shutdown and sending M117 gcode) but I was looking for a way to communicate to my plugin, through gcode.
Currently the plug can be in two modes, “Always on” or “waiting for a started printjob, waiting for it to finish, and waiting for the extruder to be cool down enough”, after which shutdown and delayed poweroff is executed.
I always start in the automated waiting for save shutdown mode.
I would prefer to react to a custom gcode in the printjob, to set the state of the plug in one of these two modes. This allows for better control, I could e.g. then trigger shutdown (only) at the end of the gcode file, or even force a shutdown, even while the printjob is active (hanging mmu at final unload, forcing cool off and shutdown). Does the suggested webhook provide this? Does this require anything in octoprint, or is the webhook sufficient? Let me know more on how you see this implemented.
You choose what happens on the arduino side based on the post data to the rest api. So I would think it would allow you to do what you wanted. You will have to have some form of octoprint plugin to process gcode commands in order to send the post message. That side is trivial for me (ie in tasmota plugin for example) but the arduino side is not. If you can get the arduino side working I can easily put together a plugin for you.