What does your jinja code produce when you test in Developer Tools Template? What does your pricing sensor look like?
My dayahead jinja code looks like this:
{
"load_cost_forecast": {{
([states('sensor.cecil_st_general_price')|float(0)] +
state_attr('sensor.cecil_st_general_forecast', 'forecasts') |map(attribute='per_kwh')|list)
| tojson
}},
"prod_price_forecast": {{
([states('sensor.cecil_st_feed_in_price')|float(0)] +
(state_attr('sensor.cecil_st_feed_in_forecast', 'forecasts')|map(attribute='per_kwh')|list))
| tojson
}},
"pv_power_forecast": {{
([states('sensor.sonnenbatterie_84324_production_w')|int(0)] +
state_attr('sensor.solcast_pv_forecast_forecast_today', 'detailedForecast')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',1000)|map('int')|list +
state_attr('sensor.solcast_pv_forecast_forecast_tomorrow', 'detailedForecast')|selectattr('period_start','gt',utcnow()) | map(attribute='pv_estimate')|map('multiply',1000)|map('int')|list
)| tojson
}},
"num_def_loads": 2,
"def_total_hours": [3,0],
"P_deferrable_nom": [1300, 7360],
"treat_def_as_semi_cont": [1, 0]
}
Result from Developer Tools Template looks like this:
{
"load_cost_forecast": [
0.16,
0.16,
0.16,
0.16,
0.16,
0.16,
0.16,
0.15,
0.13,
0.13,
0.13,
0.16,
0.16,
0.16,
0.16,
0.13,
0.11,
0.1,
0.1,
0.1,
0.1,
0.08,
0.04,
0.03,
0.03,
0.02,
0.02,
0.02,
0.02,
0.27,
0.27,
0.28,
0.29,
0.3,
0.32,
0.35,
0.36,
0.38,
0.42,
0.42,
0.45,
0.19,
0.16,
0.16,
0.16,
0.15,
0.13,
0.15,
0.13
],
"prod_price_forecast": [
0.06,
0.06,
0.06,
0.06,
0.06,
0.06,
0.06,
0.05,
0.04,
0.04,
0.04,
0.06,
0.06,
0.06,
0.06,
0.04,
0.02,
0.01,
0.01,
0.01,
0.01,
-0.03,
-0.07,
-0.07,
-0.08,
-0.08,
-0.08,
-0.08,
-0.09,
0.2,
0.2,
0.21,
0.21,
0.22,
0.24,
0.27,
0.28,
0.29,
0.33,
0.33,
0.36,
0.09,
0.06,
0.06,
0.06,
0.06,
0.04,
0.06,
0.04
],
"pv_power_forecast": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
5,
58,
345,
861,
1411,
1992,
2500,
2941,
3314,
3608,
3856,
4004,
4049,
4064,
4090,
4020,
3854,
3642,
3354,
3020,
2599,
2130,
1554,
1031,
503,
89,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"num_def_loads": 2,
"def_total_hours": [
3,
0
],
"P_deferrable_nom": [
1300,
7360
],
"treat_def_as_semi_cont": [
1,
0
]
}
My pricing data looks like this:
Deferrable loads are things like EV charging, hot water, pool pump etc. These loads need to be automated so EMHASS can control them and their consumption subtracted from household consumption.
Maybe this might help my doco