EMHASS: An Energy Management for Home Assistant

No problem.

I store input_text.fi_fo_buffer as a list of 48x kW values for each 30 minute time slot. I chose kW as it would fit inside the 255 char limit.

Every 30 minutes I reset the input_text.fi_fo_buffer with elements [1:48] + the current value of power_load_no_var_loads. It might be more accurate to use the rolling 30 minute value, but I haven’t implemented that.

alias: read_sensor_data
description: ""
trigger:
  - platform: time_pattern
    minutes: /30
condition: []
action:
  - service: input_text.set_value
    target:
      entity_id: input_text.fi_fo_buffer
    data:
      value: >
        {{ (states('input_text.fi_fo_buffer').split(', ')[1:48]  + [
        (states('sensor.power_load_no_var_loads')|float(0)/1000)|round(1)])
        |join(', ') }}
mode: single

I have setup the fifo using helpers:

and you need to prefill with 48 values, one neat benefit is you can change the prefil at any time, if for example your forecast household load changes.