IKEA Server / Comms Cabinet

Hello!

I have had for the last few years, a growing pile of electronics that I called my homelab. It looked a bit sad.

This was it recently…
This was back in 2017 😭🙃

I decided recently that it really deserved some love, and it’s really very rewarding to put in a bit of effort for something that looks good.

So I started looking into ideas on how to clean it up.

Initially I was planning on getting either a 9u or 12u rack/cabinet, and just leaving it in the same place. But as much as I love my servers and gadgets, I don’t think a black metal box in the living room/ kitchen looks great to guests. So I figured I should try something that looks better.

An IKEA lack was off the table, as it’s much too large for something up against the wall in my opinion, so I browsed the website for a while until I came across the TRYSIL. It’s a chest of r draws, that extends a mere 40cm from front to back. Perfect for up against the wall! And at only $129, it was just $4.05 more expensive than a 9u rack.

So I ordered one and picked it up Friday night. Assembly was pretty straightforward, just follow the pictures as you would expect. But what I didn’t do was install the bottom two draws, I left that section completely open.

I purchased two metal strips for.the hardware for about $0.80 each, and laid the two draw fronts together about the correct spacing apart, and bolted them together using the metal strips.

I then measured out and attached two butt hinfes ($4.95 for the pair) to the new door and cabinet.

I had this wall-mount server rack thing left over from a previous intention to wall mount my servers in the garage, and flipping it on its side gave me a perfect 3u mounting space.

I used M5 bolts and some washers to secure it in place, and it’s not going ANYWHERE.

This fits really well, leaving a bit of space on either side for cable management and other things.

I then test fit a PowerPoint art he back and started on my way to cutting out a hole in the base to mount a pair of 200mm fans for airflow.

In Australia you can’t do mains voltage work without a license, so I called over a sparky friend do wire things up for me.

I went out to my local Jaycar to pickup a few things I would need, and while I was there I found a 4 Port USB outlet for only $15! I grabbed this and a mounting box for it as well, this will be useful for odd things like an esp8266 to monitor temperature and drive LEDs, and the Mi-Light wifi bridge.

Now that sparky mate has installed those for me I went back to working on cutting out my hole for the fans. I probably could have cut it out before assembly but I was in the mood to get things done in one day so I didn’t want to trek out to Robots and Dinosaurs with some wood to cut out using their tools!

I cut a hole on the upper left side for a cable feed hole for ethernet connectivity, but I’m thinking I’ll replace this with a 6 way Keystone plate to keep the cabinet modular. I want to move the nbn cable NTD into the roof, so that rather than an RG-6 cable to deal with I just have CAT6…

I also got an IEC socket installed on the back to be fed from the external UPS which is too large to fit inside, this also means it’s relatively simple to unplug and move should I have to do that.

Once I had the holes cut out to my satisfaction, keeping in mind that they won’t really be seen so I wasn’t too fussed, I used cable ties to hold the two 200mm fans together, and screwed them into the underside of the cabinet over the hole.

Oh I also attached the $2.95 magnetic latch you see here.

Once I had mounted and wired up my fans, it was time to start moving my network hardware over.

I started with the switch as it will serve as the shelf for the other hardware. (don’t worry it’s properly bolted in)

I then installed the power distribution bar, NTD and pfsense router. I blacked out the pfsense because it’s a surprise for another post soon.

I affixed the Mi-Light bridge and zigbee2mqtt devices using command Velcro, and screwed in a fan controller harvested from the same PC the fans came from.

I began to test fit the various power supplies inside, there’s a few because I’m using micro PC’s as servers… I’m considering consolidating the Synology units into a single 150w PSU though.

I test fit and began cabling everything in, I have ordered a brushed 1u panel to clean up the wiring a bit more but it will be a few weeks from china.

Once everything was in, I did a final test to make sure I was happy with the airflow and the path the air seems to be taking through the cabinet, which will improve after I install the brushed plate and a blank panel.

With ally tests done and happy, I hooked up the ups and turned on all the servers one after another. I monitored them as they came back online to ensure all VMs and services started correctly, and so far only Wireguard refuses to start! 🙁

Good enough for me!

And with that the move was virtually complete!

I have since added some lights, and a DHT22 temp/humidity sensor inside to keep track of how it’s going, but temps so far seem very acceptable.

The 120mm fans bolted directly to the cabinet are audible so I would like to replace them with noctuas, mounted via rubber or foam dampeners.

Overall I’m super happy with how it turned out, everything fit perfectly, it was fun to work on and build, it looks so much better than an ominous pile of electronics next to the kitchen and dust will hopefully be a bit less an issue now!

Best of all, it looks nothing like a server cabinet!

Updating my last Arduino based ESP to ESPHome

I have most of my ESP based IoT devices running ESPHome by now, but there was one left that I hadn’t spent the time figuring out how to adapt.

That was the one that lives inside my wall, and opens the buildings door by shorting two contacts on the intercom system.

My requirements for this were backwards compatibility so that my scripts and automations that were setup to control the door via MQTT could still function, this way I can continue to operate as normal but with the addition of OTA updates and telemetry from the node thats hardest to reach!

The original code involved subscribing to a topic, and waiting for a payload, then turning the relay on and then off again, for a momentary press.

#include <ESP8266WiFi.h>
#include <PubSubClient.h>

#define CLIENT_ID "buildingdoor-singlerelay"

#define RELAY_PIN 0


// Update these with values suitable for your network.
const char* ssid = "WiFiSSID";
const char* password = "WiFiPassword";
const char* mqtt_server = "MQTTServerIP";

WiFiClient espClient;
PubSubClient client(espClient);
long lastMsg = 0;

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(RELAY_PIN, OUTPUT);
  Serial.begin(115200);
  setup_wifi(); 
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
  digitalWrite(RELAY_PIN, HIGH);
  pinMode(D3, OUTPUT);
  pinMode(D1, OUTPUT);
  digitalWrite(D1, LOW);
}

void setup_wifi() {
  delay(10);
  // We start by connecting to a WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid); //We don't want the ESP to act as an AP
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();

  // Switch on the LED if an 1 was received as first character
  if ((char)payload[0] == '1') {
    client.publish("building/door/relay", "1");
    delay(100);
    digitalWrite(RELAY_PIN, LOW);
    delay(200);
    digitalWrite(RELAY_PIN, HIGH);
  }  } else {
    digitalWrite(RELAY_PIN, HIGH);
    delay(100);
    client.publish("building/door/relay", "0");
  }

}

void reconnect() {
  // Loop until we're reconnected
  digitalWrite(LED_BUILTIN, LOW);
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect(CLIENT_ID)) {
      Serial.println("connected");
      client.subscribe("building/door/relay/set");
      digitalWrite(LED_BUILTIN, HIGH);
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

void loop()
{
  if (!client.connected()) {
    reconnect();
  }
  client.loop();
}

The new ESPHome code, does this, in addition to supporting the Home Assistant API and reporting back some values such as the WiFi Signal Strength!

esphome:
  name: buildingdoor
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: 'WiFiSSID'
  password: 'WiFiPassword'
  domain: .local
  fast_connect: true
  manual_ip:
    static_ip: 172.16.0.XX
    gateway: 172.16.0.1
    subnet: 255.255.255.0
mqtt:
  broker: 172.16.0.XX
  username: MQTTUsername
#  password: MyMQTTPassword
  on_message:
    topic: building/door/relay/set
    then:
      - switch.turn_on: building_door_switch
api:

# Enable logging
logger:

ota:

switch:
  - platform: gpio
    pin:
      number: 0
      inverted: yes
    icon: "mdi:office-building"
    name: "Building Door Open Switch"
    id: building_door_switch
    retain: false
    discovery: false
    availability:
      topic: building/door/status
      payload_available: online
      payload_not_available: offline
    state_topic: building/door/relay
    command_topic: building/door/relay/set
    on_turn_on:
    - logger.log: "Building Door Relay Activated!"
    - delay: 0.2s
    - switch.turn_off: building_door_switch
    on_turn_off:
    - logger.log: "Building Door Relay Deactivated!"

sensor:
  - platform: wifi_signal
    name: "Building Door WiFi Signal"
    update_interval: 60s
text_sensor:
  - platform: wifi_info
    ip_address:
      name: Building Door ESP IP Address
    ssid:
      name: Building Door ESP Connected SSID
    bssid:
      name: Building Door ESP Connected BSSID

I first connected it externally next to the wall, and listened to hear that they indeed, both fired when they were supposed to, and once confirmed, I opened up the wall, switched out the ESP-01S modules and closed it all back up!