Close
0%
0%

Wol Control

A flask based power controller based on timofurrer's WOL

Public Chat
Similar projects worth following
This is a web based power controller for computer on a local network. It uses the Wake On Lan (WOL) standard to turn on devices remotely, and bash scripts to turn them off. It'd only work with devices that support WOL and the execution of commands over SSH.

First I think it's best to get this out of the way:
DO NOT use this on a production environment or anywhere security is a big concern. I wrote this application with the sole purpose of running it on an isolated network with some media servers on it.

I know this may sound like the code is terrible, or at the very least, a big budge. And that's because that's exactly what it is. I wrote this as a weekend project (although I've been thinking about making something similar for quite some time now) and I only now I thought about sharing with other people.

As of today (12/01/2020), it's missing quite a lot of features that I should have probably implemented by now (access logs, the ability to add/remove/edit users from the interface itself, comments...) but I might get around adding them later this week.

I made this because I have some computers at home that I constantly (and by that I mean at least once every day), but that I cannot leave turned on because, A, they're incredibly loud at night, and B, I don't feel like throwing my savings out the window paying electricity bills. Since none of them are connected to the internet, and they really shouldn't be at any time, I figure it'd be nice if I didn't need to go down stairs to my basement every time I needed to turn them on. Which lead us to where I am now.

I made some Flask applications in the past (a REST API and a couple of websites), so doing this wasn't much of an issue. I did wanted to make my own implementation of the Wake On Lan standard, but honestly, WOL works pretty well and is brain-dead easy to set up, so I ended up using it. I'm well aware that there are probably dozens of different solutions to this exact same issue I had, all of which probably work a heck of a lot better than this bare-bones hack of mine, but in the end, this was a fun project to make, and I does what I need it to do. 

Regardless, feel free to let me know about your feedback in the comments, and who knows, I might even work on this more and possibly even turn it into a real project.




wol_control-master.zip

Source code for wol control

Zip Archive - 13.75 kB - 01/13/2020 at 01:40

Download

  • 1 × Computer running Linux Evaluation, Demonstration Kits, Boards and Modules / Evaluation Kits, Boards and Modules

View project log

  • 1
    Clone the repository

    First, you'd need to clone this repository on the server where you'd like to install it. You can do so by using the following command:

    git clone https://github.com/TheLastBilly/wol_control
    
  • 2
    Set up a python virtual environment

    Now that the repository is cloned, the next thing you'd like to do is to install virtualenv using pip. We're using a virtual environment for Wol Control to avoid conflicts with currently installed modules on your machine. You can skip this part if you want, but I don't recommend it.

    python3 -m pip install --user virtualenv
    

    This will install virtualenv for your current user (no need for sudo).

    Next you'll have to create a python virtual environment and install all the necessary python dependencies on it. In order to do so, use the following commands:

    Make sure to move to the repository's directory first.

    python3 -m virtualenv ~/.wol_control_env
    

    This command will create a virtual environment on your home directory (~/) named wol_control_env. The . is used to make this a hidden folder so you wouldn't normally see it unless you actively look for it. Regardless, you can name it however you want.

    source ~/.wol_control_env/bin/activate
    python3 -m pip install -r requirements.txt
    

    The first command will active your virtual environment and the second one will install all of the dependencies listed on the requirements.txt file.

  • 3
    Set up Wol Control's databse and code

    Now that all the necessary dependencies have been installed, you can now set-up Wol Control's database, create new users and add devices.

    First things first, initialize a new database using the init_db.py script:

    python3 init_db.py
    

    Create a new user and add some devices using the manage_users.py and manage_devices.py scripts respectively:

    python3 manage_users.py
    python3 manage_devices.py
    

    And finally, go to the wol_control/main.py file and set the remote_user variable to the username that you'll use to shut down remote computers with over SSH (more on that later).

View all 7 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates