Forecasts

Needs an API key with the battery:historical scope.

What Aotea expects for the next half hour: wholesale price, solar generation and household load. Useful for automations like running the dishwasher when power is cheap.

Forecasts are in preview. Sensor names and behaviour may change.

  1. Step 1: Add the sensors

    Add this to configuration.yaml. It checks for a new forecast every 5 minutes.

    Fills in every snippet in these docs. It stays in your browser.

    configuration.yaml
    rest:
      - resource_template: >-
          {% set tz = 'Pacific/Auckland' %}
          {% set start = now().strftime('%Y-%m-%d %H:%M:00') ~ ' ' ~ tz %}
          {% set end = (now() + timedelta(minutes=30)).strftime('%Y-%m-%d %H:%M:00') ~ ' ' ~ tz %}
          https://api.aoteaenergy.com/api/v1.0.1/battery/forecast/YOUR_BATTERY_ID?start={{ start | urlencode }}&end={{ end | urlencode }}&intervals=1
        headers:
          Authorization: !secret aotea_api_key
        scan_interval: 300
        sensor:
          - name: "Aotea wholesale price forecast"
            unique_id: aotea_wholesale_price
            state_class: measurement
            unit_of_measurement: "NZD/kWh"
            value_template: "{{ value_json.price_forecast[0] | default(none) }}"
    
          - name: "Aotea solar forecast"
            unique_id: aotea_solar_forecast
            device_class: power
            state_class: measurement
            unit_of_measurement: "kW"
            value_template: "{{ value_json.solar_forecast[0] | default(none) }}"
    
          - name: "Aotea load forecast"
            unique_id: aotea_load_forecast
            device_class: power
            state_class: measurement
            unit_of_measurement: "kW"
            value_template: "{{ value_json.load_forecast[0] | default(none) }}"
    SensorShows
    Aotea wholesale price forecastForecast wholesale price, $/kWh.
    Aotea solar forecastForecast solar generation, kW.
    Aotea load forecastForecast household load, kW.

    A sensor is unknown when its forecast doesn't reach the next half hour yet.

  2. Step 2: Restart Home Assistant

    Go to Settings → System → Restart, then search for “Aotea” under Settings → Devices & services → Entities.

Example automation· Optional

Turn something on when the forecast price drops below 10c/kWh. Add it to automations.yaml, or paste it into a new automation's YAML editor in Settings → Automations & scenes. Swap switch.dishwasher for your own device.

automations.yaml
- alias: "Run the dishwasher when power is cheap"
  triggers:
    - trigger: numeric_state
      entity_id: sensor.aotea_wholesale_price_forecast
      below: 0.10
  actions:
    - action: switch.turn_on
      target:
        entity_id: switch.dishwasher