I thought I'd share this with everyone since I think this is a problem we can all relate to. While it would be nice to have a networked PDU, they are quite expensive... even on the used market. So I thought about it and came up with this solution.
I'm sure we all have a rig or two where it may work fine, but every now and then it needs to be rebooted. It always seems to happen at the worst of times... like when you are at work... or out of town. Trying to get your spouse to reset a rig over the phone can sometimes be just as frustrating as when you are away and can't do anything about it.
I also use Awesome Miner, which is fantastic, and can do a lot of automation to keep your rigs running. But if your rigs need a hard reboot, the only real solution is to "pull the plug" and reboot. Awesome Miner has "rules" that you can define to watch for triggers like an offline miner, hashrate thresholds, dead GPUs, and a lot more... and then perform an action. It's kind of like an IFTTT (IF This Then That) solution for mining.
IFTTT... hey wait a minute... I could use the online service IFTTT to control a smart plug. I could have Awesome Miner watch for some condition, then send a signal to IFTTT, where in turn IFTTT could turn off and then on a smart plug.
I started out with a Wemo Insight smart plug that I had laying around, and after a bit of tweaking, I got this working well. The problem is that the Wemo Insight smart plug is only rated for 120V, and all of my miners run off of my 24 amp 220V PDU that I got for real cheap off Ebay. I then trolled around to find some cheaper parts to do a 220V equivalent to the Wemo Insight smart plug.
Puwaha's Poor Man's Networked Power Distribution Unit
(or PPMNPDU... nevermind, that's a bad acronym)
Parts you'll need:
- Cheap 220V PDU from Ebay (I'll let you find these to suit your liking. You could even do this with 120V PDUs)
- Cheapo 240V capable Smart Plugs like these at Amazon (https://www.amazon.com/gp/product/B078CPYQYS/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
) - My PDU uses C14 connectors, and the Smart Plugs are 5-15P, so you'll need some good C14 to 5-15R adaptors like these at Amazon (https://www.amazon.com/gp/product/B004OC579E/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1
- Good quality 5-15P to C13 power cables. These are your regular power cables that come with every power supply you've ever bought... you probably already have a few... so free!
- IFTTT account (it's free)
- Smart phone to setup the smart plugs (Smart Life app, and IFTTT app)... not free, but you probably already have one... so free
- Awesome Miner... it's free for up to two "miners" to give it a go, but easily worth the license cost in other feature you need to cover all your miners
Note: if your setup requires the C14 to 5-15R adapters, do not get the crappy 18AWG 1 foot "monitor extensions".
The wires are not meant to carry high amperage that your rigs usually require.
Now, to put it all together.
First thing, go setup an IFTTT account. You'll need that before integrating with Smart Life.
Let's go ahead and setup your first Smart Plug. If you didn't pick the ones I did above in the Amazon link, just make sure they are compatible with the Smart Life app. This is pretty simple to setup. I suggest you do them one at a time so you can mark them with a pen, and edit the entry in the Smart Life app... like "Plug 1", and "Plug 2".
After setting up the Smart Plug in Smart Life, give it a few whacks to make sure you can turn it off and on. In the Smart Life app go to Profile settings and click Integration. Select IFTTT, and it will give you further instructions on how to integrate. You'll need to sign in using your Smart Life account to integrate. You can either use the IFTTT app on your smartphone, or the IFTTT web page... same results.
It's time to build the first IFTTT applet. Go to your IFTTT app or webpage and click on "My Applets", then "New Applet". You are now going to setup a trigger (the "This" in IFTTT), and then an action (the "That" in IFTTT). Click on the
+this logo... you will need to choose a service. Type
email in the search area and then click on the email logo. Choose the "Send IFTTT an email tagged" option. We want the tagged option, you'll see why in just a second. This trigger will kick off when you send an email to the
[email protected] with the tag that you supply. Our first trigger we will setup will be
#plug1off so put that in the field where it says tag, then click create trigger.
Now, we need to add an action to the applet... so click on the word
+that logo. Now search for Smart Life, and then click the Smart Life icon. You'll see a couple of options to turn a device or group on, and another to turn a device or group off. If you think about that for a moment, you may realize that you can group smart plugs together in the Smart Life app on your phone, so you could control multiple plugs with some of these steps. But for now, we will just finish setting up the applet for our first smart plug. Since our trigger tag was
#plug1off, then we need to click on the option to turn a device off. IFTTT then will present you with your drop down list of Smart Plugs that you setup in the Smart Life app. Since this is our first one, we will select Plug 1 and click the create action button. Finally, click the finish button, and you've just created your first applet in IFTTT! Make sure it's turned on.
Repeat setting up a new applet in IFTTT, use the same trigger of "email" and use a new tag called
#plug1on, and an action from Smart Life to turn on a device or group. Select your Plug 1 device and finish the applet steps.
If you've never used Awesome Miner before, the bare minimums you need here are a pool, a managed miner, and a rig. Once your rig is being controlled by Awesome Miner, you can automate it with a new user-defined rule. There are some built-in rules to give you some ideas of what you can do, but for our networked PDU concept, we will create a new one. First, go into the Options, and under the Rules section go to the Email & SMS section. You'd want to setup your email account here anyway, for notifications from Awesome Miner in general, but the most important part is that you use the
same email account that you used to setup your IFTTT account.
You see, the IFTTT applets you created are expecting an email from your email account. If you use the same email account in Awesome Miner, then when you setup the user-defined rule to send an email... it matches... and the trigger is set.
Now that you have Awesome Miner setup to use your email account, go to the Rules section in the Options in Awesome Miner.
You'll give it a fancy name like
Plug 1 Reset. If you have more than one rig, then click the "only apply to selected miners", and select your rig that will be connected to the Smart Plug. Now, add a trigger for this Awesome Miner rule. If your rig crashes in a way so that it doesn't respond to pings, then make the trigger to be a
Ping (on timeout) function. In my case, I chose to make my trigger "activate" if the rig isn't responding to pings after 9 seconds. There are other triggers you could use, and you can even stack them for different conditions, either selecting the "Match all" (for an AND function), or the "Match at least on" option (for an OR function). Sounds complex? Nah, it's easy.
Finally, you need to set an Action in the Awesome Miner rule. In our case we are going to stack a bunch of functions to be run in sequence. The first action is to send an email to the IFTTT email address (
[email protected]) with a
#plug1off in the subject line. Then I put a Wait action for 10 seconds. Then put another email action to send an email to the IFTTT email address with a
#plug1on in the subject line. Finally, I put 6 individual wait actions for 60 seconds each. It basically runs like this:
If no response from IP address for 9 seconds then
Send and email with #plug1off in the subject line
wait 10 seconds
send another email with #plug1on in the subject line
wait for 60 seconds
wait for 60 seconds
wait for 60 seconds
wait for 60 seconds
wait for 60 seconds
wait for 60 seconds
You need the waits in there between the off and on action to give your rig a chance to fully power down. You also need the waits in there after the turn on action so that your rig has a chance to boot up and start responding to pings again. I put six waits of 60 seconds each which is plenty of time for an SSD rig to boot up and start responding to pings... but it also means that the Awesome Miner rule won't run again for 6 minutes in case something is wrong.
Here's a quick shot of the Awesome Miner rule setup:
If you click the option in the Awesome Miner rule at the bottom to "Support manual activation" then you can run the rule actions at will from the main Awesome Miner mining rig list under the Actions dropdown. And if you have a license that allows a web page interface for Awesome Miner, then you can remotely trigger this rule at will while you are away. That's fine and all... and could be good for getting something unstuck.
The whole point of using Awesome Miner is to allow your rigs to keep mining, and it allows some pretty incredible automation. Couple Awesome Miner's already rich feature set for automation with Smart Plugs and IFTTT and you've got Puwaha's Poor Man's Networked PDU!
There's probably a lot to absorb here, so I'm more than willing to answer any questions or help you out.