[HN Gopher] DIY out-of-band management: remote power button
       ___________________________________________________________________
        
       DIY out-of-band management: remote power button
        
       Author : secure
       Score  : 119 points
       Date   : 2022-10-09 14:33 UTC (8 hours ago)
        
 (HTM) web link (michael.stapelberg.ch)
 (TXT) w3m dump (michael.stapelberg.ch)
        
       | sebazzz wrote:
       | Keeping wake on LAN on will likely use less power than this ESP32
       | solution.
        
       | phoronixrly wrote:
       | I know that HN is crazy about their homelab setups, but please
       | consider whether having a rats nest of jumpers and a breadboard
       | in your comms cabinet is reliable, let alone safe... How about a
       | tweak to the BIOS to auto turn on power, then plug it into a
       | Shelly Plug running Tasmota? You get your remote turn-on, you get
       | a tested, reliable, and safe solution, and you get power use
       | monitoring on top of that.
       | 
       | The difference in price is ~ 10 eur where I'm at, and I'm not
       | including the rest of the BOM of OP:
       | 
       | Shelly Plug S: EUR 25
       | 
       | NodeMCU: EUR 12.5 Breadboard: EUR 3
        
         | shiftpgdn wrote:
         | Keep in mind a lot of smart plugs have remarkably low amperage
         | limits.
        
         | secure wrote:
         | A smart plug would probably work just as well for most cases,
         | but one downside is that you need to ensure your computer is
         | safely powered off before turning off the smart plug.
         | 
         | Conceptually, pressing the power button seems a little cleaner
         | to me, and also works well with suspend-to-ram (what I
         | originally wanted to do), which the smart plug can't do.
         | 
         | I'm not too concerned with safety -- we're talking about 3.3V
         | (signal) and 5V (power) here.
        
           | phoronixrly wrote:
           | You shut down your computer the usual way, from the OS, then
           | toggle the plug to restart it. In case the system hangs
           | during shut down, you'd actually want to know that it's
           | hanging, which you can actually see in the power readings of
           | the plug.
           | 
           | > I'm not too concerned with safety
           | 
           | I'm sorry to state that, but that much is evident from the
           | photos in the blog post (assuming you're author here). While
           | the voltages may look safe to you, the whole contraption is
           | safe just until something goes wrong. Examples:
           | 
           | 1. You push around a dangling wire and short out a more
           | powerful circuit.
           | 
           | 2. Something on your _dev_ board for _development purposes_
           | releases the grey smoke. 500mA at 5v may seem low to you, but
           | under the right circumstances might cause a fire. I don 't
           | see any fuses or other overcurrent protection in your
           | schematic.
           | 
           | 3. Your mainboard gives a defect and runs more that the
           | expected voltages/currents to your dev board. God forbid AC
           | from something else faulty in the electric installation (just
           | saying because I've been zapped from touching the _outside_
           | of a closed case).
           | 
           | 4. Power surges, lightning strikes... Static electricity
           | even...
        
           | KMnO4 wrote:
           | Many smart plugs have some sort of energy monitor built in. I
           | imagine you could turn off the plug when the power dropped
           | below, eg, 5W.
        
       | bennyp101 wrote:
       | We have a couple of sms enabled plugs for some remote places,
       | worst comes to it we can send a txt and power cycle the devices
        
       | rektide wrote:
       | Crazy good ESPHome story here!
       | 
       | > _I wanted a quick solution (with ideally no custom firmware
       | development) and was already familiar with ESPHome, which turns
       | out to very easily implement the functionality I wanted :)_
       | 
       | > _In addition to a standard ESPHome configuration, I have added
       | the following lines to make the GPIO pin available through MQTT,
       | and make it a momentary switch instead of a toggle switch, so
       | that it briefly presses the power button and doesn't hold the
       | power button:_
       | 
       | Really simple looking understandable yaml.file constitutes almost
       | all the softwafe development done for this project. Stunning.
       | Nice.
        
       | lloydatkinson wrote:
       | A mosfet seems pretty overkill for this instead of practically
       | any cheaper transistor unless there's something about motherboard
       | headers I don't know. Pretty cool though.
        
         | dekhn wrote:
         | Why is the transistor needed at all? Does the current to turn
         | on/off the machine exceed the ESP32's pins?
        
           | jstanley wrote:
           | Because you need to act like a switch.
        
             | numpad0 wrote:
             | > void setup(){ pinMode(PWRBTN, INPUT); }
             | 
             | > void press(){ digitalWrite(PWRBTN, HIGH); delay(33);
             | digitalWrite(PWRBTN, LOW); delay(33); digitalWrite(PWRBTN,
             | HIGH); }
             | 
             | My 5min hack would look like this - and optionally a 0.1uF
             | and a 1k resistor for peace of mind - totally untested
             | though. Usually a uC I/O pin has three states; output high,
             | output low and Hi-Z. Hi-Z is high-impedance or extremely
             | high resistance state, analogous to an open circuit.
        
             | dekhn wrote:
             | I mean, you can use a GPIO on a microcontroller as a switch
             | if the current is small enough... this device is not
             | directly in the path of 120V, it's just twiddling a GPIO on
             | the motherboard... right?
        
         | secure wrote:
         | Cheaper transistors should totally work, as I tried to describe
         | in the article.
         | 
         | I had this particular MOSFET lying around from a different
         | project, so that's the main reason I chose that one :)
        
           | sokoloff wrote:
           | It's also only $0.46 in singles at DigiKey, so hardly
           | something crazy wasteful in any event.
        
             | folmar wrote:
             | A no-thrills transistor would be some 2 cents, so 20 times
             | cheaper on the other hand.
        
               | sokoloff wrote:
               | I wasn't able to locate any suitable BJTs around $0.02 in
               | single qty at DigiKey.
        
       | someperson wrote:
       | Nit: Please hyphenate "out-of-band". That's how it's usually
       | written, and it's much more readable.
        
         | secure wrote:
         | Now hyphenated, thanks for the hint
        
       | pmontra wrote:
       | Great project but a little too much for the ones of us with only
       | software development skills.
       | 
       | I use smart plugs over Wi-Fi to do that. Shelly Plug S have a
       | small physical button, a web app, a HTTP URL to call to switch
       | the plug on or off. They also have a lot of features that I don't
       | need. Among them MQTT and Alexa/Google integrations. A few bash
       | scripts with curl and I can do everything I need. The price is
       | reasonable and they saved me a lot of time.
        
         | hashworks wrote:
         | This. Most mainboards can be configured to boot the moment they
         | receive power, no need for a power button.
         | 
         | It's also worth noting that any internet integration can be
         | disabled on all Shelly devices.
        
         | d0gsg0w00f wrote:
         | Agreed. The Shelly looks to be targeted at EU markets. I
         | suppose the more American equivalent would be something like a
         | Meross
         | 
         | Meross Smart Plug Mini https://a.co/d/ey2LJcb
        
         | mkup wrote:
         | I use a couple of Ewelink devices (hardware-equivalent Chinese
         | clone of Sonoff S20 from AliExpress), reflashed with open
         | source Tasmota firmware for the same purpose: remotely
         | controlled power socket, with physical button, connected to
         | WiFi, with HTTP web page and REST API for curl etc, firmware
         | has MQTT support too; I have no idea about Alexa/Google
         | integrations (likewise, I'm not interested in this feature),
         | but the price is bargain, $10/each. Sonoff S26 clones are good
         | for this purpose too, but UART port is easier to solder on S20
         | (larger one). Soldering UART port is necessary for reflashing
         | to Tasmota, because stock firmware is utter crap.
        
           | 867-5309 wrote:
           | how do you feel about leaving "Chinese clone" devices plugged
           | in 24/7? do the plugs have a ground pin? do they get hot? do
           | they have CE certification? genuinely interested in this
           | setup and don't answer if too prying. thanks
        
         | denkmoon wrote:
         | It's 3 components, a bread board and some wire. I would
         | encourage any "software only" people to give it a go :) The
         | software side (MQTT, ESPHome, Docker) of this is far more
         | complex than setting up the hardware.
        
         | somehnguy wrote:
         | Hardware can be a fun change of pace if you're willing to try.
         | A lot of stuff is pretty safe as long as you follow basic
         | precautions.
         | 
         | I built my own remote garage door opener with an esp32, relay,
         | and Amazon dash button. Took a bit to get working but super
         | satisfying when you do :)
        
       | NoraCodes wrote:
       | This is a neat writeup. I think the ESP32, alongside similar
       | microcontrollers that tie communication via complex protocols so
       | close to direct interaction with the physical world for such a
       | small energy cost, are really amazing for teaching, inspiring,
       | and empowering otherwise "non-technical" people. Of course, you
       | do have to be able to program, but I think we're making great
       | strides in making that as easy as possible with things like
       | CircuitPython and EduBlocks.
       | 
       | Also, this kind of shocked me:
       | 
       | > none of my followers had ever seen functioning WOL on any 10
       | Gbit/s card.
       | 
       | Those cards are _way too expensive_ to be lacking such a useful
       | feature!
        
         | sokoloff wrote:
         | It seems likely that most existing deployments of 10Gbps cards
         | are into a machine that has an alternative management card
         | (which has no reason to be 10Gbps-capable).
         | 
         | I don't need to WoL via my 10Gbps card near as much as I need
         | WoL on the management interface.
        
           | NoraCodes wrote:
           | That makes sense, I suppose! Maybe if/when 10Gbps becomes
           | more popular with consumers such highly integrated cards will
           | come onto the market.
        
             | InvaderFizz wrote:
             | Unfortunately, at the current adoption rate, that will be
             | sometime after 2040.
        
             | secure wrote:
             | We're already starting to see 2.5 Gbps interfaces become
             | more and more popular on mainboards, so I suspect once 10
             | Gbps interfaces become more common on high-end mainboards,
             | vendors will start caring about WOL with these chips :)
        
       | skocznymroczny wrote:
       | At my workplace we had a farm of laptop machines and we weren't
       | allowed to disassemble them to pull any power wires out. What we
       | ended up using was a remotely controlled motor with a small
       | plastic "finger" attached that would press on the power button
       | for n seconds, depress, wait few seconds, then press it for n
       | seconds again to do remote hard reboots.
        
         | gw99 wrote:
         | Found a similar rig set up years ago. The old Tektronix TDS
         | scopes used to lock up in a go/no go test rig and stop
         | responding to GPIB commands. Someone unknown got fed up of it
         | so they wired a relay in a box up as an inline switch for the
         | scope power and drove it from a spare port in a GPIB switch box
         | that the test script talked to. This turned the scope on and
         | off again before each test cycle so it was less likely to
         | crash. This saved hours and hours of failed test runs.
        
         | matja wrote:
         | Had a secure server room with a maglock with very few
         | cardholders and forgot our cards a few times. We wired-up a CD-
         | ROM drive to a server positioned so that it pressed the door
         | unlock button on the wall when it was ejected, so someone could
         | ssh in to the server and "eject /dev/sr0" to get in.
        
           | teddyh wrote:
           | https://thedailywtf.com/articles/ITAPPMONROBOT
        
         | jvanderbot wrote:
         | You're kidding me.
         | 
         | It's exactly the role of this robot in Wall-E:
         | https://old.reddit.com/r/MovieDetails/comments/h7r2f2/when_w...
        
           | tbyehl wrote:
           | https://us.switch-bot.com/pages/switchbot-bot
        
         | wpietri wrote:
         | That is awesome and I'm glad somebody did it. But was there
         | some reason not to just pull the laptop batteries and use
         | normal remote-controllable outlets?
        
       | tbyehl wrote:
       | 15-20 years ago if you were using a cheap dedicated hosting
       | company that stacked "servers" in desktop cases on wire racks and
       | somehow offered instant remote reboots despite clearly being too
       | cheap to buy switched PDUs, they were doing something just like
       | this.
        
       | JonChesterfield wrote:
       | I want this feature. Power cycle a machine from somewhere else.
       | The smart PDU strips are suspiciously complicated and expensive
       | enough that I don't want to discover I bought an unreliable one.
       | 
       | Current thinking is a relay held open by power over ethernet and
       | toggle the switch port to reboot it, but I don't quite have the
       | nerve to solder the relay myself. I can't deal with a
       | dead/crashed switch remotely anyway.
        
       | watermelon0 wrote:
       | If this is something permanent (and needs to be reliable), I'd
       | advise the author to move it to perfboard/veroboard.
        
       | joezydeco wrote:
       | The more I work with MQTT the more I enjoy it. It's just enough
       | protocol to get the job done without overcomplicating things.
       | Nice work.
        
       ___________________________________________________________________
       (page generated 2022-10-09 23:00 UTC)