Labels

Sunday, August 30, 2020

IP Power Strip #01 - Some initial considerations

 I started thinking about an IP Power Strip almost 3 years ago in December 2017.  Since that time I have been inundated with work issues and never really came back to this project since I was always tired from work.  Now that I have been having more time at home due to the pandemic, and the fact that I had a power outage in my house that damaged a lot of equipment, I have returned to this project.  I have a definite need to turn a lot of my HomeLab equipment off when I am involved with other things.  I hope to travel and my interests have gone to other things like woodworking and wood carving.  I don't wish to give up the HomeLab completely, but at the same time I would not like to pay the whole bill if it just sits there idle.

First, I rearranged my network for power conservation and opened up a new project for an IP Power Strip.  I am hoping to be able to control the power strip from an MQTT based service.  I figure that if I setup Raspberry Pis with some relay hardware on a hat, then have the controller software running on the RPi interfacing to an MQTT server, I should be able to make this work.

I put in an order for three Keyestudio 5V DCAC 4-Channel Relay Shield Module Expansion Board for Raspberry Pi from Amazon.  I figure the easiest way to develop an IP Power Strip is to use a Raspberry Pi for the "brains" and a shield/hat that has relays on it.  Note that this one has a 10Amp limit on current through the relays.  But, and here is the good thing, individual items that will be controlled don't have anything near the 10A limit.

If I develop the software using a python controller, embedded in a docker container, then updates will become easier and my development environment can move around at will.  There will be two actual containers that do the work: (a) a master controller that does the real thinking concerning sequencing of on-off commands, looking for heartbeats from the slaves, etc. and (b) a slave controller that does the heavy lifting in that it actually turns the relays on and off as well as issues heartbeats, etc.  This should allow me to put as many IP Power Strips around the house that is necessary.  Also, I can issue commands via the home-assistant console.

I was also thinking of a third container that might be useful.  A container, that interfaces to MQTT, that issues heartbeats, and can issue a shutdown command on equipment.  The master controller would then have the ability to issue an mqtt shutdown command, listen for heartbeats, then when the heartbeat ceases, could issue a command to the IP Power Strip to turn off the power to that computer and report back status on the computer.  This has the added thought that it would be universal, working on different operating systems.  The code is pretty much the same, but the implementation is different.