Building a home energy monitoring dashboard for your clevrHome

Published by Coenraad Pretorius on

Monitoring energy consumption is a critical step to help you manage your energy usage effectively. It makes the invisible and sometimes complex energy consumption visible, allowing you to become aware of how much and when you use energy.

Adapted from technology house vector created by rawpixel.com.

In the previous post, we discussed linking up to a home energy meter and using Telegram to send notifications. In this post, we’ll build upon that foundation and create a comprehensive energy monitoring dashboard that includes solar generation and hot water monitoring.

Saving our data to a database

There are many database options available for saving your data. The choice of database system depends on the frequency and volume of data capture as well as if you would like to store it in long term. Without getting into too much detail in terms of which database is better, I decided on using TimeScaleDB. It provides a SQL-like query language and is optimised for time-series data. Because it is based on PostgreSQL, most tools can easily use the data with a standard PostgreSQL connector.

Setting up TimeScaleDB is simple, and you can do so by following these steps. Now, building on our previous code, we already get our energy consumption data via API, so we need to add an extra function to store the values in our database. We will use a simple schema of a timestamp, tag name and value.

View this gist on GitHub

Solar system monitoring

When investing in a solar system, it becomes crucial to operate it effectively and efficiently to get the full benefits. We need to ensure we follow a systematic approach to optimise our energy consumption. By integrating solar data into our home energy monitoring system, we can track energy generation, optimise solar energy usage and storage, identify any efficiency issues, and gauge the return on our investment.

I chose to use the PySolarmanV5 for my inverter, which provides a library for accessing inverter and battery data using a local Modbus connection, rather than the limiting API. I also searched through various of the other libraries to find all the Modbus registers that we needed, along with the scaling factors. Using the library, we can fetch the data every 10-seconds and store it in our database alongside our mains power consumption data.

View this gist on GitHub

It is worth to note that my inverter also measures mains power consumption with an included current transformer. It will be more accurate than with just the clamp on meter in the previous post.

Hot water monitoring

Another significant contributor to household energy consumption is hot water usage. By monitoring our hot water system, we can gain insights into our hot water consumption patterns for optimisation, ultimately reducing energy costs.

To monitor hot water, I replaced my Geyserwise control unit with a Geyserwala control unit. Unlike the Geyserwise unit, the Geyserwala unit provides local data integration without going via the internet first. This controller provides data on collector and tank temperatures as well as overall energy usage for heating water. We integrate this data into our monitoring system by reading the sensor values directly via API and storing them in our database.

We again read the data every 10-seconds, which for this kind of system is probably too frequent. The temperatures wouldn’t change that fast, so probably every minute will be better and still provide good resolution. However, the statuses and consumption values can change quickly within a minute and may lead to missing some critical data points. This is the challenge with polling data as we are doing. In the next version, we will look at an event driven architecture which solves some of the issues.

View this gist on GitHub

Visualising with Grafana

One of the tools I use daily for data visualisation is Grafana. Grafana is an open-source analytics and monitoring solution that can connect to various databases, including TimeScaleDB. It has powerful features for visualisation and includes alerting and annotations. With Grafana, we can create dashboards that display the mains power consumption, solar generation, and hot water usage data in a clear and visually appealing manner. Visualisations like graphs, gauges, and charts make it easier to understand and analyse the data.

With all the data we are capturing, it is time to pull everything together resulting in the dashboard below. The top row contains a couple of real-time tiles and gauges, giving the view of what is happening now. The next row contains horizontal bars, indicating main power status as well as status of the hot water heating element and solar water pump over time. The first graph displays the energy consumption and generation as well as the state-of-charge (SOC) of the batteries. The second graph shows the hot water collector and tank temperatures.

Combined energy monitoring dashboard.

Conclusion

Collecting and monitoring your energy data is the first step to setup a good energy management system, whether is it for your home, business or factory. By combining mains power monitoring, solar generation tracking, and hot water usage monitoring into a comprehensive dashboard, we gain a holistic view of our household’s energy consumption and generation patterns. With the help of Grafana, we visualised the data and can start unlocking opportunities for optimisation and conservation, which will be the focus of the next blog post.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *