Skip to content

Commit 6c0ed25

Browse files
Merge pull request #477 from OpenEVSE/jeremypoulter/issue476
Fixes for errors in API docs
2 parents d486e3c + 69fe4e3 commit 6c0ed25

File tree

5 files changed

+83
-137
lines changed

5 files changed

+83
-137
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Validate API docs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
name: Run Spectral
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Check out the repository
16+
- uses: actions/checkout@v3
17+
18+
# Run Spectral
19+
- uses: stoplightio/spectral-action@latest
20+
with:
21+
file_glob: 'api.yml'

.stoplight/styleguide.json

Lines changed: 16 additions & 30 deletions
Large diffs are not rendered by default.

api.yml

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ info:
77
contact:
88
99
name: Jeremy Poulter
10+
url: https://github.com/jeremypoulter/
1011
license:
1112
name: Apache 2.0
1213
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
@@ -79,34 +80,54 @@ paths:
7980
description: |
8081
The status endpoint can be called to post external data that should be updated by MQTT
8182
If MQTT is not an option, all external data needed can be updated from an HTTP POST request to /status endpoint.
82-
83-
Accepted parameters:
84-
{
85-
"voltage": int, // live voltage in V
86-
"shaper_live_pwr": int, // total household live power in W
87-
"solar": int, // divert solar production in W
88-
"grid_ie": int, // divert grid -import/+export in W
89-
"battery_level": int, // vehicle soc in %
90-
"battery_range": int, // vehicle range
91-
"time_to_full_charge": int // vehicle charge ETA
92-
}
93-
9483
responses:
95-
'200':
84+
'200':
9685
description: OK
9786
content:
9887
application/json:
9988
schema:
100-
$ref: ./models/Status.yaml
89+
type: object
90+
properties:
91+
voltage:
92+
type: integer
93+
description: live voltage in V
94+
shaper_live_pwr:
95+
type: integer
96+
description: total household live power in W
97+
solar:
98+
type: integer
99+
description: divert solar production in W
100+
grid_ie:
101+
type: integer
102+
description: divert grid -import/+export in W
103+
battery_level:
104+
type: integer
105+
description: vehicle soc in %
106+
battery_range:
107+
type: integer
108+
description: vehicle range
109+
time_to_full_charge:
110+
type: integer
111+
description: vehicle charge ETA
112+
x-examples:
113+
EVSE Status:
114+
voltage: 220
115+
shaper_live_pwr: 3400
116+
solar: 3000
117+
grid_ie: 3000
118+
battery_level: 85
119+
battery_range: 230
120+
time_to_full_charge: 1590
101121
examples:
102122
EVSE Status:
103-
"voltage": 220
104-
"shaper_live_pwr": 3400
105-
"solar": 3000
106-
"grid_ie": 3000
107-
"battery_level": 85
108-
"battery_range": 230
109-
"time_to_full_charge" 1590
123+
value:
124+
voltage: 220
125+
shaper_live_pwr: 3400
126+
solar: 3000
127+
grid_ie: 3000
128+
battery_level: 85
129+
battery_range: 230
130+
time_to_full_charge: 1590
110131
tags:
111132
- Status
112133
/ws:
@@ -124,7 +145,7 @@ paths:
124145
schema:
125146
$ref: ./models/Status.yaml
126147
'400':
127-
descritpion: Error
148+
description: Error
128149
tags:
129150
- Status
130151
/config:
@@ -456,7 +477,6 @@ paths:
456477
properties:
457478
current_day:
458479
$ref: '#/components/schemas/Day'
459-
460480
operationId: getSchedulePlan
461481
tags:
462482
- Schedule
@@ -578,6 +598,7 @@ components:
578598
- friday
579599
- saturday
580600
- sunday
601+
x-examples: {}
581602
ScheduleEvent:
582603
type: object
583604
properties:

models/Config.yaml

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -84,85 +84,6 @@ x-examples:
8484
ocpp_energize_plug: true
8585
mqtt_protocol: mqtt
8686
charge_mode: fast
87-
examples:
88-
- firmware: D7.1.2
89-
protocol: '-'
90-
espflash: 4194304
91-
espinfo: ESP32r1 2 core WiFi BLE BT
92-
buildenv: openevse_esp-wrover-kit
93-
version: 4.1.0.dev
94-
diode_check: true
95-
gfci_check: true
96-
ground_check: true
97-
relay_check: true
98-
vent_check: true
99-
temp_check: true
100-
service: 0
101-
scale: 220
102-
offset: 0
103-
max_current_soft: 32
104-
min_current_hard: 6
105-
max_current_hard: 32
106-
mqtt_supported_protocols:
107-
- mqtt
108-
- mqtts
109-
http_supported_protocols:
110-
- http
111-
- https
112-
ssid: wibble_ext
113-
pass: _DUMMY_PASSWORD
114-
www_username: ''
115-
www_password: ''
116-
hostname: openevse-a7d4
117-
sntp_hostname: pool.ntp.org
118-
time_zone: 'Europe/London|GMT0BST,M3.5.0/1,M10.5.0'
119-
emoncms_server: 'https://emoncms.org'
120-
emoncms_node: openevse-a7d4
121-
emoncms_apikey: _DUMMY_PASSWORD
122-
emoncms_fingerprint: ''
123-
mqtt_server: homeassistant.lan
124-
mqtt_port: 1883
125-
mqtt_topic: openevse
126-
mqtt_retained: false
127-
mqtt_user: emonpi
128-
mqtt_pass: _DUMMY_PASSWORD
129-
mqtt_solar: ''
130-
mqtt_grid_ie: emon/test/grid_ie
131-
mqtt_vrms: emon/rightbar/voltage
132-
mqtt_vehicle_soc: ''
133-
mqtt_vehicle_range: ''
134-
mqtt_vehicle_eta: ''
135-
mqtt_announce_topic: openevse/announce/a7d4
136-
ocpp_server: ''
137-
ocpp_chargeBoxId: ''
138-
ocpp_idTag: ''
139-
tx_start_point: tx_pending
140-
ohm: ''
141-
divert_PV_ratio: 1.1
142-
divert_attack_smoothing_factor: 0.4
143-
divert_decay_smoothing_factor: 0.05
144-
divert_min_charge_time: 10
145-
tesla_access_token: _DUMMY_PASSWORD
146-
tesla_refresh_token: _DUMMY_PASSWORD
147-
tesla_created_at: 2479357952
148-
tesla_expires_in: 3888000
149-
tesla_vehicle_id: '142960157278'
150-
led_brightness: 51
151-
flags: 115467
152-
emoncms_enabled: true
153-
mqtt_enabled: true
154-
mqtt_reject_unauthorized: true
155-
ohm_enabled: false
156-
sntp_enabled: true
157-
tesla_enabled: true
158-
divert_enabled: true
159-
pause_uses_disabled: false
160-
mqtt_vehicle_range_miles: false
161-
ocpp_enabled: true
162-
ocpp_suspend_evse: true
163-
ocpp_energize_plug: true
164-
mqtt_protocol: mqtt
165-
charge_mode: fast
16687
x-tags:
16788
- Config
16889
properties:
@@ -367,7 +288,5 @@ properties:
367288
scheduler_start_window:
368289
type: number
369290
default: 600
370-
description: >
371-
The maximum number of seconds to randomly add/subtract from the a scheduled charge start time,
372-
eg a value of 600 will adjust the start time my +/- 10 minutes. This is to help prevent large
373-
syncrinised loads when multiple verchiles start charging at the same time.
291+
description: |
292+
The maximum number of seconds to randomly add/subtract from the a scheduled charge start time, eg a value of 600 will adjust the start time my +/- 10 minutes. This is to help prevent large syncrinised loads when multiple verchiles start charging at the same time.

models/Properties.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ type: object
33
x-tags:
44
- Claims
55
description: ''
6-
examples: []
76
properties:
87
state:
98
$ref: ./EvseState.yaml

0 commit comments

Comments
 (0)