We recently had a digital electricity (and gas) meter installed by Fluvius. In order to make more efficient use of our solar power, I installed a little dongle from HomeWizard to the P1 port of the meter. Using an app, it is possible to monitor electricity taken from or pushed to the grid. The idea is then to use the bigger appliances (dishwasher, washing machine, etc … ) when there is leftover solar power available, rather than push it to the grid.
Homewizard Energy app
However, in order to not always have to consult the app to find the best moment to run appliances, I thought a live display would come in handy. It’s also the perfect opportunity for a new project after a long break from making and blogging.
Here’s a list of components used for this project:
- Raspberry Pi 3B+ (though any other compatible Pi is just fine)
- Raspberry Pi power supply 5V/2A
- Pimoroni Unicorn HAT HD
- Pimoroni Pibow Ninja Coupé
- HomeWizard Wi-Fi P1 Meter
- MicroSD card 8GB
Connecting the P1 meter
The first step is to enable the P1 port on the digital meter, which is disabled by default in Belgium. In order to do so, go to the Fluvius website, request port management and set it to open. The port can take up to 24h to be enabled.
Enabling the data port on the digital meter
Next, install the “Energy” app and follow the instructions to connect and set up the P1 Wi-Fi meter. When finished, the app should be able to collect data from the digital meter. Depending on the type digital meter, the P1 Wi-Fi meter won’t require an external power source.
Connecting the P1 Wi-Fi meter
Setting up the Raspberry Pi
Installing the base OS to the SD card couldn’t be easier with the help of the Raspberry Pi Imager. Run the imager, select the default OS, pick an SD card and flash it. In a matter of minutes, the OS is installed successfully.
Unless a wired network connection is used, Wi-Fi needs to be enabled. This can be done in various ways and is described in the Raspberry Pi documentation. Additionally, in case of a headless setup, SSH needs to be enabled as well. This is also described in detail.
With the Pi connected to the network, the software for the Unicorn HAT HD can be installed. Once again, the installation is made easy using the one-liner provided in the documentation. The installation can be tested using the provided example scripts.
Energy Monitoring Script
The script I wrote fetches the active power consumption via the P1 meter’s open API. A JSON string is returned, parsed, and converted to a number of LEDs to light up. Finding a balance between granularity and the size of the display, I’ve opted to light up an LED for every 250 Watts of power consumed (rounded up) or produced (rounded down).
Measurements are fetched approximately every second, resulting in a near real-time view, with a history of 16 seconds. The top half of the display is used for positive values, the bottom half for negative, with the same colour scheme as the app.
Feel free to modify the code as you please, to make it fit your needs!