{"openapi":"3.1.0","info":{"title":"Aotea Energy API","version":"0.1.0","description":"The endpoints an Aotea Energy API key can call. Create a key in the Aotea app under API keys and send it as `Authorization: Bearer ak_...`. Each operation lists the scope it needs in `x-scope`; an operation without one accepts any key."},"servers":[{"url":"https://api.aoteaenergy.com"}],"security":[{"api-key":[]}],"tags":[{"name":"Battery"},{"name":"Billing"}],"paths":{"/api/v1.0.1/battery/all":{"get":{"tags":["Battery"],"summary":"Retrieves a detailed list of all batteries the authenticated user can access.","description":"This version of the endpoint returns each battery's details, including the\nuser's battery permission and installation-specific customer type.\n\nRequires the `battery:live` scope when called with an API key. Every caller\nonly gets the pricing and grid frequency/voltage entries of each record's\n`metadata`.","operationId":"get_batteries_list","responses":{"200":{"description":"Battery details for all batteries the user can access","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BatteryInfoResponse"}}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Database query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:live"]}],"x-scope":"battery:live"}},"/api/v1.0.1/battery/data/{id}":{"get":{"tags":["Battery"],"summary":"Retrieves historical time-series data for a battery.","description":"This endpoint fetches aggregated data (solar, grid, home, battery usage, and price)\nfor a specified time range and interval count.\n\nThere are occasional gotchas with abnormal interval to time period ratios. Also, if\nthe version isn't correct, the data call will not work.\n\nRequires the `battery:historical` scope when called with an API key.","operationId":"get_battery_data_v1_0_1","parameters":[{"name":"start","in":"query","description":"The start of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"end","in":"query","description":"The end of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"intervals","in":"query","description":"The number of intervals to return.","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Array of requested historical data for X time period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HistoryDataQueryTime"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Historical query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:historical"]}],"x-scope":"battery:historical"}},"/api/v1.0.1/battery/forecast/{id}":{"get":{"tags":["Battery"],"summary":"Retrieves a battery's load, solar and price forecasts.","description":"Takes the same parameters as `/battery/data/{id}` and returns the forecasts on\nthe same buckets, in the same timezone and time format, so the two responses\ncan share a time axis. The load and solar forecast is the battery's own; the\nprice forecast is the latest PRSS run for its GXP, falling back to PRSL, with\nthe tariff import/export rates for those periods. Only buckets inside the\nwindow that a forecast covers are returned; each series is `null` where its\nforecast doesn't reach.\n\nRequires the `battery:historical` scope when called with an API key.","operationId":"get_battery_forecast_v1_0_1","parameters":[{"name":"start","in":"query","description":"The start of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"end","in":"query","description":"The end of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"intervals","in":"query","description":"The number of intervals to return.","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The battery's load, solar and price forecasts for the window","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatteryForecastResponse"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Forecast query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:historical"]}],"x-scope":"battery:historical"}},"/api/v1.0.1/battery/grid-health/{id}":{"get":{"tags":["Battery"],"summary":"Retrieves the grid at a battery's site over a period: the frequency and\nvoltage its inverter read, and how long it was off grid.","description":"Takes the same `start`, `end` and `bucket_minutes` as `/battery/period/{id}`,\nwith the same validation and buckets, so the app can ask both for one range.\nThe range runs up to the half hour in progress.\n\nEach half hour gets a status from its own readings: `off_grid` when the\ninverter reported itself off grid or its grid relay open, `frequency_excursion`\nwhen at least 1% of its frequency readings were outside 49.5 to 50.5 Hz,\n`voltage_low` or `voltage_high` when its lowest or highest phase averaged\noutside 207–253 V (230 V ± 10%), `normal` otherwise, and `no_data` when the inverter sent\nno grid readings. A bucket and the summary show the worst of their half\nhours, and count how many had each status.\n\nRequires the `battery:historical` scope when called with an API key.","operationId":"get_battery_grid_health_v1_0_1","parameters":[{"name":"id","in":"path","description":"The battery id to look at the grid for","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"start","in":"query","description":"The start of the time range (e.g., \"YYYY-MM-DD HH:MM:SS ZONE\"), rounded\ndown to the half hour.","required":true,"schema":{"type":"string"}},{"name":"end","in":"query","description":"The end of the time range (e.g., \"YYYY-MM-DD HH:MM:SS ZONE\"), rounded down\nto the half hour. Anything after the half hour in progress is left out.","required":true,"schema":{"type":"string"}},{"name":"bucket_minutes","in":"query","description":"How many minutes each bucket covers: 30, 60, 90, 120, 180, 240, 360, 480,\n720 or 1440, at most 1,500 buckets. Leave it out to have the server choose,\nas `/battery/period` does.","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"The grid at the battery's site over the requested period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GridHealthResponse"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Grid health query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:historical"]}],"x-scope":"battery:historical"}},"/api/v1.0.1/battery/period/{id}":{"get":{"tags":["Battery"],"summary":"Retrieves a battery's energy and grid prices over a period, added up from its\ntrading periods.","description":"Takes `start` and `end` in the same format as `/battery/data/{id}`, but\nstricter: both are rounded down to the half hour, `start` must be before\n`end`, and the range must hold at least one whole half hour. It works the\nrange out one trading period at a time before adding it up: over the whole\nrange (`summary`) and in buckets `bucket_minutes` wide (`buckets`), which\nstart on those clock times in the range's timezone. Leave `bucket_minutes`\nout to have the server choose it; a requested width may split the range into\nat most 1,500 buckets.\n\nEach of those gives the kWh through the home, solar, battery and grid\n(`energy`, with each direction of the battery and grid on its own), and for\nimport and for export the market's average price, the cheapest and dearest\ntrading period with its time, what the grid kWh cost or earned, and the\nprice per kWh that works out to. A bucket's figures come from the half hours\ninside it, never from its average. Prices are the wholesale price at the\ninstallation's GXP plus the network rate, in $/kWh before GST and the levy.\n\nThe range is trimmed to whole trading periods that have finished, and can be\nat most 366 days. A trading period with no wholesale price is left out of the\nprice and money figures entirely, network rate included, and shows in\n`priced_periods`.\n\nThe kWh are the battery's own readings, not the ICP meter's, and unpriced\ntrading periods carry no network charge here, so the money figures won't\nmatch `/billing/data` exactly.\n\nRequires the `battery:historical` scope when called with an API key.","operationId":"get_battery_period_v1_0_1","parameters":[{"name":"id","in":"path","description":"The battery id to add the period up for","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"start","in":"query","description":"The start of the time range (e.g., \"YYYY-MM-DD HH:MM:SS ZONE\"), rounded\ndown to the half hour.","required":true,"schema":{"type":"string"}},{"name":"end","in":"query","description":"The end of the time range (e.g., \"YYYY-MM-DD HH:MM:SS ZONE\"), rounded down\nto the half hour. Trading periods still in progress are left out.","required":true,"schema":{"type":"string"}},{"name":"bucket_minutes","in":"query","description":"How many minutes each bucket covers: 30, 60, 90, 120, 180, 240, 360, 480,\n720 or 1440. Buckets start on those clock times in the range's timezone,\nand the range may split into at most 1,500 of them (half hourly over 30\ndays). Leave it out to get the finest of 30 minutes, 1 hour, 3 hours, 6 hours or\na day that covers the range in at most 60 buckets.","required":false,"schema":{"type":["integer","null"],"format":"int64"}}],"responses":{"200":{"description":"The battery's energy and prices for the requested period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatteryPeriodResponse"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Period query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:historical"]}],"x-scope":"battery:historical"}},"/api/v1.0.1/battery/telemetry/{id}":{"get":{"tags":["Battery"],"summary":"Retrieves a battery's power and SOC in fine-grained buckets.","description":"Takes the same parameters as `/battery/data/{id}`, with the same date\nvalidation, and returns the range in the same time format. Unlike\n`/battery/data`, buckets aren't rolled up to 30-minute trading periods first,\nand there are no price, tariff or billing series. Intervals the battery sent\nnothing in are `null`.\n\n`intervals` is optional. Given, it splits the range into that many equal\nbuckets: at most 200, each at least 5 seconds. Left out, the server picks the\nfinest standard step (5 seconds up to a week) that fits the range in at most\n200 buckets, starting on a whole step. `bucket_seconds` in the response says\nwhich.\n\nRequires the `battery:historical` scope when called with an API key.","operationId":"get_battery_telemetry_v1_0_1","parameters":[{"name":"start","in":"query","description":"The start of the time range (e.g., \"YYYY-MM-DD HH:MM:SS ZONE\").","required":true,"schema":{"type":"string"}},{"name":"end","in":"query","description":"The end of the time range (e.g., \"YYYY-MM-DD HH:MM:SS ZONE\").","required":true,"schema":{"type":"string"}},{"name":"intervals","in":"query","description":"The number of equal intervals to split the range into, at most 200, each\nat least 5 seconds long. Leave it out to get the finest of 5s, 10s, 15s,\n30s, 1m, 2m, 5m, 10m, 15m, 30m, 1h, 2h, 3h, 6h, 12h, 1d or 1w that fits the\nrange in at most 200 intervals, starting on a whole step.","required":false,"schema":{"type":["integer","null"],"format":"int32"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The battery's telemetry for the requested period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatteryTelemetryResponse"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Telemetry query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:historical"]}],"x-scope":"battery:historical"}},"/api/v1.0.1/billing/daily-fixed-charge/{id}":{"get":{"tags":["Billing"],"summary":"Retrieves the daily fixed charge for a battery's installation.","description":"The charge is resolved by walking from the battery to its installation, matching the\ninstallation's ICP to the network tariff in force today (ClickHouse `icp_tariffs`) and\nreturning that tariff's daily fixed charge.\n\nRequires the `pricing:read` scope when called with an API key.","operationId":"get_daily_fixed_charge","parameters":[{"name":"id","in":"path","description":"The battery id to resolve the daily fixed charge for","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Successfully resolved the daily fixed charge","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyChargeResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No EDB tariff found for the battery's installation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Failed to get data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["pricing:read"]}],"x-scope":"pricing:read"}},"/api/v1.0.1/billing/data/{id}":{"get":{"tags":["Billing"],"summary":"Retrieves import and export totals, and what they cost and earned, for a time range.","description":"Totals come from the smart meter reads for the battery's installation ICP, one per\ntrading period that starts inside the range. Each period's import is priced at the\nwholesale price at the installation's GXP plus the network import rate, and its export\nat the wholesale price plus any network export credit. Spending and earnings are in $,\naverage prices in $/kWh. Fixed daily charges are not included.\n\nMeter reads usually arrive a day or two late, and sometimes skip periods. Each whole\nhalf hour up to now that the meter has no reads for uses the battery's own grid\nreadings instead, so recent totals are estimates until the meter catches up. The\nhalf hour in progress is left out. A battery without an installation returns zeros.\n\nRequires the `pricing:read` scope when called with an API key.","operationId":"get_financial_stats_data","parameters":[{"name":"start","in":"query","description":"The start of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"end","in":"query","description":"The end of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Successfuly got n days summed of results","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinanceDataQueryTime"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Failed to get data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["pricing:read"]}],"x-scope":"pricing:read"}},"/api/v1.0.1/billing/period/{id}":{"get":{"tags":["Billing"],"summary":"Retrieves every figure on the app's billing page for one month.","description":"A billing period runs from the 1st of the month (or the day the customer joined, if\nlater) to the 1st of the next month, when it is billed. For the current month the\nfigures run to midnight this morning and include a projection for the whole period;\nfor a past month they are the final bill.\n\nUsage comes from the installation's smart meter, with the battery's own readings\nfilling any half hour the meter has no read for yet (counted as `estimated_periods`).\nEach half hour is priced on its own: the wholesale price at the installation's GXP,\nthe EDB's network rates and the Electricity Authority levy, with GST added to the import\ncharges (exports are paid GST free). Fixed daily charges, the projection, run rates and\nthe comparison with last month follow the billing page's rules.\n\nOnly batteries on Aotea's trading plan have a bill.\n\nRequires the `pricing:read` scope when called with an API key.","operationId":"get_billing_period","parameters":[{"name":"id","in":"path","description":"The battery id to show the bill for","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"month","in":"query","description":"The month, as `YYYY-MM` in New Zealand time. Omit for the current month.","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"The billing page's figures for the month","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingPeriodResponse"}}}},"400":{"description":"Invalid month: badly formatted, in the future, or before the customer joined","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"The battery isn't on Aotea's trading plan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Failed to get data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["pricing:read"]}],"x-scope":"pricing:read"}},"/api/v1/battery/all":{"get":{"tags":["Battery"],"summary":"Retrieves a list of all batteries the authenticated user can access.","description":"The response includes each battery's ID and its assigned name.","operationId":"get_battery_id","responses":{"200":{"description":"Array of requested battery id's and names that a user owns/can access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatteryListV1Response"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"battery_user & battery_owner query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":[]}]}},"/api/v1/battery/data/{id}":{"get":{"tags":["Battery"],"summary":"Retrieves historical time-series data for a battery.","description":"This endpoint fetches aggregated data (solar, grid, home, battery usage,\ntariff rates, and wholesale price) for a specified time range and interval count.\n\nThere are occasional gotchas with abnormal interval to time period ratios.\n\nRequires the `battery:historical` scope when called with an API key.","operationId":"get_data","parameters":[{"name":"start","in":"query","description":"The start of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"end","in":"query","description":"The end of the time range (e.g., \"YYYY-MM-DD HH:MM:SS\").","required":true,"schema":{"type":"string"}},{"name":"intervals","in":"query","description":"The number of intervals to return.","required":true,"schema":{"type":"integer","format":"int32"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Array of requested historical data for X time period","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HistoryDataQueryTime"}}}},"400":{"description":"Invalid input data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Battery doesnt exist or User is not an owner/user of the battery","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Historical query failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:historical"]}],"x-scope":"battery:historical"}},"/api/v1/battery/last/{id}":{"get":{"tags":["Battery"],"summary":"Retrieves the most recent data point recorded for a specific battery.","description":"Requires the `battery:live` scope when called with an API key. Every caller\nonly gets the pricing and grid frequency/voltage entries of the record's\n`metadata`.","operationId":"get_last_saved","parameters":[{"name":"limit","in":"query","description":"The maximum number of data points to return.","required":false,"schema":{"type":["integer","null"],"format":"int64"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Successfully retrieved last saved battery data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatteryData"}}}},"401":{"description":"Failed authentication","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Retrieving last saved battery data failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"security":[{"api-key":["battery:live"]}],"x-scope":"battery:live"}}},"components":{"schemas":{"BatteryData":{"allOf":[{"$ref":"#/components/schemas/BatteryDataVersioned"},{"type":"object","required":["id"],"properties":{"id":{"type":"string","format":"uuid"},"metadata":{"type":["object","null"],"additionalProperties":{},"propertyNames":{"type":"string"}}}}],"description":"Battery Data Type with static values e.g. time and id and versioning for core data.\n"},"BatteryDataV1_0_0":{"type":"object","required":["time","alarms"],"properties":{"ac_input":{"type":["number","null"],"format":"float"},"ac_load":{"type":["number","null"],"format":"float"},"alarms":{"type":"array","items":{"type":["integer","null"],"format":"int32","minimum":0}},"current":{"type":["number","null"],"format":"float"},"inverter_state":{"type":["integer","null"],"format":"int32"},"overall_temp":{"type":["number","null"],"format":"float"},"pv_current":{"type":["number","null"],"format":"float"},"pv_max":{"type":["number","null"],"format":"float"},"pv_power":{"type":["number","null"],"format":"float"},"pv_voltage":{"type":["number","null"],"format":"float"},"soc":{"type":["integer","null"],"format":"int32"},"soh":{"type":["integer","null"],"format":"int32"},"time":{"type":"integer","format":"int64","minimum":0},"total_voltage":{"type":["number","null"],"format":"float"}}},"BatteryDataV1_0_1":{"type":"object","required":["time","alarms"],"properties":{"ac_input":{"type":["number","null"],"format":"float"},"ac_load":{"type":["number","null"],"format":"float"},"alarms":{"type":"array","items":{"type":"string"},"uniqueItems":true},"current":{"type":["number","null"],"format":"float"},"inverter_state":{"type":["integer","null"],"format":"int32"},"overall_temp":{"type":["number","null"],"format":"float"},"pv_current":{"type":["number","null"],"format":"float"},"pv_max":{"type":["number","null"],"format":"float"},"pv_power":{"type":["number","null"],"format":"float"},"pv_voltage":{"type":["number","null"],"format":"float"},"soc":{"type":["number","null"],"format":"float"},"soh":{"type":["number","null"],"format":"float"},"time":{"type":"string","format":"date-time"},"total_voltage":{"type":["number","null"],"format":"float"}}},"BatteryDataV1_0_2":{"type":"object","required":["time","events"],"properties":{"ac_input":{"type":["number","null"],"format":"float"},"ac_load":{"type":["number","null"],"format":"float"},"current":{"type":["number","null"],"format":"float"},"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"},"uniqueItems":true},"inverter_state":{"type":["integer","null"],"format":"int32"},"overall_temp":{"type":["number","null"],"format":"float"},"pv_current":{"type":["number","null"],"format":"float"},"pv_max":{"type":["number","null"],"format":"float"},"pv_power":{"type":["number","null"],"format":"float"},"pv_voltage":{"type":["number","null"],"format":"float"},"soc":{"type":["number","null"],"format":"float"},"soh":{"type":["number","null"],"format":"float"},"time":{"type":"string","format":"date-time"},"total_voltage":{"type":["number","null"],"format":"float"}}},"BatteryDataVersioned":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/BatteryDataV1_0_0"},{"type":"object","required":["version"],"properties":{"version":{"type":"string","enum":["V1_0_0"]}}}]},{"allOf":[{"$ref":"#/components/schemas/BatteryDataV1_0_1"},{"type":"object","required":["version"],"properties":{"version":{"type":"string","enum":["V1_0_1"]}}}]},{"allOf":[{"$ref":"#/components/schemas/BatteryDataV1_0_2"},{"type":"object","required":["version"],"properties":{"version":{"type":"string","enum":["V1_0_2"]}}}]},{"allOf":[{"type":"object","additionalProperties":{},"propertyNames":{"type":"string"}},{"type":"object","required":["version"],"properties":{"version":{"type":"string","enum":["Unknown"]}}}]}],"description":"This is the core enum for the battery data versions.\nWhen adding a new version, follow these instructions:\n\n`#[ts(rename = \"1.0.N\")]`\n`#[serde(rename(serialize = \"1.0.N\", deserialize = \"1.0.N\"))]`\n`V1_0_N(battery::BatteryDataV1_0_N),`\n\n//Then add it to the last Unknown enum variant exclude type.\n`#[ts(type = \"{ version: Exclude<string, '1.0.0' | '1.0.1' | '1.0.N'> } & Record<string, string>\")]`\n"},"BatteryForecastResponse":{"type":"object","description":"A battery's load, solar and price forecasts, bucketed like `/battery/data`.\n\nCalled with the same `start`, `end` and `intervals` as `/battery/data`, every\nentry in `time_data` lines up with a bucket there. Only buckets one of the\nforecasts covers are returned. The two forecasts cover different spans, so\neach series is `null` in buckets its forecast doesn't reach.","required":["time_data","load_forecast","solar_forecast","price_forecast","tariff_import_forecast","tariff_export_forecast"],"properties":{"generated_at":{"type":["string","null"],"description":"When the battery produced its load/solar forecast, or `null` when it has\nnone."},"load_forecast":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Forecast household load, kW."},"price_forecast":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Forecast spot price at the battery's GXP, $/kWh. The latest PRSS run,\nfalling back to the latest PRSL run."},"solar_forecast":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Forecast solar generation, kW."},"tariff_export_forecast":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Tariff export rate, $/kWh, as a magnitude."},"tariff_import_forecast":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Tariff import rate, $/kWh."},"time_data":{"type":"array","items":{"type":"string"}}}},"BatteryInfoResponse":{"type":"object","description":"Contains detailed information about a single battery for the list response.","required":["id","name","system_type","solar_present","role","trading_type"],"properties":{"billing_info":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BillingInfoResponse","description":"The billing info for the battery if available."}]},"id":{"type":"string","format":"uuid","description":"The battery's unique identifier."},"last_record":{"type":["string","null"],"description":"The last record for the battery if available. pulls from the battery_data_latest\nmaterialzied view/cagg"},"name":{"type":"string","description":"The battery's name."},"role":{"$ref":"#/components/schemas/Role","description":"the users role for the battery."},"solar_present":{"type":"boolean","description":"Whether the battery has solar, as its settings row reports it\n(`reported_hardware.solar_present`). False when the battery has never reported."},"system_type":{"$ref":"#/components/schemas/SystemTypeEnum","description":"The battery's system type. e.g. `no_solar`, `default`, 'no_grid' etc."},"trading_type":{"type":"string","description":"Whether the battery is trading with us. e.g. 'wholesale' or 'other'."}}},"BatteryListV1Response":{"type":"object","description":"Represents the response containing a list of batteries.","required":["data"],"properties":{"data":{"type":"array","items":{"type":"array","items":false,"prefixItems":[{"type":"string","format":"uuid"},{"type":"string"}]},"description":"A vector of tuples, where each tuple contains a battery's `Uuid` and name."}}},"BatteryPeriodResponse":{"type":"object","description":"A battery over a range, as a whole and bucket by bucket: the energy that went\nthrough the home, solar, battery and grid, and what the grid power cost and\nearned against the market.\n\nEvery figure is worked out from the range's trading periods one at a time,\nbefore any bucketing, so a bucket never stands in for the half hours inside\nit: its energy is the sum of theirs, not an average power. Prices are in\n$/kWh and money in $, before GST: the wholesale price at the installation's\nGXP plus the network import rate (for `import`) or plus the network export\ncredit (for `export`). The levy and fixed charges aren't included, as in\n`/billing/data`.","required":["battery_id","bucket_minutes","summary","buckets"],"properties":{"battery_id":{"type":"string","format":"uuid","description":"The battery id."},"bucket_minutes":{"type":"integer","format":"int64","description":"How many minutes each bucket covers, whether requested or chosen."},"buckets":{"type":"array","items":{"$ref":"#/components/schemas/PeriodTotals"},"description":"The range split into buckets, in time order. A bucket at either end of\nthe range can be cut short; `periods` says how many half hours it holds."},"summary":{"$ref":"#/components/schemas/PeriodTotals","description":"The whole range."},"timing_saving":{"type":["number","null"],"format":"double","description":"What using the grid when the customer did made, in $, against moving the\nsame kWh at the range's average prices: each kWh imported counts the\naverage import price less what it cost, and each kWh exported what it\nearned less the average export price. Negative when the timing cost\nmoney. `null` when no trading period in the range has a price."}}},"BatteryTelemetryResponse":{"type":"object","description":"A battery's power and SOC in fine-grained buckets.\n\nLike `/battery/data`'s response without the price, tariff and billing series.\nEvery `*_data` series lines up with `time_data`, one entry per requested\ninterval. Intervals the battery sent no telemetry in are `null` rather than\nzero, so a comms gap reads as a gap.","required":["bucket_seconds","time_data","solar_data","grid_data","home_data","battery_data","soc_data"],"properties":{"battery_data":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Average battery flow, kW, with the same sign as `/battery/data`'s\n`battery_data`."},"bucket_seconds":{"type":"number","format":"double","description":"The length of each interval in seconds, whether requested or chosen."},"grid_data":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Average grid flow, kW, with the same sign as `/battery/data`'s `grid_data`."},"home_data":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Average household load, kW."},"soc_data":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"The last state of charge reported in the interval, %. `null` when no\npacket in the interval carried one."},"solar_data":{"type":"array","items":{"type":["number","null"],"format":"double"},"description":"Average solar generation, kW."},"time_data":{"type":"array","items":{"type":"string"},"description":"The start of each interval, in the request's timezone and the same\nformat as `/battery/data` (`YYYY-MM-DD HH:MM:SS ZONE`)."}}},"BillingDay":{"type":"object","description":"One day's energy spend.","required":["date","spend","spend_ex_gst","import_kwh","export_kwh","metered_periods","estimated_periods"],"properties":{"date":{"type":"string","description":"The day in New Zealand, as `YYYY-MM-DD`."},"estimated_periods":{"type":"integer","format":"int32","description":"Half hours taken from the battery's own readings.","minimum":0},"export_kwh":{"type":"number","format":"double","description":"kWh sent to the grid."},"import_kwh":{"type":"number","format":"double","description":"kWh drawn from the grid."},"metered_periods":{"type":"integer","format":"int32","description":"Half hours read by the meter.","minimum":0},"spend":{"type":"number","format":"double","description":"Energy spend, GST included. Negative when the day earned more than it cost."},"spend_ex_gst":{"type":"number","format":"double","description":"Energy spend before GST."}}},"BillingEnergy":{"type":"object","description":"Energy charges, worked out per half hour and added up.","required":["import_kwh","export_kwh","wholesale","network","levy","gst","total_ex_gst","total","metered_periods","estimated_periods","unpriced_periods"],"properties":{"estimated_periods":{"type":"integer","format":"int32","description":"Half hours the meter has no reads for yet, taken from the battery's own readings.","minimum":0},"export_kwh":{"type":"number","format":"double","description":"kWh sent to the grid."},"gst":{"type":"number","format":"double","description":"GST on the import charges (wholesale, network and levy). Exports are paid GST free,\nso their earnings don't reduce it."},"import_kwh":{"type":"number","format":"double","description":"kWh drawn from the grid."},"levy":{"type":"number","format":"double","description":"The Electricity Authority levy on imports."},"metered_periods":{"type":"integer","format":"int32","description":"Half hours read by the meter.","minimum":0},"network":{"type":"number","format":"double","description":"Network import charges less network export credits."},"total":{"type":"number","format":"double","description":"`total_ex_gst + gst`."},"total_ex_gst":{"type":"number","format":"double","description":"`wholesale + network + levy`."},"unpriced_periods":{"type":"integer","format":"int32","description":"Half hours with no wholesale price yet. Their wholesale cost isn't in `wholesale`,\nso the figures are incomplete while this isn't zero.","minimum":0},"wholesale":{"type":"number","format":"double","description":"Wholesale cost of the imports less wholesale earnings on the exports."}}},"BillingFixedCharges":{"type":"object","description":"The fixed daily charges over some days.","required":["network","metering","subscription","gst","total","days_without_network_tariff"],"properties":{"days_without_network_tariff":{"type":"integer","format":"int64","description":"Days no EDB tariff covers. Their network charge isn't known, so it isn't in\n`network`, and the charges are incomplete while this isn't zero."},"gst":{"type":"number","format":"double","description":"GST on the three charges."},"metering":{"type":"number","format":"double","description":"The daily metering charge."},"network":{"type":"number","format":"double","description":"The installation's EDB daily charge, for the days an EDB tariff covers."},"subscription":{"type":"number","format":"double","description":"The Aotea subscription, spread evenly over the days of the month."},"total":{"type":"number","format":"double","description":"The three charges with their GST."}}},"BillingInfoResponse":{"type":"object","description":"The response body for the v1.0.1 billing daily fixed charge endpoint.","required":["tariff_code","daily_fixed_charge"],"properties":{"daily_fixed_charge":{"type":"number","format":"double","description":"The daily fixed charge in $/day."},"tariff_code":{"type":"string"},"tariff_name":{"type":["string","null"],"description":"The human readable name of the matched EDB tariff."}}},"BillingPeriodDates":{"type":"object","description":"When a billing period starts, runs to and is billed.","required":["start","end","billing_date","elapsed_days","total_days","remaining_days","progress"],"properties":{"billing_date":{"type":"string","format":"date-time","description":"When the period is billed: midnight on the 1st of the next month."},"elapsed_days":{"type":"integer","format":"int64","description":"Whole days from `start` to `end`."},"end":{"type":"string","format":"date-time","description":"The figures cover up to here: midnight this morning for the current month (the\ncurrent hour on the day the customer joined), the end of the month otherwise."},"progress":{"type":"number","format":"double","description":"How far through the period `end` is, from 0 to 1."},"remaining_days":{"type":"integer","format":"int64","description":"Days from `end` to `billing_date`."},"start":{"type":"string","format":"date-time","description":"The start of billing: midnight on the 1st, or on the day the customer joined if later."},"total_days":{"type":"integer","format":"int64","description":"Days from `start` to `billing_date`."}}},"BillingPeriodResponse":{"type":"object","description":"The response body for the v1.0.1 billing period endpoint: every figure on the app's\nbilling page for one month.\n\nMoney is in NZ dollars. Spend is positive for a cost and negative for a credit, except\n`stats.energy_profit_loss`, which is positive for earnings.","required":["battery_id","month","is_current_month","period","spent","run_rate","daily","stats","rates"],"properties":{"battery_id":{"type":"string","format":"uuid","description":"The battery id."},"daily":{"type":"array","items":{"$ref":"#/components/schemas/BillingDay"},"description":"Energy spend for each day of the period so far, for the daily chart."},"is_current_month":{"type":"boolean","description":"Whether the month is still in progress. Only the current month has a projection."},"month":{"type":"string","description":"The month shown, as `YYYY-MM`."},"period":{"$ref":"#/components/schemas/BillingPeriodDates","description":"When the period starts, runs to and is billed."},"projected":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BillingProjected","description":"The whole period's projected bill. Only for the current month."}]},"rates":{"$ref":"#/components/schemas/BillingRates","description":"The rates behind the figures, for labelling them."},"run_rate":{"$ref":"#/components/schemas/BillingRunRate","description":"Average spend per day."},"spent":{"$ref":"#/components/schemas/BillingSpent","description":"What the period has cost so far; the final bill for a past month."},"stats":{"$ref":"#/components/schemas/BillingStats","description":"The headline figures, with last month's for comparison."}}},"BillingProjected":{"type":"object","description":"A billing period's projected bill: what has been spent, plus the rest of the period's\nenergy at a daily rate, plus the whole period's fixed charges.","required":["energy_to_date_ex_gst","energy_forecast_ex_gst","forecast_daily_rate","forecast_daily_rate_ex_gst","forecast_basis","fixed","gst","total"],"properties":{"energy_forecast_ex_gst":{"type":"number","format":"double","description":"Energy charges forecast for the remaining days, before GST."},"energy_to_date_ex_gst":{"type":"number","format":"double","description":"Energy charges so far, before GST."},"fixed":{"$ref":"#/components/schemas/BillingFixedCharges","description":"Fixed charges for every day of the period."},"forecast_basis":{"type":"string","description":"Where the daily rate comes from: `last_month` (last month's energy over its billed\ndays) or `this_month` (this month's so far, when last month has no bill)."},"forecast_daily_rate":{"type":"number","format":"double","description":"The forecast's daily energy rate, GST included."},"forecast_daily_rate_ex_gst":{"type":"number","format":"double","description":"The forecast's daily energy rate, before GST."},"gst":{"type":"number","format":"double","description":"GST on energy so far, forecast energy and the fixed charges."},"total":{"type":"number","format":"double","description":"The projected bill, GST included."}}},"BillingRates":{"type":"object","description":"The rates behind the billing figures.","required":["gst_rate","levy_per_kwh","daily_metering_charge","monthly_subscription","daily_subscription","comparison_import_rate","comparison_export_rate"],"properties":{"comparison_export_rate":{"type":"number","format":"double","description":"The typical retailer's export buyback per kWh."},"comparison_import_rate":{"type":"number","format":"double","description":"The typical retailer's import price per kWh, GST included."},"daily_metering_charge":{"type":"number","format":"double","description":"The daily metering charge, before GST."},"daily_network_charge":{"type":["number","null"],"format":"double","description":"The EDB daily charge on the latest day of the period so far, before GST. Null when no\nEDB tariff covers that day."},"daily_subscription":{"type":"number","format":"double","description":"The subscription per day of this month, before GST."},"gst_rate":{"type":"number","format":"double","description":"GST as a fraction, e.g. 0.15."},"levy_per_kwh":{"type":"number","format":"double","description":"The Electricity Authority levy per kWh imported, before GST."},"monthly_subscription":{"type":"number","format":"double","description":"The monthly Aotea subscription, before GST."}}},"BillingRunRate":{"type":"object","description":"Average spend per day.","required":["so_far","energy"],"properties":{"energy":{"type":"number","format":"double","description":"Energy spend so far over the elapsed days, without fixed charges."},"projected":{"type":["number","null"],"format":"double","description":"The projected bill over the period's days. Only for the current month."},"so_far":{"type":"number","format":"double","description":"Spend so far over the elapsed days, fixed charges included."}}},"BillingSpent":{"type":"object","description":"What a billing period has cost so far.","required":["energy","fixed","gst","total"],"properties":{"energy":{"$ref":"#/components/schemas/BillingEnergy","description":"Energy charges over the period so far."},"fixed":{"$ref":"#/components/schemas/BillingFixedCharges","description":"Fixed charges for the days elapsed."},"gst":{"type":"number","format":"double","description":"GST on energy and fixed charges together."},"total":{"type":"number","format":"double","description":"Everything together, GST included."}}},"BillingStat":{"type":"object","description":"A figure this period and over the same stretch of last month.","properties":{"change_percent":{"type":["number","null"],"format":"double","description":"The change from `previous` to `current` in percent. Null when either is missing or\n`previous` is too close to zero."},"current":{"type":["number","null"],"format":"double","description":"This period's value. Null when there is nothing to show."},"previous":{"type":["number","null"],"format":"double","description":"Last month's value, up to the same day for the current month and all of it otherwise."}}},"BillingStats":{"type":"object","description":"The billing page's headline figures.","required":["savings_vs_typical_retailer","average_energy_price","energy_profit_loss","net_grid_kwh"],"properties":{"average_energy_price":{"$ref":"#/components/schemas/BillingStat","description":"The average wholesale price over the period's half hours, with the levy and GST\nadded, in $/kWh."},"energy_profit_loss":{"$ref":"#/components/schemas/BillingStat","description":"Energy earnings (positive) or expenses (negative), GST included."},"net_grid_kwh":{"$ref":"#/components/schemas/BillingStat","description":"kWh imported less kWh exported. Positive means more was imported."},"savings_vs_typical_retailer":{"$ref":"#/components/schemas/BillingStat","description":"What a typical fixed-rate retailer would have charged for the same kWh, less the\nenergy spend. Positive is a saving."}}},"DailyChargeResponse":{"type":"object","description":"The response body for the v1.0.1 billing daily fixed charge endpoint.","required":["battery_id","tariff_code","daily_fixed_charge"],"properties":{"battery_id":{"type":"string","format":"uuid","description":"the battery id"},"daily_fixed_charge":{"type":"number","format":"double","description":"The daily fixed charge in $/day."},"tariff_code":{"type":"string","description":"The EDB tariff code matched via the installation's ICP distributor price category code."},"tariff_name":{"type":["string","null"],"description":"The human readable name of the matched EDB tariff."}}},"ErrorResponse":{"type":"object","description":"A generic error response containing a string message.","required":["error"],"properties":{"error":{"type":"string"}}},"Event":{"type":"object","description":"Alarms Type for all code bases\nShould be able to construct backwards and forwards from a string to an alarm type\ne.g. from `\"Over Voltage Alarm - Voltage above 58v by 0.4v from bms\"` to an Alarm struct:\n`kind = \"Alarm\",`\n`name = \"Over Voltage\",`\n`details = Some(\"Voltage above 58v by 0.4v from bms\")`\n","required":["kind","name"],"properties":{"details":{"type":["string","null"]},"kind":{"$ref":"#/components/schemas/EventKind"},"name":{"type":"string"}}},"EventKind":{"type":"string","description":"It is important to **order** from **\"lowest\"** impact to **\"highest\"** impact e.g. alarm should be higher in value then info\ntherefore it would go\n```json\n    Info\n    ...\n    Alarm\n```\nthis is because the enum needs to be ordered by the value of the variant\nallowing me to go\n```rust\nuse shared_types::battery::Event;\nuse shared_types::battery::EventKind;\n\nlet event = Event::new(EventKind::Alarm, \"Over Voltage\".to_string(), None);\nlet event2 = Event::new(EventKind::Info, \"Over Voltage\".to_string(), None);\nassert!(event.kind > event2.kind);\n// or\nlet mut events = vec![event, event2];\nevents.sort_by(|a, b| a.kind.cmp(&b.kind));\n// or even\nlet events_to_send = events.into_iter().filter(|e| e.kind > EventKind::Info).collect::<Vec<Event>>();\nassert_eq!(events_to_send.len(), 1);\nassert_eq!(events_to_send[0].kind, EventKind::Alarm);\n```","enum":["Info","Warning","Alarm"]},"FinanceDataQueryTime":{"type":"object","required":["battery_id","gxp_code","total_import_kwh","total_export_kwh","total_import_spending","total_export_earnings"],"properties":{"avg_export_price":{"type":["number","null"],"format":"double","description":"The average export price in $/kWh. Null below 0.5 kWh of exports."},"avg_import_price":{"type":["number","null"],"format":"double","description":"The average import price in $/kWh. Null below 0.5 kWh of imports."},"battery_id":{"type":"string","format":"uuid","description":"the battery id"},"gxp_code":{"type":"string","description":"The installation's GXP, whose wholesale prices are used. Empty without an installation."},"total_export_earnings":{"type":"number","format":"double","description":"What the exports earned in $: wholesale price plus any network export credit."},"total_export_kwh":{"type":"number","format":"double","description":"The kWh the meter recorded sent to the grid over the time period."},"total_import_kwh":{"type":"number","format":"double","description":"The kWh the meter recorded drawn from the grid over the time period."},"total_import_spending":{"type":"number","format":"double","description":"What the imports cost in $: wholesale price plus the network import rate."}}},"GridFrequency":{"type":"object","description":"Grid frequency readings over a stretch of half hours. Readings of 0 Hz,\nwhich inverters send while off grid, are left out.","required":["average_hz","min_hz","max_hz","excursion_share"],"properties":{"average_hz":{"type":"number","format":"double"},"excursion_share":{"type":"number","format":"double","description":"The share of readings, 0 to 1, outside the frequency limits."},"max_hz":{"type":"number","format":"double"},"min_hz":{"type":"number","format":"double"}}},"GridHealthResponse":{"type":"object","description":"The grid at a battery's site over a range, as a whole and bucket by bucket:\nthe frequency and voltage its inverter read, and how long it was off grid.\n\nEach half hour gets a [`GridStatus`] from its own readings, and a bucket or\nthe summary shows the worst of its half hours, with `status_periods` counting\nhow many half hours had each. Readings are the inverter's own, every few\nseconds, so they are as accurate as that inverter's metering.","required":["battery_id","bucket_minutes","limits","summary","buckets"],"properties":{"battery_id":{"type":"string","format":"uuid","description":"The battery id."},"bucket_minutes":{"type":"integer","format":"int64","description":"How many minutes each bucket covers, whether requested or chosen."},"buckets":{"type":"array","items":{"$ref":"#/components/schemas/GridHealthTotals"},"description":"The range split into buckets, in time order, up to the half hour in\nprogress. A bucket with no readings is still listed, as `no_data`."},"limits":{"$ref":"#/components/schemas/GridLimits","description":"The limits the statuses are judged against, for drawing them."},"summary":{"$ref":"#/components/schemas/GridHealthTotals","description":"The whole range."}}},"GridHealthTotals":{"type":"object","description":"A stretch of half hours of grid readings.","required":["start","end","periods","samples","status","status_periods"],"properties":{"end":{"type":"string","description":"The end of the last half hour, in the same format."},"frequency":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/GridFrequency","description":"The grid frequency. `null` when the inverter reported none."}]},"off_grid_share":{"type":["number","null"],"format":"double","description":"The share of readings, 0 to 1, with the inverter off grid or its grid\nrelay open. `null` for inverters that don't report either."},"periods":{"type":"integer","format":"int32","description":"How many half hours are counted.","minimum":0},"samples":{"type":"integer","format":"int64","description":"How many readings the inverter sent.","minimum":0},"start":{"type":"string","description":"The start of the first half hour, in the request's timezone and the same\nformat as `/battery/data` (`YYYY-MM-DD HH:MM:SS ZONE`)."},"status":{"$ref":"#/components/schemas/GridStatus","description":"The worst of the half hours' statuses."},"status_periods":{"$ref":"#/components/schemas/GridStatusCounts","description":"How many half hours had each status."},"voltage":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/GridVoltage","description":"The grid voltage, across every phase the site has. `null` when the\ninverter reported none."}]}}},"GridLimits":{"type":"object","description":"The limits a half hour's readings are judged against.","required":["voltage_min_volts","voltage_max_volts","frequency_min_hz","frequency_max_hz"],"properties":{"frequency_max_hz":{"type":"number","format":"double","description":"Above this the frequency counts as an excursion."},"frequency_min_hz":{"type":"number","format":"double","description":"Below this the frequency counts as an excursion."},"voltage_max_volts":{"type":"number","format":"double","description":"Upper threshold for nominal 230 V supply in New Zealand (253 V)."},"voltage_min_volts":{"type":"number","format":"double","description":"Lower threshold for nominal 230 V supply in New Zealand (207 V)."}}},"GridStatus":{"type":"string","description":"How the grid was over a half hour, or the worst of a stretch of them. Listed\nfrom least to most serious.","enum":["no_data","normal","voltage_high","voltage_low","frequency_excursion","off_grid"]},"GridStatusCounts":{"type":"object","description":"How many half hours had each [`GridStatus`].","required":["no_data","normal","voltage_high","voltage_low","frequency_excursion","off_grid"],"properties":{"frequency_excursion":{"type":"integer","format":"int32","minimum":0},"no_data":{"type":"integer","format":"int32","minimum":0},"normal":{"type":"integer","format":"int32","minimum":0},"off_grid":{"type":"integer","format":"int32","minimum":0},"voltage_high":{"type":"integer","format":"int32","minimum":0},"voltage_low":{"type":"integer","format":"int32","minimum":0}}},"GridVoltage":{"type":"object","description":"Grid voltage readings over a stretch of half hours. A phase reading under\n50 V, as unwired phases and an off-grid inverter read, is left out.","required":["average_volts","min_volts","max_volts","over_share","under_share"],"properties":{"average_volts":{"type":"number","format":"double","description":"The mean of each reading's phases."},"max_volts":{"type":"number","format":"double","description":"The highest any phase read."},"min_volts":{"type":"number","format":"double","description":"The lowest any phase read."},"over_share":{"type":"number","format":"double","description":"The share of readings, 0 to 1, with a phase over the voltage limit."},"under_share":{"type":"number","format":"double","description":"The share of readings, 0 to 1, with a phase under the voltage limit."}}},"HistoryDataQueryTime":{"type":"object","description":"Represents historical data with timezone-corrected timestamps.\n\nThis struct is intended for serialization as an API response, providing\ntimestamps as formatted strings in the requested timezone.","required":["time_data","solar_data","grid_data","home_data","battery_data","soc_data","price_data","tariff_import_rates_data","tariff_export_rates_data","net_profit_loss_data","net_tariff_profit_loss_data","daily_charges_data","trading_periods"],"properties":{"battery_data":{"type":"array","items":{"type":"number","format":"double"}},"daily_charges_data":{"type":"array","items":{"type":["number","null"],"format":"double"}},"grid_data":{"type":"array","items":{"type":"number","format":"double"}},"home_data":{"type":"array","items":{"type":"number","format":"double"}},"net_profit_loss_data":{"type":"array","items":{"type":["number","null"],"format":"double"}},"net_tariff_profit_loss_data":{"type":"array","items":{"type":["number","null"],"format":"double"}},"price_data":{"type":"array","items":{"type":["number","null"],"format":"double"}},"soc_data":{"type":"array","items":{"type":"number","format":"float"}},"solar_data":{"type":"array","items":{"type":"number","format":"double"}},"tariff_export_rates_data":{"type":"array","items":{"type":["number","null"],"format":"double"}},"tariff_import_rates_data":{"type":"array","items":{"type":["number","null"],"format":"double"}},"time_data":{"type":"array","items":{"type":"string"}},"trading_periods":{"type":"array","items":{"type":"number","format":"double"}}}},"PeriodEnergy":{"type":"object","description":"kWh over a stretch of trading periods, each trading period's average power\ntimes its half hour. The battery and grid go both ways, so each direction\nis added up on its own: a trading period counts towards one or the other by\nits net flow, as `/battery/data`'s series have it, and a bucket that both\ncharged and discharged shows both.","required":["home_kwh","solar_kwh","battery_charge_kwh","battery_discharge_kwh","grid_import_kwh","grid_export_kwh"],"properties":{"battery_charge_kwh":{"type":"number","format":"double","description":"What went into the battery."},"battery_discharge_kwh":{"type":"number","format":"double","description":"What came out of the battery."},"grid_export_kwh":{"type":"number","format":"double","description":"What was sold to the grid."},"grid_import_kwh":{"type":"number","format":"double","description":"What was bought from the grid."},"home_kwh":{"type":"number","format":"double","description":"What the home used."},"solar_kwh":{"type":"number","format":"double","description":"What the solar generated."}}},"PeriodTotals":{"type":"object","description":"A stretch of trading periods added up: the energy through each part of the\nsystem, and the grid prices it moved at.","required":["start","end","periods","priced_periods","energy","import","export"],"properties":{"end":{"type":"string","description":"The end of the last trading period counted, in the same format."},"energy":{"$ref":"#/components/schemas/PeriodEnergy","description":"kWh through the home, solar, battery and grid."},"export":{"$ref":"#/components/schemas/PriceSide","description":"Selling to the grid."},"import":{"$ref":"#/components/schemas/PriceSide","description":"Buying from the grid."},"periods":{"type":"integer","format":"int32","description":"How many trading periods are counted.","minimum":0},"priced_periods":{"type":"integer","format":"int32","description":"How many of them have a wholesale price. The rest are left out of every\nprice and money figure, so those are incomplete while this is lower than\n`periods`.","minimum":0},"start":{"type":"string","description":"The start of the first trading period counted, in the request's timezone\nand the same format as `/battery/data` (`YYYY-MM-DD HH:MM:SS ZONE`)."}}},"PricePoint":{"type":"object","description":"A trading period and its price.","required":["price","time"],"properties":{"price":{"type":"number","format":"double","description":"The price, $/kWh."},"time":{"type":"string","description":"The start of the trading period, in the request's timezone and the same\nformat as `/battery/data`."}}},"PriceSide":{"type":"object","description":"One direction through the grid over a stretch of trading periods: what the\nmarket price did, and what the customer's kWh that way (`energy`'s\n`grid_import_kwh` or `grid_export_kwh`) came to at it.","required":["amount"],"properties":{"amount":{"type":"number","format":"double","description":"What the kWh this way cost (import) or earned (export) in $, each trading\nperiod at its own price. Trading periods with no price add nothing."},"average_price":{"type":["number","null"],"format":"double","description":"The market's average price, $/kWh: the mean of the trading periods'\nprices, each counting the same however much went through the grid.\n`null` when none has a price."},"highest":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PricePoint","description":"The dearest trading period and its price. `null` when none has a price."}]},"lowest":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PricePoint","description":"The cheapest trading period and its price. `null` when none has a price."}]},"weighted_price":{"type":["number","null"],"format":"double","description":"The price the customer got, $/kWh: `amount` over the kWh it covers, so\neach trading period counts by how much went through the grid. `null`\nbelow 0.5 kWh."}}},"Role":{"type":"string","enum":["USER","ADMIN","OWNER"]},"SystemTypeEnum":{"type":"string","enum":["default","no_solar","no_grid"]}},"securitySchemes":{"api-key":{"type":"http","scheme":"bearer","bearerFormat":"API key secret (ak_...)","description":"A machine API key created through /api/v1.0.1/keys. Send it as                          `Authorization: Bearer ak_...`. Only endpoints tagged with this                          scheme accept API keys, and only when the key holds the listed scope."}}}}