Machine learning models for time series forecast

oh, thanks for the pointer. that does look like it should provide what I’m looking for

Does the ML regressor only provide a single value or can it provide a time range of values if it’s fed a predicted range of inputs i.e. can it forecast sensor.xyz for 12 hours if the csv file has logged sensors a b & xyz and the predicted values of sensors a & b are provided during runtime?

The regressor will only provide one single value.
But this doesn’t that you cannot achieve what you want there. Nothing is forbidding you of calling the regressor multiple times in a loop and build a time series with multiple values.

Just asked gemini to build this and this is what it came up with (didn’t test this but you get the idea):

First a REST command:

rest_command:
  emhass_regressor_predict_single:
    url: "http://localhost:5000/action/regressor-model-predict"
    method: "POST"
    headers:
      content_type: "application/json"
    # We pass the dynamic inputs and use a dummy entity to prevent HA sensor clutter
    payload: >
      {
        "new_values": {{ dynamic_inputs | tojson }},
        "mlr_predict_entity_id": "sensor.emhass_regressor_dummy"
      }

Then a Trigger-Based Template Sensor:

template:
  - trigger:
      - platform: event
        event_type: emhass_regressor_12h_done
    sensor:
      - name: "EMHASS 12h Regressor Forecast"
        state: "Updated"
        attributes:
          # This saves the 12-hour array directly into the sensor's attributes
          scheduled_forecast: "{{ trigger.event.data.forecast_array }}"

And finally the Looping Script:

generate_12h_regressor_forecast:
  alias: "Generate 12h Regressor Forecast"
  sequence:
    # 1. Initialize our empty results array and grab the input arrays
    - variables:
        results_array: []
        # Replace these with your actual forecast sensors/attributes for A and B
        forecast_a: "{{ state_attr('sensor.sensor_a_forecast', 'forecasts') }}"
        forecast_b: "{{ state_attr('sensor.sensor_b_forecast', 'forecasts') }}"

    # 2. Loop exactly 12 times
    - repeat:
        count: 12
        sequence:
          - variables:
              # Arrays are 0-indexed, but repeat.index starts at 1
              # We pull the specific hour's forecast for A and B
              current_a: "{{ forecast_a[repeat.index - 1] }}"
              current_b: "{{ forecast_b[repeat.index - 1] }}"
              
          # 3. Call the EMHASS API with this hour's inputs
          - service: rest_command.emhass_regressor_predict_single
            data:
              dynamic_inputs: 
                - "{{ current_a }}"
                - "{{ current_b }}"
            # Capture the API response!
            response_variable: api_response

          # 4. Extract the predicted number from the EMHASS response and append it to our array
          - variables:
              # EMHASS returns the prediction. We strip brackets and cast to float.
              predicted_value: >
                {{ api_response.content | replace('[', '') | replace(']', '') | float(0) }}
              results_array: "{{ results_array + [predicted_value] }}"

    # 5. Once the loop finishes, fire the event to update our Template Sensor
    - event: emhass_regressor_12h_done
      event_data:
        forecast_array: "{{ results_array }}"

Okay sounds good, I did get suggested the same thing by Claude although was hesitant if that was the right way forward. Thank you very much