Skip to content

Make solar production predictions #217

Make solar production predictions

Make solar production predictions #217

name: Make solar production predictions
on:
schedule:
- cron: '15 13 * * *' # Run every day at 5:15 AM Pacific Time, which is 13:15 PM UTC (at least half the year)
jobs:
make-prediction:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Set up Python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0, will make use of `.python-version`
- name: Install dependencies
run: |
make install
- name: Refresh Enphase tokens
env:
ENPHASE_CLIENT_ID: ${{ secrets.ENPHASE_CLIENT_ID }}
ENPHASE_CLIENT_SECRET: ${{ secrets.ENPHASE_CLIENT_SECRET }}
ENPHASE_SECRETS_ENCRYPTION_KEY_HEX: ${{ secrets.ENPHASE_SECRETS_ENCRYPTION_KEY_HEX }}
run: |
make enphase-tokens
- name: Make energy production predictions
env:
AIRNOW_API_KEY: ${{ secrets.AIRNOW_API_KEY }}
LAT: 47.543737
LON: -122.367417
run: |
make prediction
- name: Look up and persist actual energy production data
env:
ENPHASE_API_KEY: ${{ secrets.ENPHASE_API_KEY }}
ENPHASE_CLIENT_ID: ${{ secrets.ENPHASE_CLIENT_ID }}
ENPHASE_CLIENT_SECRET: ${{ secrets.ENPHASE_CLIENT_SECRET }}
ENPHASE_SECRETS_ENCRYPTION_KEY_HEX: ${{ secrets.ENPHASE_SECRETS_ENCRYPTION_KEY_HEX }}
ENPHASE_SYSTEM_ID: ${{ secrets.ENPHASE_SYSTEM_ID }}
run: |
make get-actual-energy-production
- name: Create new plot of model output and actual production
run: |
make output-plot
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Commit changes to predictions-db
run: |
# Stage and commit the Enphase tokens
git add enphase_tokens.secret
git commit -m "[$(date --iso-8601='date')] Update Enphase tokens"
# Stage and commit the DB file
git add src/persistence/predictions.duckdb
git commit -m "[$(date --iso-8601='date')] Make predictions"
# Stage and commit the plot
git add results/plot.png
git commit -m "[$(date --iso-8601='date')] Plot results"
git push origin main