
A robotics and machine learning engineer has developed a command-line interface (CLI) that monitors power consumption through a smart socket and adjusts system performance according to electricity tariffs.
The simple tool, called WattWise, came about when developer Naveen assembled a workstation with two AMD EPYC processors and planned to add four graphics accelerators. Since such a system consumes a lot of power, he wanted to control its consumption using a Kasa Smart Plug.
At the moment, Naveen has only made the monitoring part of the project publicly available, and he plans to add the function of controlling processor frequencies and power consumption later.
Why did you need WattWise?
Unfortunately, the standard Kasa Smart app and the Home Assistant panel proved to be inconvenient and did not perform all the necessary functions. Since Naveen was already using the terminal for monitoring via htop, nvtop, and nload, he decided to create his own tool instead of using yet another program.
He developed a terminal program that receives energy consumption data via Home Assistant and TP-Link. It displays the current load in real time (in watts and amps), builds historical consumption graphs, and, most importantly, automatically limits the performance of the processor and video card.
Naveen’s energy supplier uses differential pricing, where electricity is significantly more expensive during peak hours. His workstation consumes up to 1,400 watts at full load, but lowering the processor frequency from 3.7 GHz to 1.5 GHz reduces consumption by about 225 watts.
The project does not yet mention the performance limitations of the video cards, although lowering their GPU frequency could provide even greater savings for four video cards.
How does WattWise work?
The program optimizes the clock speed based on three parameters:
- System load
- Current power consumption (read from the smart socket)
- Time of day (to take into account peak tariffs)
A PI controller is then used to control the power supply and adapt system parameters to these variables.

Currently, WattWise supports only one smart socket at a time and only works with the Kasa brand. However, Naveen plans to add support for multiple outlets, integration with other smart outlet brands, collaboration with other energy management tools, and additional performance optimization features.
Naveen made WattWise an open source project under the MIT license, so anyone can download the code from GitHub. If you are interested, you can leave feedback, suggest improvements, or create your own version adapted for other systems.
Spelling error report
The following text will be sent to our editors: