post: operationId: getStationEnergyChart summary: Get station energy chart description: | Permission: **ADMIN, OWNER** Returns the energy distribution chart for the selected station and time range. Used when the user changes the Overview tab chart view or date range. `view` controls the bucket granularity: - `day`: `timestamp` format is `YYYY-MM-DD` - `week`: `timestamp` format is `YYYY-Www` - `month`: `timestamp` format is `YYYY-MM` > `null` values → UI displays `"-"`. > Empty `data_points` array → UI displays `"No data available for the selected period."` **Error codes:** | Code | Condition | |----------|-----------| | `110501` | Unauthorized (role is not Owner or Admin) | | `110502` | Station not found | | `110503` | Invalid request (`station_id`, `view`, `date_from`, or `date_to` missing/invalid) | | `100501` | Internal server error | tags: [station] security: - bearerAuth: [] requestBody: required: true content: application/json: schema: $ref: "../../components.yaml#/components/schemas/GetStationEnergyChartRequest" example: station_id: "665f0c2df1a2b3c4d5e6f789" view: "day" date_from: "2026-06-04" date_to: "2026-06-17" responses: "200": description: Station energy chart returned directly. content: application/json: schema: $ref: "../../components.yaml#/components/schemas/GetStationEnergyChartResponse" example: view: "day" date_from: "2026-06-04" date_to: "2026-06-17" data_points: - timestamp: "2026-06-04" solar_pv_kw: 5.2 consumption_kw: 3.1 battery_kw: 1.5 grid_kw: -0.4 soc_pct: 65.0 "400": $ref: "../../components.yaml#/components/responses/Failure" "401": $ref: "../../components.yaml#/components/responses/Failure" "404": $ref: "../../components.yaml#/components/responses/Failure" "500": $ref: "../../components.yaml#/components/responses/Failure"