#server #threshold #power

app hackdose-server

A server to control smart plugs using data from smart meters

11 releases (6 breaking)

0.10.0 Feb 10, 2023
0.9.2 Jan 21, 2023
0.8.0 Jan 6, 2023
0.7.0 Dec 23, 2022
0.1.0 Nov 12, 2022

#104 in HTTP server

31 downloads per month


1.5K SLoC

About Hackdose

This is the hackdose project, a project for making better user of your micro solar power plants. The idea is simple: If there is more solar energy than needed, store it in batteries (of devices you use everyday), or fridges, or just use it (e.g. run your dish washer). It is not my idea, but I didn't find an implementation for my needs (most importantly, inexpensive hardware).


What you basically need

  • a raspberry pi or Mango PI
  • a smart meter that its compatible with this software (if it is not, file an issue)
  • HS-100 smart plugs (or suitable opto-isolators)
  • a micro solar power plant

The technical principle is easy: if you produce more energy than your house needs, your smart meter will know and tell hackdose. Hackdose will (under some conditions) turn on a smart plug with your charger (or whatever device you want to control).


This project is experimental. Use at your own risk. Risks may include

  • this software is able to control devices with high power. It can cause whatever eletrical devices can cause.
  • although by design there is no remote control of the software apart from IR possible, there is a rest interface which may potentially be subject to vulnerabilities



  • there is a energy monitoring endpoint on port 8080 path /energy.
  • there is a 24h-statistics endpoint on /day showing a nice diagram

Smart usage of energy

You can currently set up smart plugs (currently only HS-100) to prevent solar energy from escaping behind your smart meter. You can e.g. use this to charge your Laptop battery, your smart phone, or your E-bike.


You can either compile your yourself or check out one of the latest artifacts here.

Install compiler toolchain

rustup target add riscv64gc-unknown-linux-gnu

If you are using another architecture (e.g. arm), install an appropriate rust target and set it up in install.sh.

Install cross linker (for linking)

sudo apt install gcc-riscv64-linux-gnu

install sshpass (for deployments)

sudo apt install sshpass

Setup your Hardware

I assume that you have a Mango PI Pro-Q.

  • connect IR reader (using PIN 35 as power supply to avoid boot startup trouble)
  • install systemd config file (see sample)

Setup actors

  • see sample yaml config
  • put your HS100/HS110 smart plugs into the list


You can use the deploy script install.sh to deploy. Put a hackdose.yaml and an .env (sample included) file in the server/profiles/<profile> directory.

To deploy run:

PROFILE_NAME=test ./install.sh 


This project is licensed under Apache 2.0 or MIT license.


Contributions are very welcome. Just file an issue (even if you just have an idea) or solve one.


~542K SLoC