Introduction #
So i ended up buying whats called an UPS. I bought it saturday previous week, not only as a gift to myself for chugging through the exams but also as a good homelab upgrade. Below i will explain more about what a UPS is and why its so handy.
What is a UPS? #
What is a UPS? With UPS i dont mean the US Postal Service, but rather “Uninterruptable PowerSupply”, aka a backup powersource in the event of a power outage. This is not meant as a backup generator or anything (Its not meant to be a emergency powersource so you can keep being in bussines for the whole week), is just meant for events where there is a short poweroutage or if you have a longer poweroutage, that in both cases you can shut down your gear safely and dont loose any data or get hardware failures due to abrupt shutdowns. Servers and primarily the storage drives inside of them dont really like abrupt shutdowns.
In the case of harddrives, when you shut them off abruptly, the read/write heads inside the drive (that normally read data off the platter and move from rest/parked position to over the platter disk) can get stuck and when they get stuck on the platter, thats not good as then the platter cant easily move or they will scratch the platter and thats bad. And you will probably get a ticking drive or a drive that beeps, normally that ticking or beep sound is either the motor not being able to spin the platter or the read heads trying to park themselves onto the rest position. Also dropping your harddrives might cause the heads to get stuck on the playtter so thats why hdds can be very fragile. Tons of moving parts and precisions of a few millimeters.
In the case of SSD’s, in the event of an abrupt powerdown it can cause corruption as the data could not be fully written or can cause bitflips or other things. And usually the Operating System of a server constantly writes logs or data and that can get corrupted if it cant finish what it was writing to the drive.
So in short its so you can safely and grdually take systems offline in a power outage without loosing your data or damaging anything.
Why did i buy a UPS? #
I live in the Netherlands and at our place, our power net is quite stable and we never really had a major outage or even a short outage, but i do want to protect my homelab in the case of a powerdip or stuff like maintenance off the local street power distribution box and other factors. Also we did once have a power outage at home but it happened when we switched on the garden lights after a rainy week and that caused the RCD to trip. I did then already have a Homelab (albeight it was a very small one with only a NAS at that point), but i was lucky that after the accidental RCD trip that the NAS i had at that time was fine, but it was always a worry i had.
Also because i did upgrade my hardware some time ago and got some refurbished 2Tb enterprise SAS harddrives, i want to protect the new NAS against power outages as these HDD’s are not cheap and i do have sensitive/important data on my NAS like passwords, authentication keys, personal backups and photos and media which i dont want to loose. I do have redunancy but still i dont want to risk a poweroutage corrupting/damaging stuff or the ZFS pool. I’d rather shut down my systems graudally then just yank the plug.
What UPS did i buy? #
So i bought a UPS from Marktplaats (a dutch marketplace/online market platform kind of like ebay). I was searching for UPS’es and quickly found a listing for a Energenie EG-UPS0-1000 UPS that was full sinewave and i could buy from a reputable seller for 60 Euro which i call quite a steal! I did have to consider stuff like VA and wattage first. I went with a 900W UPS which should be plenty for my homelab and all servers i want to protect and i went with 1000VA which should be enough runtime as a higher VA value means longer runtime off battery.
USB/Serial connection for monitoring #
Also i wanted a UPS with a USB/serial connection so i can monitor it from a computer and see statistics and data about wattag, load, battery voltage/health, input voltage, frequency, etc etc.
Online VS Offline #
It is a Online UPS, which means it is always running. You also have Offline UPS units which basically only start running when there is a power outage. This does mean that you have 0 transition time between net and battery inverter power, but this switching time is minimised in most cases if you buy a offline UPS. This online UPS is thus always working so there is an active fan inside which i can hear a bit but i will get used to it and its comparable to the noise my NAS makes with all fans and hdds inside so i dont mind it lol!
Why Pure sinewave? #
So i bought a pure sinewave output UPS. I bought it as some (cheaper/crappier) UPS units output whats called a modified sinewave or a stepped sinewave. Basically it will be more a square/blocky wave instead of a smooth sinewave. The net outputs a pure sinewave of 50Hz and it is compatible with everything and everything can work with it, this is not the case for a modified sinewave. Some powersupplies of devices have whats called Power factor correction circuitry (PFC), you dont have to know what that is but it does not really work nicely with a modified sinewave and in some cases a modified sinewave can damage devices that expect a pure smooth sinewave like pc powersupplies that are inside my servers. Modified sinewaves are easier to create but they can be harmfull and thats why they are found in cheaper UPS devices. Pure sinewaves are much more difficult to create and thus only the higher end UPS units output them, while it is the cleanest power output.
Modified sinewaves are easier to create as usually its just a H-bridge or Half bridge that switches a transformer so you get a rough blocky sinewave output as those transistors can often only switch on and off and thus you get high, low, high, low which creates a blocky wave. Pure sinewaves often use way more circuitry and complex circuitry to perfectly create the smooth sinewaves and to fullfill the parabole stuff nicely.
Anyways, this UPS seems to be the best balance in cost and features. I am sure there are better rbands but better brands also equals more money and for 60 euro i cant dislike this purchase.
I Bought yet another UPS #
SO i also ended up buying a APC smart UPS-1000 as it was 40 euro and i have a hole in my hand when it comes to money, but it is worth it i think. I also want to protect my Opnsense firewall/router and possible other network gear which is plugged into another socket on the other side of my room and i dont want to run cables through the whole room (I already do with the ethernet cable going to the WAN but lets nott alk about that) and then i can have the network stuff on its own isolated UPS circuit. That one did have bad batteries so i need to change those when i get it. I was supposed to get both today but PostNL had a bit of delay (The other shipped with DHL, so that one did arrive in time) so i hope it comes tomorrow but they dont yet have given a time or such.
The APC one is an offline UPS and thus its also silent in operation until a poweroutage occurs. But its also a 1000VA UPS and provides a pure sinewave.
Connecting #
So the energenie UPS has a single EU socket output and other than that provides 3 IEC outputs. The APC only provides IEC outputs but it is 8 ports. As said, the UPS can be monitored over USB and both have USB and or serial.
Optional monitoring card #
SO both UPS’es and most high end UPS units have whats called a Smart port or something along those lines. Thats basically a interface/space you can plug an external module into to monitor and control the UPS ove the network. This module is always some embedded linux powered compute module with the UPS monitoring software installed on it and its sometimes provided by the vendor as a addon card. It can be compared to the LOM (Lights Out Management) card in some servers, but its used for the UPS. I Dont have this card but i can always buy one or i heard there is an opensource project to build your own but for now a USB cable works fine and then i dont have to occupy 2 ports on my network switch which is already getting full (Maybe i should buy a new network switch with 24 ports or so). But it is a future posibility.
Integration into Homeassistant #
SO i also wanted to have it so i can monitor it from my Homeassistant dashboard which is really nice. I know homeassistant has the ability to work as a NUT server (Network-Ups-Toolkit) and HA has a NUT integration, so i wil use that. Setting it up is not hard!
Application/server #
First you need to go to the apps section in Homeassistant and search up NUT into the search bar. Then you can download and install it as a application inside homeassistant. Then you need to configure it, so go to the NUT integration and click on the ‘Configuration’ tab. I like to edit it in YAML so i will do that as its easier to define parameters and its not really ultra high level code. First you need to add a user, i simply put in the stuff down below but you can change itt o whatever you want, just make sure to leave the skeleton/template the same.
users:
- username: Energenie
password: users_server_password
instcmds:
- all
actions: []Then i had to add my UPS, i recommend going to This official website which lists some well known UPS models and there needed configurations. Sadly they did not have my configuration, so i had to do some trial and error, but from running ’lsusb’ in the terminal of my mini pc i run ha on, i could see that my UPS contained a MEC0003 chip from Fry’s electronics. SO i came up with the configuration down below. I crafted it together from the official documentation and some online searches. Yours might be different/have a different interface chip so just try it out a bit, but if you have the same UPS or a similar one, my template below might work.
devices:
- name: Energenie-Ups0-1000
driver: nutdrv_qx
port: auto
config:
- protocol = hunnox
- subdriver = hunnox
- vendorid = 0001
- productid = 0000
- product=MEC0003
- langid_fix=0x040
- noscanlangid
- norating
- novendor
- battery_voltage_reports_one_pack
- override.battery.packs = 12
- override.battery.voltage.nominal = 24Also change the battery pack values if needed. Then i added a final configuration down below for the server settings.
mode: netserver
shutdown_host: false
list_usb_devices: trueFor now i dont need shutdown_host functions so i left that off. After thats done, click ‘start’ to start the Application container and the server should be running, otherwise see logs.
Integration #
So now you need to add the integration into homeassistant. Go to “Devices & Services” and click ‘Add integration’. Then search up ‘NUT’ again. Then you should see a menu, inside of that you need to put in the hostname of the nut server and then the username you set and password you set. Then simply click ‘Submit’ and it should be added. If not, check your filled in credentials. Then you can finally see the battery charge, input voltage, freuency, load wattage and output voltage and status. Under ‘Diagnostic’ you can also enable other disabled features by enabeling them.
Signing off #
SO i will test it for a bit now with purely the proxmox server plugged in and later i will plug in the nas ans other important systems but i probably will do that after a room cleanup as my room is quite messy and dusty and every 6 months i do whats called a grand cleanup, where i wil remove everything from my room (also hardware) and then dust and clean everything off and then after, place back everything and reconnect my servers and networking. The UPS does seem to work nicely and has not yet caught fire (joke).