Using ESPEasy with OctoPrint

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
dbemowsk
Normal user
Posts: 46
Joined: 06 Aug 2017, 22:27

Using ESPEasy with OctoPrint

#1 Post by dbemowsk » 28 Aug 2023, 08:19

So I wanted to share this trick I did to solve an issue I had. I wanted to control my 3D printer setups through Octoprint using a Sonoff S31 plug with ESPEasy firmware. In searching for some kind of Plugin to control the PSU of my printer, I noticed that there were plugins for many different types of smart plugs. One that I saw was one for Tasmota, but didn't find anything for ESPEasy. I figured out a way to do this using the generic PSU control plugin. First, install the plugin. Then go to settings and select "System Command" for the switching method. Use the URL format shown in this screenshot replacing the IP address of your Sonoff device and the GPIO number to match your smart switch. This should work with any smart plug that has the ESPEasy firmware.
Image

Hope this is helpful to some. If anyone has a more efficient way of doing this I am all ears, but for now this works.

TD-er
Core team member
Posts: 8755
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Using ESPEasy with OctoPrint

#2 Post by TD-er » 28 Aug 2023, 08:27

Cool :)
Only thing I'm a bit worried about is when this Sonoff unit might reboot, then it may toggle the power of the printer.

And just to make it slightly more generic, you could just generate an event and let the rules on the ESPEasy node abstract the knowledge of which GPIO pin to toggle.
For example different kinds of Sonoff units may have different GPIO pins connected to the relais.

So a rules like this:

Code: Select all

on printerOn do
  gpio,12,1
endon

on printerOff do
  gpio,12,0
endon
So the command will be:
event,printerOn
URL:
http://<ip>/tools?cmd=event%2CprinterOn

dbemowsk
Normal user
Posts: 46
Joined: 06 Aug 2017, 22:27

Re: Using ESPEasy with OctoPrint

#3 Post by dbemowsk » 28 Aug 2023, 12:23

Out of curiosity, why would it reboot?

TD-er
Core team member
Posts: 8755
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Using ESPEasy with OctoPrint

#4 Post by TD-er » 28 Aug 2023, 22:14

Crash, bad power supply, run an intensive network scan using nmap to that host...

Sonoff units (especially the older 1M ones) are not known for their stable power supplies.
And if you have a bit "dirty" mains power, those are often the first ones to reboot.

The capacitors Sonoff used to use in these older units are already "just good enough" when they are new, but capacitors can age.

dbemowsk
Normal user
Posts: 46
Joined: 06 Aug 2017, 22:27

Re: Using ESPEasy with OctoPrint

#5 Post by dbemowsk » 30 Aug 2023, 00:45

I have a number of sonoff basic modules that I have been running for a number of years. They are running a super old version of ESP Easy firmware. Not sure what version. Out of the 8 I have had running I have only had issues with 2 of them. I have 2 each in my light/ceiling fan setups. I recently replaced one set with one of the new Sonoff Dual R3 units and will eventually put the Dual R3's in all of my light/fan setups.

TD-er
Core team member
Posts: 8755
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Using ESPEasy with OctoPrint

#6 Post by TD-er » 30 Aug 2023, 10:45

Especially some 'revisions' of the Sonoff Basic are notoriously bad regarding the power supply.
Problem with the Sonoff revisions is that there wasn't a clear cut when they changed something.
So some "original" ones may actually be using more of the same components as the early "r2" versions compared to early "r2" vs. later "r2" units.

The hefty tolerances on capacitors regarding their capacitance isn't also helping here as they may even differ -20% ... +50% and still have the same label on them.
So they may be "just barely good enough" when produced, or still good enough while they degraded to 50% of their original capacitance.

I got the impression their later models were using better designs.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 35 guests