Logo
Published: 12/3/2024

Open Surplus Manager: photovoltaic surplus management software

As part of the computer science engineering degree curriculum, i built a photovoltaic surplus management software. This post is a brief summary of this work. You can read the full document at this link.(spanish).

Abstract

When a user of the small photovoltaic installation wants to make use of the surplus energy produced because they are not interested in feeding this energy into the grid in that moment they can take advantage of that energy by manually switching on some devices in their home, others choose to go a step further by using home automation buying devices that can do it automatically like a electric vehicle charging station or a smart plug. The problem that this user encounters is that the acquired devices cannot communicate with each other and instead of organizing themselves to use that energy they compete for it.

This thesis propose to provide a solution for both users who have no way to take advantage of their surplus energy and those who have already tried it through home automation but have not succeeded due to the previously mentioned reasons.

To do this, a core will be developed that knows and controls the devices that are included in the system while different modules or integrations can be added to expand the communication capacity with devices from different manufacturers and with different communication protocols. The connection with the Home Assistant system is also a fundamental part of the project.

Repositories

General scheme

Screenshot 2024-12-03 013910.png

Class diagram

diagrama_clases.png

Language and libraries

The development of this system will be in Python, a high-level language that allows developing different types of applications quickly and easily. Python is a very popular language in general development but especially in the IoT and home automation world, where important software like Home Assistant is developed in this language. It also has a large number of libraries that allow communication with a wide variety of different devices, which is very important for developing Open Surplus Manager integrations.

For development, tools that allow asynchronous programming will be necessary, as the system must be able to manage multiple simultaneous tasks, some of which are blocking. Some of the libraries or frameworks (set of code or concepts that serve as a basis for development) to be used are: asyncio for asynchronous programming, aiohttp, both for creating a REST API and for use as a client, and aiomqtt for obtaining MQTT data. The choice of MQTT for the development of one of the native integrations is due to it being a very popular and ideal protocol for communication between IoT devices.

In addition to Python for system programming, YAML will be used for configuration, Docker for creating containers where the system can be executed, and Docker Compose for its definition and execution when used outside of Home Assistant OS.