A Cheap Smart Plug To Block Distractions

We have all suffered from this; the boss wants you to compile a report on the number of paper clips and you’re crawling up the wall with boredom, so naturally your mind strays to other things. You check social media, or maybe the news, and before you know it a while has been wasted. [Neil Chen] came up with a solution, to configure a cheap smart plug with a script to block his diversions of choice.

The idea is simple enough, the plug is in an outlet that requires getting up and walking a distance to access, so to flip that switch you’ve really got to want to do it. Behind it lives a Python script that can be found in a Git Hub repository, and that’s it! We like it for its simplicity and ingenuity, though we’d implore any of you to avoid using it to block Hackaday. Some sites are simply too important to avoid!

Of course, if distraction at work is your problem, perhaps you should simply run something without it.

19 thoughts on “A Cheap Smart Plug To Block Distractions

    1. Yeah, this article was really not well explained. It looks like the script runs on your PC, and if it can detect the smart switch, it uses the state of that switch to determine whether or not to block procrastination websites in your hosts file? More information would be helpful, but the original blog post and Github pages aren’t brimming with description either.

    1. No, it is a physical switch that broadcasts a signal when turned on. If your computer picks up that signal, your hosts file is modified to block access to certain domains. You’re supposed to go to the switch and turn it on when you want to work without distractions.

    2. :: snickers :: only if you plug said router into the smart plug’s outlet.

      It’s a clever use of an IoT device, at least. (I have a handful of similar ones running Zigbee radios for things like shop lights and other devices that are tied into my home automation system.)

  1. I love the implication that someone was so distracted by procrastination websites that they decided to fix the problem by writing a bunch of code that surely wasn’t also a form of procrastination.

  2. Douglas Adams said it best:

    ” I am rarely happier than when spending entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand.”

  3. There’s a lot to be said for the power of small inconveniences.

    I know I’ve seen real differences by just refusing to use credit card autofill for certain services where my purchases tend toward the frivolous end of recreational. A nontrivial percentage of the time I just can’t be bothered to go dig out my wallet, so I abandon the cart, and end up never missing whatever was in it.

  4. Not a very clear article, in my opinion.

    Boiling it down, the smart plug is just the trigger here. A python script lives on your computer that polls the state of the smart plug: if on, the hosts file is updated to block a list of URLs; if off, hosts is updated to allow those URLs. Unclear to me (because I don’t know python) is if the script is running as a service that continually polls the smart plug, or if you need to manually run the script. Running as a service would be the best option, if possible.

    This is akin to placing your alarm clock on the other side of the room to force yourself to get out of bed to turn it off. It would be better just to discipline yourself to do the right thing.

  5. These are the same plugs I used to let a live shrimp control my electric wok so it could fry rice. I love how hacky they are. IIRC, they’ve recently upgraded some of the security on them so there is now a second step to discovery when finding them. I actually found someone else’s older one on the network I was working on for that project and may have turned their bedroom lights on and off at 11pm lol.

  6. In the end the user will become proefficent in throwing small projectiles to switch the switch.
    Already did something similar myself quite recently: instead of moving up from a chair to get a notebook (three paces away) out of sleep, i throwed a small printed pamphlet that hit the keyboard and waked it up.
    “Let the lazy find a solution, it would be the simplest”.

Leave a Reply to ShoeCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.