Quick overview
Youtube Video: https://youtu.be/7lmQu9wd46w
This workflow runs on a monthly schedule (or manually) to compare SolarEdge energy production against weather-adjusted expectations using Open-Meteo and Postgres history, then uses Google Gemini to attribute losses and, for anomalies, creates Jira work orders and posts alerts to Slack.
How it works
- Runs on a monthly schedule (or when executed manually) and loads site configuration such as date range, expected kWh, and thresholds.
- Pulls daily energy production for the configured period from the SolarEdge Monitoring API and fetches hourly radiation and cloud cover data from Open-Meteo.
- Queries Postgres for the site’s last 30 days of performance history and the most recent incidents to build diagnostic context.
- Calculates actual vs expected production, weather-adjusted losses, performance ratios, anomaly flags, and historical baselines, then upserts the results into a Postgres solar performance table.
- If the period is anomalous, sends the metrics and historical context to Google Gemini to generate a structured root-cause attribution, confidence, priority, and recommended actions.
- Stores the AI diagnosis as an open incident in Postgres, creates a Jira task with the diagnosis details, links the Jira key back to the incident, and posts an alert to a Slack channel.
- If no anomaly is detected, posts a daily/period summary message to Slack.
Setup
- Configure credentials for SolarEdge (OAuth2), Postgres, Google Gemini (PaLM/Generative Language API), Jira Software Cloud, and Slack.
- Update the Config values for your site (SolarEdge site ID, latitude/longitude, timezone, expected_kwh, loss_threshold_pct, evaluation date and period dates, and Jira base URL).
- Ensure Postgres has the required tables and constraints used by the queries (solar_daily_performance and solar_incidents, including the ON CONFLICT keys).
- Select the target Slack channel and confirm the Jira project and issue type used for creating work orders match your Jira setup.
- Activate the workflow and adjust the schedule trigger interval if you want a different cadence than monthly.