-
Notifications
You must be signed in to change notification settings - Fork 2
Description
For a long time there's been wack-a-mole between Predbat and the table card, every time Trefor changes the format of the Predbat HTML plan, the table card has needed tweaks to accomodate.
In a recent Predbat release Trefor has added the 'raw' attribute to predbat.plan_html which gives the raw data in structured format.
It looks like this gives all the data the table card needs, but would need more investigation to swap over to using this attribute instead of decoding the HTML.
Appreciate that this is likely to be a big change but once done could decouple the ongoing maintenance significantly
{{ state_attr('predbat.plan_html', 'raw') }}
gives:
{'rows': [{'time': '2025-10-19T10:25:00+0100', 'import_rate': 28.65, 'export_rate': 15.0, 'state': 'Demand', 'state_target': '', 'state_override': '', 'state_html': '↗', 'pv_forecast': 0.13, 'pv_forecast10': 0.1, 'pv_forecast_total': 0.13, 'load_forecast': 0.04, 'load_forecast10': 0.04, 'load_forecast_total': 0.04, 'clipped': 0, 'soc_percent': 52, 'soc_change': 0.08, 'cost_change': 0.0, 'total_cost': 0.25}, {'time': '2025-10-19T10:30:00+0100', 'import_rate': 28.65, 'export_rate': 15.0, 'state': 'Demand', 'state_target': '', 'state_override': '', 'state_html': '↗', 'pv_forecast': 0.89, 'pv_forecast10': 0.67, 'pv_forecast_total': 1.02, 'load_forecast': 0.29, 'load_forecast10': 0.32, 'load_forecast_total': 0.32999999999999996, 'clipped': 0, 'soc_percent': 53, 'soc_change': 0.55, 'cost_change': 0.0, 'total_cost': 0.25}, {'time': '2025-10-19T11:00:00+0100', 'import_rate': 28.65, 'export_rate': 15.0, 'state': 'Demand', 'state_target': '', 'state_override': '', 'state_html': '↗', 'pv_forecast': 0.91, 'pv_forecast10': 0.68, 'pv_forecast_total': 1.9300000000000002, 'load_forecast': 0.38, 'load_forecast10': 0.42, 'load_forecast_total': 0.71, 'clipped': 0, 'soc_percent': 57, 'soc_change': 0.49, 'cost_change': 0.0, 'total_cost': 0.25}, {'time': '2025-10-19T11:30:00+0100', 'import_rate': 28.65, 'export_rate': 15.0, 'state': 'Demand', 'state_target': '', 'state_override': '', 'state_html': '↗', 'pv_forecast': 0.86, 'pv_forecast10': 0.62, 'pv_forecast_total': 2.79, 'load_forecast': 0.36, 'load_forecast10': 0.4, 'load_forecast_total': 1.0699999999999998, 'clipped': 0, 'soc_percent': 60, 'soc_change': 0.46, 'cost_change': 0.0, 'total_cost': 0.25}, {'time': '2025-10-19T12:00:00+0100', 'import_rate': 28.65, 'export_rate': 15.0, 'state': 'Demand', 'state_target': '', 'state_override': '', 'state_html': '↗', 'pv_forecast': 0.8, 'pv_forecast10': 0.56, 'pv_forecast_total': 3.59, 'load_forecast': 0.5, 'load_forecast10': 0.55, 'load_forecast_total': 1.5699999999999998, 'clipped': 0, 'soc_percent': 64, 'soc_change': 0.27, 'cost_change': 0.0, 'total_cost': 0.25},
...