From 13e240b7a8134bcd36b087c82971491c32d236d7 Mon Sep 17 00:00:00 2001 From: "jeremy@bigjungle.net" Date: Sat, 11 Sep 2021 13:51:14 +0100 Subject: [PATCH] Splitting out some models into separate files --- .stoplight.json | 2 +- api.yml | 55 ++------ models/Claim.yaml | 13 ++ models/Config.yaml | 2 + models/EvseState.yaml | 8 ++ models/Properties.yaml | 14 ++ models/Status.yaml | 284 +++++++++++++++++++++-------------------- 7 files changed, 192 insertions(+), 186 deletions(-) create mode 100644 models/Claim.yaml create mode 100644 models/EvseState.yaml create mode 100644 models/Properties.yaml diff --git a/.stoplight.json b/.stoplight.json index 6babe2a9..9e509ca5 100644 --- a/.stoplight.json +++ b/.stoplight.json @@ -10,7 +10,7 @@ "json_schema": { "rootDir": "models", "include": [ - "**" + "models/**" ] }, "markdown": { diff --git a/api.yml b/api.yml index 91f1f493..26d63fd2 100644 --- a/api.yml +++ b/api.yml @@ -109,7 +109,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Properties' + $ref: ./models/Properties.yaml '404': $ref: '#/components/responses/NotFound' operationId: getManualOverride @@ -121,7 +121,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Properties' + $ref: ./models/Properties.yaml responses: '200': description: OK @@ -161,7 +161,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/Claim' + $ref: ./models/Claim.yaml operationId: listClaims tags: - Claims @@ -174,7 +174,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Properties' + $ref: ./models/Properties.yaml '404': $ref: '#/components/responses/NotFound' parameters: [] @@ -188,7 +188,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/Properties' + $ref: ./models/Properties.yaml responses: '200': description: OK @@ -236,7 +236,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/ScheduleEvent' + $ref: ./models/EvseState.yaml '400': $ref: '#/components/responses/BadRequest' operationId: listSchedule @@ -258,7 +258,7 @@ paths: schema: type: array items: - $ref: '#/components/schemas/ScheduleEvent' + $ref: ./models/EvseState.yaml examples: example-1: value: @@ -287,7 +287,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ScheduleEvent' + $ref: ./models/EvseState.yaml operationId: getScheduleEvent tags: - Schedule @@ -299,7 +299,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ScheduleEvent' + $ref: ./models/EvseState.yaml description: '' operationId: setScheduleEvent tags: @@ -365,18 +365,6 @@ paths: required: true components: schemas: - Properties: - title: EVSE properties - type: object - properties: - state: - $ref: '#/components/schemas/EvseState' - auto_release: - type: boolean - description: | - `true` if the manual override is auto-released when the vehicle is - disconnected, `false` if manual override will persist after vehicle - disconnection. Message: title: Informational message type: object @@ -384,27 +372,6 @@ components: msg: type: string description: The message - ClientId: - title: EVSE Client ID - type: integer - description: 'The client ID, defined by [OpenEVSE](https://github.com/OpenEVSE/ESP32_WiFi_V4.x/blob/master/src/evse_man.h#L25)' - Claim: - title: EVSE claim - allOf: - - type: object - properties: - client: - $ref: '#/components/schemas/ClientId' - priority: - type: integer - description: 'The priority of the claim, the higher the number the higher the priority' - - $ref: '#/components/schemas/Properties' - EvseState: - title: EVSE state - type: string - enum: - - active - - disabled ScheduleEvent: type: object properties: @@ -412,7 +379,7 @@ components: type: integer example: 1 state: - $ref: '#/components/schemas/EvseState' + $ref: './models/EvseState.yaml' time: type: string format: time @@ -463,7 +430,7 @@ components: - notification - warning managerState: - $ref: '#/components/schemas/EvseState' + $ref: './models/EvseState.yaml' evseState: type: integer minimum: 0 diff --git a/models/Claim.yaml b/models/Claim.yaml new file mode 100644 index 00000000..f657e9bd --- /dev/null +++ b/models/Claim.yaml @@ -0,0 +1,13 @@ +title: EVSE claim +allOf: + - type: object + properties: + client: + type: integer + description: 'The client ID, defined by [OpenEVSE](src/evse_man.h#L25)' + priority: + type: integer + description: 'The priority of the claim, the higher the number the higher the priority' + - $ref: ./Properties.yaml +x-tags: + - Claims diff --git a/models/Config.yaml b/models/Config.yaml index eb736d24..0da7d564 100644 --- a/models/Config.yaml +++ b/models/Config.yaml @@ -347,3 +347,5 @@ properties: charge_mode: type: string minLength: 1 +x-tags: + - Config diff --git a/models/EvseState.yaml b/models/EvseState.yaml new file mode 100644 index 00000000..6d6ff530 --- /dev/null +++ b/models/EvseState.yaml @@ -0,0 +1,8 @@ +title: EvseState +type: string +enum: + - active + - disabled +x-tags: + - Claims + - Status diff --git a/models/Properties.yaml b/models/Properties.yaml new file mode 100644 index 00000000..ac359be0 --- /dev/null +++ b/models/Properties.yaml @@ -0,0 +1,14 @@ +title: Properties +type: object +x-tags: + - Claims +properties: + state: + $ref: ./EvseState.yaml + auto_release: + type: boolean + description: | + `true` if the manual override is auto-released when the vehicle is + disconnected, `false` if manual override will persist after vehicle + disconnection. +description: '' diff --git a/models/Status.yaml b/models/Status.yaml index cf200198..00cb4e38 100644 --- a/models/Status.yaml +++ b/models/Status.yaml @@ -1,141 +1,143 @@ - title: EVSE status - type: object - properties: - mode: - type: string - description: The current mode of the EVSE - wifi_client_connected: - type: integer - description: '`1`, WiFi is connected, `0` no WiFi connection' - eth_connected: - type: integer - description: '`1`, Wired ethernet is connected, `0` no wired ethernet connection' - net_connected: - type: integer - description: '`1`, network is connected, either wired or WiFi, `0` no network connection' - srssi: - type: integer - description: WiFi RSSI signal strength - ipaddress: - type: string - description: The current IP address of the WiFi module - packets_sent: - type: integer - description: The number of posts sent to the EmonCMS server - packets_success: - type: integer - description: The number of successful posts to the EmonCMS server - emoncms_connected: - type: integer - description: '`1`, if connected to an EmonCMS server, `0` not connected' - emoncms_message: - type: string - description: Last response message from the EmonCMS server - mqtt_connected: - type: integer - description: '`1`, if connected to an EmonCMS server, `0` not connected' - ohm_hour: - type: integer - description: Last status message from the OhmHour connection - free_heap: - type: integer - description: Number of bytes free in the ESP memory heap - comm_sent: - type: integer - description: Number of RAPI messages sent - comm_success: - type: integer - description: Number of successful RAPI messages - rapi_connected: - type: integer - description: '`1`, if RAPI messages have successfully been sent to the OpenEVSE module, `0` not connected' - evse_connected: - type: integer - description: '`1`, if the WiFi module has negociated a connection to the OpenEVSE module, `0` not connected' - amp: - type: number - description: the value of the charge current in mA - voltage: - type: number - description: 'the charge voltage, read form the EVSE if supported, or supplied via MQTT or other external source' - pilot: - type: integer - description: 'the pilot value, in amps' - temp: - type: number - description: 'the derived temperature, in 1/10th °C' - temp1: - type: number - description: 'the DS3232 temperature, in 1/10th °C, if fitted or `false` if not' - temp2: - type: number - description: 'the MCP9808 (on the LCD) temperature, in 1/10th °C, if fitted or `false` if not' - temp3: - type: number - description: 'the TMP007 temperature, in 1/10th °C, if fitted or `false` if not' - temp4: - type: number - description: 'the MCP9808 (on the WiFi module) temperature, in 1/10th °C, if fitted or `false` if not' - state: - type: integer - description: The EVSE status - vehicle: - type: integer - description: '`1`, if a vehicle id connected to the EVSE, `0` not connected' - colour: - type: integer - description: The LCD colour - manual_override: - type: integer - description: '`1`, if the manual override is active, `0` default behaviour' - elapsed: - type: number - description: 'The duration of the current charge session, in seconds' - wattsec: - type: integer - description: 'The amount of energy transfered in this charge session, in W/sec' - watthour: - type: integer - description: 'The total amount of energy transfered, in W/hour' - gfcicount: - type: integer - description: Number of GFCI errors - nogndcount: - type: integer - description: Number of no ground errors - stuckcount: - type: integer - description: Number of stuck relay errors - divertmode: - type: integer - description: 'The PV divert mode, `1` normal, `2` Eco' - solar: - type: integer - description: The latest solar feed value received - grid_ie: - type: integer - description: The latest grid +I/-E feed value received - charge_rate: - type: integer - description: The divert charge rate - available_current: - type: integer - description: The computed avalible current for divert - smoothed_available_current: - type: integer - description: The computed smoothed available current for divert - divert_update: - type: number - description: The time since the last update of the divert feed - divert_active: - type: boolean - description: '`true` if divert is active, `false` if not' - ota_update: - type: integer - description: '`1`, if there is an OTA update active, `0` if normal operation' - time: - type: string - description: The current time on the WiFi module - offset: - type: string - description: The current timezone +title: EVSE status +type: object +properties: + mode: + type: string + description: The current mode of the EVSE + wifi_client_connected: + type: integer + description: '`1`, WiFi is connected, `0` no WiFi connection' + eth_connected: + type: integer + description: '`1`, Wired ethernet is connected, `0` no wired ethernet connection' + net_connected: + type: integer + description: '`1`, network is connected, either wired or WiFi, `0` no network connection' + srssi: + type: integer + description: WiFi RSSI signal strength + ipaddress: + type: string + description: The current IP address of the WiFi module + packets_sent: + type: integer + description: The number of posts sent to the EmonCMS server + packets_success: + type: integer + description: The number of successful posts to the EmonCMS server + emoncms_connected: + type: integer + description: '`1`, if connected to an EmonCMS server, `0` not connected' + emoncms_message: + type: string + description: Last response message from the EmonCMS server + mqtt_connected: + type: integer + description: '`1`, if connected to an EmonCMS server, `0` not connected' + ohm_hour: + type: integer + description: Last status message from the OhmHour connection + free_heap: + type: integer + description: Number of bytes free in the ESP memory heap + comm_sent: + type: integer + description: Number of RAPI messages sent + comm_success: + type: integer + description: Number of successful RAPI messages + rapi_connected: + type: integer + description: '`1`, if RAPI messages have successfully been sent to the OpenEVSE module, `0` not connected' + evse_connected: + type: integer + description: '`1`, if the WiFi module has negociated a connection to the OpenEVSE module, `0` not connected' + amp: + type: number + description: the value of the charge current in mA + voltage: + type: number + description: 'the charge voltage, read form the EVSE if supported, or supplied via MQTT or other external source' + pilot: + type: integer + description: 'the pilot value, in amps' + temp: + type: number + description: 'the derived temperature, in 1/10th °C' + temp1: + type: number + description: 'the DS3232 temperature, in 1/10th °C, if fitted or `false` if not' + temp2: + type: number + description: 'the MCP9808 (on the LCD) temperature, in 1/10th °C, if fitted or `false` if not' + temp3: + type: number + description: 'the TMP007 temperature, in 1/10th °C, if fitted or `false` if not' + temp4: + type: number + description: 'the MCP9808 (on the WiFi module) temperature, in 1/10th °C, if fitted or `false` if not' + state: + type: integer + description: The EVSE status + vehicle: + type: integer + description: '`1`, if a vehicle id connected to the EVSE, `0` not connected' + colour: + type: integer + description: The LCD colour + manual_override: + type: integer + description: '`1`, if the manual override is active, `0` default behaviour' + elapsed: + type: number + description: 'The duration of the current charge session, in seconds' + wattsec: + type: integer + description: 'The amount of energy transfered in this charge session, in W/sec' + watthour: + type: integer + description: 'The total amount of energy transfered, in W/hour' + gfcicount: + type: integer + description: Number of GFCI errors + nogndcount: + type: integer + description: Number of no ground errors + stuckcount: + type: integer + description: Number of stuck relay errors + divertmode: + type: integer + description: 'The PV divert mode, `1` normal, `2` Eco' + solar: + type: integer + description: The latest solar feed value received + grid_ie: + type: integer + description: The latest grid +I/-E feed value received + charge_rate: + type: integer + description: The divert charge rate + available_current: + type: integer + description: The computed avalible current for divert + smoothed_available_current: + type: integer + description: The computed smoothed available current for divert + divert_update: + type: number + description: The time since the last update of the divert feed + divert_active: + type: boolean + description: '`true` if divert is active, `false` if not' + ota_update: + type: integer + description: '`1`, if there is an OTA update active, `0` if normal operation' + time: + type: string + description: The current time on the WiFi module + offset: + type: string + description: The current timezone +x-tags: + - Stratus