Prices & costs
Needs an API key with the
pricing:read scope.What today's electricity has cost and earned so far, the average price in each direction, and your network's daily fixed charge.
Step 1: Add the sensors
Add this to
configuration.yaml. Today's figures update every 5 minutes; the fixed charge once a day.Fills in every snippet in these docs. It stays in your browser.
configuration.yamlrest: - resource_template: >- {% set tz = 'Pacific/Auckland' %} {% set until = [now(), today_at('00:30')] | max %} {% set start = today_at().strftime('%Y-%m-%d %H:%M:%S') ~ ' ' ~ tz %} {% set end = until.strftime('%Y-%m-%d %H:%M:%S') ~ ' ' ~ tz %} https://api.aoteaenergy.com/api/v1.0.1/billing/data/YOUR_BATTERY_ID?start={{ start | urlencode }}&end={{ end | urlencode }} headers: Authorization: !secret aotea_api_key scan_interval: 300 sensor: - name: "Aotea import cost today" unique_id: aotea_import_cost_today device_class: monetary state_class: total unit_of_measurement: "NZD" value_template: "{{ value_json.total_import_spending }}" - name: "Aotea export earnings today" unique_id: aotea_export_earnings_today device_class: monetary state_class: total unit_of_measurement: "NZD" value_template: "{{ value_json.total_export_earnings }}" - name: "Aotea billed import today" unique_id: aotea_billed_import_today device_class: energy state_class: total_increasing unit_of_measurement: "kWh" value_template: "{{ value_json.total_import_kwh }}" - name: "Aotea billed export today" unique_id: aotea_billed_export_today device_class: energy state_class: total_increasing unit_of_measurement: "kWh" value_template: "{{ value_json.total_export_kwh }}" - name: "Aotea average import price today" unique_id: aotea_avg_import_price_today state_class: measurement unit_of_measurement: "NZD/kWh" value_template: "{{ value_json.avg_import_price }}" - name: "Aotea average export price today" unique_id: aotea_avg_export_price_today state_class: measurement unit_of_measurement: "NZD/kWh" value_template: "{{ value_json.avg_export_price }}" - resource: https://api.aoteaenergy.com/api/v1.0.1/billing/daily-fixed-charge/YOUR_BATTERY_ID headers: Authorization: !secret aotea_api_key scan_interval: 86400 sensor: - name: "Aotea daily fixed charge" unique_id: aotea_daily_fixed_charge unit_of_measurement: "NZD/day" value_template: "{{ value_json.daily_fixed_charge }}"Sensor Shows Aotea import cost today Spent on grid imports since midnight, $. Aotea export earnings today Earned from exports since midnight, $. Aotea billed import today Imported since midnight, kWh. Aotea billed export today Exported since midnight, kWh. Aotea average import price today Average import price, $/kWh. Unknown until 0.5 kWh has been imported. Aotea average export price today Average export price, $/kWh. Unknown until 0.5 kWh has been exported. Aotea daily fixed charge Your network's fixed charge, $/day. The daily fixed charge is unavailable if no network tariff is on file for your site. The other sensors still work.
Step 2: Restart Home Assistant
Go to Settings → System → Restart, then search for “Aotea” under Settings → Devices & services → Entities.
Costs in the Energy dashboard· Optional
Under Settings → Dashboards → Energy, add a grid connection:
- Grid consumption: Aotea billed import today. Choose Use an entity tracking the total costs and pick Aotea import cost today.
- Return to grid: Aotea billed export today. Choose Use an entity tracking the total received money and pick Aotea export earnings today.
The dashboard then shows what each day cost using your actual prices, not a flat rate.