This project enables users to analyse the degradation of their solar panels over time. It compares the produced energy of a photovoltaic system (PV production) with an estimate of the expected yield at that location.
❗ You are taking a sneak peek at the next version. It could be that some features you find on this page are not
released yet.
Please have a look at the README of the corresponding release/git tag. Latest
version: README of v0.1.0.
Table of Content
As a pre-requisit,
pnpm
is required. Install it based on https://pnpm.io/installation.
- Copy
src/.env.example
tosrc/.env.local
and adjust configuration to your needs. - run
pnpm i
- run
pnpm dev
You can start sun-set-analytics based on the published docker image. To start the docker image, you need to
- Create your own .env configuration as a copy from
.env.example
(i.e. define the app database loaded fromfile:///data/sun-set-analytics.db
) - start docker, exposing endpoint and mount writable directory to the location where the sqlite database should be stored: i.e.
docker run --rm --env-file .env -p 3000:3000 -v /tmp/:/data/ ghcr.io/tegonal/sun-set-analytics:latest
On the first start, you first need to create a new user. Based on the role selected, the user has different permissions. A User
can manage installations and the PV production data of the owned installations. An Admin
can additionally create new users.
Be aware that at the moment no additional check prevents a user to upgrade his role to an
Admin
account
After registering and login to the system, a user can create new installations. The installation will automatically assigned to the current user as owner. Only this user can see and manage the installation afterwards.
To be able to use the additional rest API's, the user needs to enable a API Key
in his profile.
Read more about the API Strategy in the payload documentation.
The application provides custom endpoint to be able to upload PV production data. Those data are automatically enriched with data from either
- Photovoltaic Geographical Information System (PVGIS) des EU Science Hub or
- Irradiance data from Open Meteo
based on the availabily and the configuration in the installation (enabled or not).
The upload endpoint expects a json message compatible to the following json schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"measured_production": {
"type": "array",
"items": [
{
"type": "object",
"properties": {
"from": {
"type": "string",
"format": "datetime"
},
"to": {
"type": "string",
"format": "datetime"
},
"production": {
"type": "number"
}
},
"required": [
"from",
"to",
"production"
]
}
]
}
},
"required": [
"measured_production"
]
}
A full example looks like:
curl -H 'Authorization: users API-Key $API_KEY' -X POST $HOSTNAME/api/installations/$INSTALLATION_ID/import-production-data --data '{
"measured_production": [
{
"from": "2022-02-11T20:00:00Z",
"to": "2022-02-11T21:00:00Z",
"production": 1.45
}
]
}'
Where you need to provide API_KEY, HOSTNAME and INSTALLATION_ID depending on you setup and provide a valid json payload. The unit for the energy production is kilowatt-hours (kWh).
Calling this endpoint will:
- Enrich and import pv_production data based on the provided time interval
- Re-Calculate monthly statistics for the given installation and time interval
Re-importing will not delete any existing records in this time interval. Those need to be cleaned up manually
An additional endpoint allows delete PV production data for an installation an a given time interval. To do so, call the following endpoint:
curl -H 'Authorization: users API-Key $API_KEY' -X POST $HOSTNAME/api/installations/$INSTALLATION_ID/delete-production-data?from=$FROM&to=$TO
Where you need to provide API_KEY, HOSTNAME and INSTALLATION_ID depending on you setup and define with FROM and TO as ISO datetime values the time interval to be deleted. This will:
- Delete PV production data for the given installation and time interval
- Re-Calculate monthly statistics for the given installation and time interval
An additional endpoint allows re-fetching estimate PV production data for an installation an a given time interval. To do so, call the following endpoint:
curl -H 'Authorization: users API-Key $API_KEY' -X POST $HOSTNAME/api/installations/$INSTALLATION_ID/recalculate-estimated-production?from=$FROM&to=$TO
Where you need to provide API_KEY, HOSTNAME and INSTALLATION_ID depending on you setup and define with FROM and TO as ISO datetime values the time interval to be re-fetched. This will:
- Re-fetch the estimated production data and update the records
- Re-Calculate monthly statistics for the given installation and time interval
To re-calculate the monthly statistics based on the data you can call the following endpoint:
curl -H 'Authorization: users API-Key $API_KEY' -X POST $HOSTNAME/api/installations/$INSTALLATION_ID/recalculate-monthly-stats?from=$FROM&to=$TO
Where you need to provide API_KEY, HOSTNAME and INSTALLATION_ID depending on you setup and define with FROM and TO as ISO date values.
After importing PV production data, the monthly statistics can be analyzed based on different comparisons. The following charts should demonstrate the different charts.
The aim of this project was to provide a basic platform to be able to import, track and compare long term PV production data. The tool was created as an MVP in the context of a Tegonal Open Source Week, in which the whole company contributes to new or existing open source software. There is currently no upcoming work planned on the project. Please share your ideas, experiences or other inputs either issues, discussions or direct contributions.
Our thanks go to code contributors as well as all other contributors (e.g. bug reporters, feature request creators etc.)
You are more than welcome to contribute as well:
- star this repository if you like/use it
- open a bug if you find one
- Open a new discussion if you are missing a feature
- ask a question so that we better understand where we can improve.
- have a look at the help wanted issues.
sun-set-analytics is licensed under GNU Affero General Public License v3