Skip to content

Instantly share code, notes, and snippets.

@fbradyirl
Last active March 1, 2025 20:04
Show Gist options
  • Save fbradyirl/ac6e77e6f118a34681b5f480c3e3da2d to your computer and use it in GitHub Desktop.
Save fbradyirl/ac6e77e6f118a34681b5f480c3e3da2d to your computer and use it in GitHub Desktop.
Home Assistant Card Code for Solcast.com forecast
type: custom:apexcharts-card
apex_config:
chart:
height: 200px
all_series_config:
unit: " kWh"
header:
show: true
standard_format: true
show_states: true
colorize_states: true
graph_span: 2d
span:
start: day
offset: "-0h"
now:
show: true
label: Now
yaxis:
- id: kwh
min: 0
apex_config:
tickAmount: 5
- id: header_only
show: false
series:
- entity: sensor.solcast_pv_forecast_forecast_today
yaxis_id: kwh
type: area
name: Solar Forecast Today
color: orange
data_generator: |
var today = entity.attributes.detailedForecast.map((start, index) => {
return [new Date(start["period_start"]).getTime(), entity.attributes.detailedForecast[index]["pv_estimate"]];
});
var data = today
return data;
show:
legend_value: false
in_header: false
stroke_width: 3
float_precision: 2
extend_to: false
- entity: sensor.solcast_pv_forecast_forecast_tomorrow
yaxis_id: kwh
type: area
name: Tomorrow
color: grey
data_generator: |
var today = entity.attributes.detailedForecast.map((start, index) => {
return [new Date(start["period_start"]).getTime(), entity.attributes.detailedForecast[index]["pv_estimate"]];
});
var data = today
return data;
show:
legend_value: false
in_header: false
stroke_width: 3
float_precision: 2
extend_to: false
- entity: sensor.solcast_pv_forecast_forecast_today
yaxis_id: header_only
name: Solar Forecast Today
color: orange
show:
legend_value: true
in_header: true
in_chart: false
- entity: sensor.solcast_pv_forecast_forecast_remaining_today
yaxis_id: header_only
name: Remaining
color: orange
show:
legend_value: true
in_header: true
in_chart: false
- entity: sensor.solcast_pv_forecast_forecast_tomorrow
yaxis_id: header_only
name: Tomorrow
color: grey
show:
legend_value: true
in_header: true
in_chart: false
- entity: sensor.solcast_pv_forecast_forecast_day_3
yaxis_id: header_only
name: Day After Tomorrow
color: lightgrey
show:
legend_value: true
in_header: true
in_chart: false
@fbradyirl
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment