> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flatpeak.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Include local solar generation forecasts

When scheduling energy consumption or exports — and when reporting energy costs — it is essential to account for local generation.

Flatpeak provides the following options:

* Forecast solar generation using PV system rating and actual data
* Submit your own solar forecast if you prefer to use external forecasting models

Forecast data will be automatically used to optimise energy scheduling

<Info>Submit [actual generation data](/guides/calculate/local-generation) after the event to ensure accurate cost calculations</Info>

To implement, choose one of the two options:

<Tabs>
  <Tab title="Use Flatpeak forecasts">
    <Warning>This feature is in limited Beta. [Contact support](https://dashboard.flatpeak.com/#support) for early access.</Warning>

    Call the [create-device](/api-reference/anode/devices/create-a-device) endpoint and set:

    | Field                         | Description                                                                                                                                                                                                                                                                                                                                        |
    | :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `location_id`                 | Flatpeak **Location ID** where the PV system is installed.                                                                                                                                                                                                                                                                                         |
    | `reference_id`                | Your internal device ID for cross-reference.                                                                                                                                                                                                                                                                                                       |
    | `pv_system.rated_power_kw`    | PV system’s rated output power in kW.                                                                                                                                                                                                                                                                                                              |
    | `pv_system.install_date`      | Optional. Installation date (`YYYY-MM-DDTHH:MM:SSZ`) used to estimate performance degradation due to system ageing.                                                                                                                                                                                                                                |
    | `pv_system.azimuth`           | Optional. Default is the optimal azimuth calculated from latitude. Azimuth is the angle (°) from true north that the PV system faces. An azimuth of 0° means facing north. Positive values are anticlockwise (e.g. -90° = east, 135° = southwest). Defaults to 0° (north-facing, southern hemisphere) or 180° (south-facing, northern hemisphere). |
    | `pv_system.tilt`              | Optional. Default is 23°. Tilt angle of the PV system in degrees (0–90). A tilt of 0° means facing upwards, and 90° means vertical.                                                                                                                                                                                                                |
    | `pv_system.terrain_shading`   | Optional. Default is false. If true, irradiance is adjusted for surrounding terrain using a 90 m-resolution elevation model. Direct irradiance is set to zero when the sun is blocked; diffuse irradiance is reduced when the sky view is limited.                                                                                                 |
    | `pv_system.forecasts.enabled` | Enables solar forecasting for this device. Defaults to `false`.                                                                                                                                                                                                                                                                                    |

    Store the returned `device_id` permanently in your system

    <CodeGroup>
      ```json Request example theme={"system"}
      curl --request POST \
        --url https://api.flatpeak.com/devices \
        --header 'Authorization: Bearer <token>' \
        --header 'Content-Type: application/json' \
        --data '{
        "reference_id": "DEV1234567890",
        "location_id": "loc_641b90b758fb8e6293716e40",
        "pv_system": {
          "rated_power_kw": 15.3,
          "install_date": "2025-06-12T00:00:00Z",
          "azimuth": 0,
          "tilt": 23,
          "terrain_shading": false,
          "forecasts_enabled": true
         }
        }
      }'
      ```

      ```json Response example theme={"system"}
      {
      "reference_id": "DEV1234567890",
      "location_id": "loc_641b90b758fb8e6293716e40",
      "pv_system": { 
        "rated_power_kw": 4.2,
        "install_date": "2025-06-12T00:00:00Z",
        "azimuth": 0,
        "tilt": 23,
        "terrain_shading": false,
        "forecasts_enabled": true,
        "forecasts_last_updated": "2025-09-11T12:43:22Z"
        }
      }
      ```
    </CodeGroup>

    Flatpeak now automatically generates solar forecasts for all relevant requests. The `forecasts_last_updated` timestamp indicates when the forecasts were last generated.

    To disable this feature, set `pv_system.forecasts_enabled = false`.
  </Tab>

  <Tab title="Use your own forecasts">
    <Steps>
      <Step title="Create device identifier">
        Call the [create-device](/api-reference/anode/devices/create-a-device) endpoint and set:

        * `reference_id` to your internal device ID for cross-reference.
        * `type=pv_system`

        Store the returned `device_id` permanently in your system

        <CodeGroup>
          ```json Request example theme={"system"}
          curl --request POST \
            --url https://api.flatpeak.com/devices \
            --header 'Authorization: Bearer <token>' \
            --header 'Content-Type: application/json' \
            --data '{
            "reference_id": "DEV1234567890",
            "type": "pv_system"
          }'
          ```

          ```json Response example theme={"system"}
          {
            "id": "dev_63a6087272941ef077a8fd3e",
            "object": "device",
            "reference_id": "DEV1234567890",
            "type": "pv_system"
          ```
        </CodeGroup>
      </Step>

      <Step title="Submit your forecast data">
        * Submit forecast generation to [submit-meter-interval](/api-reference/anode/meters/submit-meter-interval) endpoint.
        * If your system generates cumulative records, use [submit-meter-cumulative](/api-reference/anode/meters/submit-meter-cumulative) instead.
        * Include relevant `device_id` and `location_id`
        * Set `energy_flow_direction=INBOUND` and `tariff_direction=LOCAL`
        * Set the `confidence` parameter to anything **less than 1**.

        <CodeGroup>
          ```json Request example highlight={9,10} theme={"system"}
          curl --request PUT \
            --url https://api.flatpeak.com/meters/interval \
            --header 'Authorization: Bearer <token>' \
            --header 'Content-Type: application/json' \
            --data '[
            {
              "location_id": "loc_641b90b758fb8e6293716e40",
              "device_id": "dev_63a6087272941ef077a8fd3e",
              "energy_flow_direction": "INBOUND",
              "tariff_direction": "LOCAL",
              "confidence": 0.9,
              "units": "W",
              "value": 968,
              "start_time": "2025-08-01T10:30:00Z",
              "end_time": "2025-08-01T11:00:00Z",
            }
          ]'
          ```

          ```json Response example theme={"system"}
          {
            "id": "bat_65e42b7827c0526548432b9f",
            "object": "meter_batch",
            "records_submitted": 1,
            "records_accepted": 1,
            "records_processed": 1
          }
          ```
        </CodeGroup>
      </Step>
    </Steps>

    Flatpeak will now use your submitted forecast data to optimise energy scheduling.

    If no data is provided, generation will be assumed to be zero.
  </Tab>
</Tabs>
