I always wondered how much power my desktop computer draws. The 750W PSU can draw a lot in theory, but for most of the time, the PC is idling at 20% CPU use. There is more than one reason for using NETIO Power Cable 101x for that, unlike Sonoff POWR2, the unit already comes with C-14 (PSU cable), it’s sturdy, and there is no need to flash custom software.
NETIO Power Cables
NETIO products come in many shapes, but I got the PC cable for 2 reasons:
- toggling power ON|OFF
- monitoring power use
You could achieve this with a Sonoff POW R2, but NETIO power cables come with a protected button toggle, which is hard to toggle accidentally. You need a pin, and 3 presses to change the state. The company clearly wants to reduce the danger of that to zero.
I picked the NETIO Power Cable REST 101x as I wanted to submit the data to my NodeRED server via HTTP requests. The API is well documented and it’s very easy to work with.
NETIO power cables come with a basic GUI hosted at port 80, but for the most part, you will interact with the cable via API. I took a couple of screenshots to show you what’s available.
The data can be transferred via JSON, XML and URL. I’m dealing with NodeRED, JSON would be the perfect fit. Here is the data structure:
You will notice that my PC dashboard displays more details than what’s available via NETIO Power Cables. I took advantage of my previous projects (Washing Machine Notifications & Mobile Notifications for 3D Printers) to calculate the power used by my computer and the costs associated with it.
By default, I pull the data every 10 seconds, but the script is modified to support custom refresh rates. Make sure to preserve the NodeRED variables so the values wouldn’t be lost on NodeRED restart.
Every 10 seconds
An HTTP GET request is sent to NETIO Power Cable. To make my life easier, I decided to store all values in flow variables. Based on the current load
TotalLoad I update the main button on my dashboard (more about it here) and push correct values to display the data in the chart. (more about it here).
Then, a function node
Calculate All takes care of all the values for me. These are split into three categories:
Total Watts used are taken directly from the NETIO Power Cable (
TotalEnergy). To get a daily breakdown, I could save the value every 24h and do some easy maths, but I wanted the power use per day to be available constantly.
I split this into 3 measurements:
- per hour (Watts used in 10-sec increments)
- per day (Watts from each hour and the current hour)
- per week (Watts saved after each 24h period)
This way the correct power will be displayed on your dashboard. To calculate how much power had been used, simply use:
var houruse = ((totalload/3600)*refresh);
Calculating uptime was actually very simple, for every 10 seconds passed (update) I would add +10 to both arrays
The daily value would be reset every 24h. To display the value in a more human format I used the scripts to calculate Seconds to DD:HH:MM:SS, it's a very good reddit collaboration where we came up with neat solutions to leading zeros and other problems.
Since I know how much I pay for kWh, I can estimate the cost of running my PC. Both calculations are simple once you have the total energy used. If you have 2 power tariffs, you will need to take a look at the Mobile Notifications for 3D printers to introduce multiple tariffs into your schedule.
Bear in mind that I'm using my credential system to store the important values in global variables and distribute them to other devices.
Every hour, NodeRED collects the power used in the last hour and pushes that data to the
TotalUseByHour array. The
AverageUsePerHour is cleared and ready to collect new power information.
Every 24h values stored in the
TotalUseByHour array are added together and pushed to the
TotalUseByDay array. This array will hold the last 7 days of data so I could display it on the dashboard chart as well.
The hour details are cleared at midnight, and the 8th day is removed from the array so the chart consists of the weekly breakdown only.
Instead of multiple buttons, I opted out for a single one which changes ist behaviour based on the power use. The button can:
- put PC to sleep
- wake PC up
- power cycle NETIO Power Cable
I already have the WOL setup in NodeRED so implementation was very easy. All I had to do is to issue an HTTP request to reset the NETIO power cable and protect this action with 2FA (two-factor authentication tutorial) to prevent the accidental use.
The button has 3 states that are stored as a flow variable
Power_function. The value
sleep|reset|wol decides what action is taken once the button is pressed.
There is one more way to invoke a safe power cycle. I used a switch in the dashboard to
enable|disable the reset button. Now I can power cycle my PC anytime without the risk of doing it by mistake.
Initially, I had my charts displaying the data after 24h. Waiting a full day (or more) to see the results wasn't fun so I decided to add a couple of conditions.
Improved charts will display the present-day only if there are no other values, and current hour by hour use as well. To achieve this, I used a couple of IF statements to check the array values before the graph is updated.
To answer my question: How much actual power my 750W PSU is using? Turns out, not that much! The desktop PC uses 50-60W an hour, with peaks 270W while the machine is rendering videos. Running this beast (i7 + GTX2080) daily costs less than £0.30 which is OK.
There is one elephant in the room that I should address. NETIO Power Cables are expensive. Right now you can get one for €99 + VAT. Clearly the cables are designed for specific industry use cases with business customers in mind. It's going to be very hard to beat DIY Sonoff POWR2 approach where the same could be achieved for much less (with not as pretty effect). I'd hope to see NETIO Power Cables going down in price. At what price point would you try it out? Let me know in this Reddit thread.
Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.