Skip to content

Conversation

mgazza
Copy link
Collaborator

@mgazza mgazza commented Oct 3, 2025

Summary

  • Decouples Solcast integration from fetch.py by implementing a component-based architecture
  • Adds Solcast to the component system alongside GECloud, Octopus, etc.
  • Component publishes solar forecast sensors that fetch.py can read using existing regex patterns
  • Supports both Solcast API and Forecast.solar API
  • No changes needed to fetch.py due to sensor pattern matching

Changes Made

components.py

  • Added Solcast component configuration with support for both APIs
  • Configured with time format functions and utility dependencies
  • Component only initializes if solcast_host or forecast_solar config exists

solcast.py

  • Extended Solcast class with component lifecycle methods (start, stop, wait_api_started)
  • Added sensor publishing in format matching Home Assistant Solcast integration
  • Component publishes sensors like sensor.predbat_pv_forecast_forecast_today
  • Fetches forecasts every 30 minutes and publishes to sensor registry
  • Handles both Solcast API sites and Forecast.solar configuration

Test Plan

  • Test with actual Solcast API credentials - component should start and publish sensors
  • Test with Forecast.solar configuration - component should fetch and publish data
  • Verify fetch.py can read the published sensors using existing regex patterns
  • Test component lifecycle - start/stop behavior
  • Confirm no impact on existing functionality when component disabled

🤖 Generated with Claude Code

mgazza and others added 2 commits October 4, 2025 00:32
- Add Solcast component to components.py supporting both Solcast and Forecast.solar APIs
- Extend Solcast class to work as a component with lifecycle methods
- Component fetches forecasts every 30 minutes from configured API
- Supports Solcast API (via solcast_host/solcast_api_key)
- Supports Forecast.solar API (via forecast_solar config)
- Component only starts if an API is configured, otherwise remains inactive
- Publishes sensors matching HA Solcast integration pattern:
  * sensor.predbat_pv_forecast_forecast_today
  * sensor.predbat_pv_forecast_forecast_tomorrow
  * sensor.predbat_pv_forecast_forecast_day_3
  * sensor.predbat_pv_forecast_forecast_day_4
- Sensors include detailedForecast/forecast attributes in expected format
- No changes needed to fetch.py - it automatically finds these sensors

This follows the architectural pattern where components populate sensors
and fetch.py reads from sensors, removing direct coupling between
fetch.py and the solar forecast APIs.

Note: Requires testing with actual API credentials
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant