https://github.com/openclimatefix/pvconsumer
Consumer PV data from various sources
https://github.com/openclimatefix/pvconsumer
Last synced: about 1 year ago
JSON representation
Consumer PV data from various sources
- Host: GitHub
- URL: https://github.com/openclimatefix/pvconsumer
- Owner: openclimatefix
- License: apache-2.0
- Created: 2022-02-18T07:40:49.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T17:29:53.000Z (about 1 year ago)
- Last Synced: 2025-04-07T18:37:52.951Z (about 1 year ago)
- Language: Python
- Size: 845 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# PVConsumer
[](#contributors-)
[](https://codecov.io/gh/openclimatefix/PVConsumer)
Consumer PV data from `pvoutput.org` and `SheffieldSolar`. The idea is to expand to different data sources in the future.
# Live
This application pulls live data from PV output.org and stores it in a database
## Dependencies
* [poetry][poetry]
## Run locally
To run the application locally
```bash
# Install the python dependencies
poetry install
poetry run pvconsumer/app.py
```
## Logic
The app has the following high-level strucuture
```mermaid
graph TD;
A[1. Get PV system]-->B;
B[2. Filter PV Systems]-->C;
C[3. Pull Data]-->D[4. Save data];
```
1. Get PV System
```mermaid
graph TD
A0(Start) --> A1
A0(Start) --> A2
A1[Load local PV systems] --> A3{Are all PV system in the database}
A2[Load Database PV systems] --> A3
A3 --> |No| A4[Load the extra
PV systems from pvoutput.org]
A3 --> |yes| A5(Finish)
A4 --> A5
```
2. Filter PV Systems
```mermaid
graph TD
B0(Start) --> B1{Is there any PV data in
our database for this PV system?}
B1 --> |No| B2[Keep PV system]
B1--> |yes| B3{Is there any more PV data,
from pv output.org,
available for this PV system?}
B3 --> |yes| B2
B3 --> |No| B5[Dischagre PV system]
B2 --> B6(Finish)
B5 --> B6
```
3. Pull Data
```mermaid
graph TD
C0(Start) --> C1[Pull Data from pvoutput.prg]
C1 --> C2{Is this data
in our database already?}
C2 --> |yes| C3[Keep PV data]
C2 --> |No| C4[Dischagre PV data]
C3 --> C5(Finish)
C4 --> C5
```
## Code style
Format the python codebase **in place**.
```bash
make format
```
Test that the codebase is formatted
```bash
make lint
```
## 🩺 Testing
Run only the unit tests
```bash
poetry run pytest tests/unittest
```
Run all the tests (including the "integration" tests that require credentials to call an external API)
```bash
poetry run pytest tests
```
## Environmental Variables
- API_KEY: API key for pvoutput.org
- SYSTEM_ID: System id for pvoutput.org
- DATA_SERVICE_URL: data service url for pvoutput.org
- SS_URL: Sheffield Solar URL
- SS_API_KEY: Sheffield Solar API key
- SS_SYSTEM_ID: Sheffield Solar System ID
- DB_URL: Save in database to the pv database
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

Brandon Ly
💻

Simon Lemieux
💻

Peter Dudfield
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
[poetry]: https://python-poetry.org/