forked from OpenEVSE/openevse_esp32_firmware
-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.yml
1074 lines (1073 loc) · 31.1 KB
/
api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: OpenEVSE WiFi API
description: |
The API for the OpenEVSE WiFi module
version: '1.0'
contact:
email: jeremy@bigjungle.net
name: Jeremy Poulter
url: 'https://github.com/jeremypoulter/'
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
servers:
- url: '{server}'
variables:
server:
default: 'http://openevse.local'
- url: 'http://localhost:8080'
paths:
/status:
get:
operationId: getStatus
summary: Get the EVSE status
description: |
The status endpoint can be called to get the status of the EVSE.
While it is posible to poll this endpoint, the recomendatoin is to retrieve the initial
state then use the [/ws](#statusUpdates)
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ./models/Status.yaml
examples:
EVSE Status:
value:
mode: STA
wifi_client_connected: 1
eth_connected: 0
net_connected: 1
srssi: -73
ipaddress: 192.168.1.43
emoncms_connected: 1
packets_sent: 22307
packets_success: 22290
mqtt_connected: 1
ohm_hour: NotConnected
free_heap: 203268
comm_sent: 335139
comm_success: 335139
rapi_connected: 1
amp: 0
pilot: 32
max_current: 32
temp1: 282
temp2: -2560
temp3: -2560
state: 254
elapsed: 3473
session_energy: 25034
total_energy: 998
total_day: 23
total_week: 68
total_month: 126
total_year: 998
gfcicount: 0
nogndcount: 0
stuckcount: 0
divertmode: 1
solar: 390
grid_ie: 0
charge_rate: 7
divert_update: 0
ota_update: 0
time: '2020-05-12T17:53:48Z'
offset: '+0000'
tags:
- Status
post:
operationId: postStatus
summary: Update external data to EVSE status
description: |
The status endpoint can be called to post external data that should be updated by MQTT
If MQTT is not an option, all external data needed can be updated from an HTTP POST request to /status endpoint.
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
voltage:
type: integer
description: live voltage in V
shaper_live_pwr:
type: integer
description: total household live power in W
solar:
type: integer
description: divert solar production in W
grid_ie:
type: integer
description: divert grid -import/+export in W
battery_level:
type: integer
description: vehicle soc in %
battery_range:
type: integer
description: vehicle range
time_to_full_charge:
type: integer
description: vehicle charge ETA
x-examples:
EVSE Status:
voltage: 220
shaper_live_pwr: 3400
solar: 3000
grid_ie: 3000
battery_level: 85
battery_range: 230
time_to_full_charge: 1590
examples:
EVSE Status:
value:
voltage: 220
shaper_live_pwr: 3400
solar: 3000
grid_ie: 3000
battery_level: 85
battery_range: 230
time_to_full_charge: 1590
tags:
- Status
/ws:
get:
operationId: statusUpdates
summary: EVSE status updates
description: |
As the state changes on the EVSE a websocket frame will be sent over the socket.
The frame will contain a JSON document conntaining only the updated state.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ./models/Status.yaml
'400':
description: Error
tags:
- Status
/config:
get:
operationId: getConfig
summary: Get the EVSE configuration
description: |
Retrieve the current WiFi and EVSE module configuration
tags:
- Config
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ./models/Config.yaml
examples: {}
post:
description: |
Update the EVSE configuration
operationId: updateConfig
responses:
'200':
$ref: '#/components/responses/UpdateSuccessful'
'400':
$ref: '#/components/responses/BadRequest'
requestBody:
content:
application/json:
schema:
$ref: ./models/Config.yaml
examples:
Update EmonCMS setting:
value:
emoncms_enabled: true
emoncms_server: 'http://emoncms.org'
emoncms_node: openevse-a7d4
emoncms_apikey: emoncmskey
emoncms_fingerprint: ''
Configure Solar divert:
value:
divert_type: 0
divert_enabled: true
divert_attack_smoothing_time: 8
divert_decay_smoothing_time: 300
divert_min_charge_time: 20
Set normal charging mode:
value:
charge_mode: fast
Set Eco mode:
value:
charge_mode: eco
Configure Tesla credentials:
value:
tesla_enabled: true
tesla_access_token: qts-1234.......
tesla_refresh_token: abcd.......
tesla_created_at: 1623358948
tesla_expires_in: 3888000
Select Tesla vehicle:
value:
tesla_vehicle_id: '2238974987235987'
summary: Update the EVSE configuration
tags:
- Config
/override:
description: Manual override can be used to override a charging timer or to immediately start a charge if the EVSE is in sleeping state.
get:
responses:
'200':
description: Manual overide is active
content:
application/json:
schema:
$ref: ./models/Properties.yaml
'404':
$ref: '#/components/responses/NotFound'
operationId: getManualOverride
tags:
- Manual Override
summary: Get the Manual Override status
description: Returns the current state of the manual override.
post:
description: |
Set the manual override
requestBody:
content:
application/json:
schema:
$ref: ./models/Properties.yaml
examples:
Force stop of charging:
value:
state: disabled
example-1:
value:
state: active
charge_current: 0
max_current: 0
auto_release: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
operationId: setManualOverride
tags:
- Manual Override
summary: Set the manual override
patch:
description: Toggle the manual override
responses:
'200':
description: OK
operationId: toggleManualOverride
tags:
- Manual Override
summary: Toggle the manual Override
delete:
description: Clears the manual override
responses:
'200':
description: OK
operationId: clearManualOverride
tags:
- Manual Override
summary: Clear the manual override
/claims:
get:
description: |
List all claims made by EVSE clients.
The response will be an array of EVSE claims.
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: ./models/Claim.yaml
operationId: listClaims
tags:
- Claims
summary: List EVSE claims
'/claims/{client}':
get:
description: |
Get the claim information for a specific client.
The response will be an EVSE claim.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ./models/Properties.yaml
'404':
$ref: '#/components/responses/NotFound'
parameters: []
operationId: getClaim
tags:
- Claims
summary: Get EVSE claim information
post:
description: Make/Update a claim
requestBody:
content:
application/json:
schema:
$ref: ./models/Properties.yaml
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'400':
$ref: '#/components/responses/BadRequest'
operationId: setClaim
summary: Make/Update an EVSE claim
tags:
- Claims
delete:
description: Release a claim
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'404':
$ref: '#/components/responses/NotFound'
operationId: releaseClaim
summary: Release an EVSE claim
tags:
- Claims
parameters:
- schema:
type: integer
name: client
in: path
required: true
description: 'The client ID, defined by [OpenEVSE](https://github.com/OpenEVSE/openevse_esp32_firmware/blob/master/src/evse_man.h#L28)'
/schedule:
get:
summary: List schedule events
description: This will get a complete list of events in the schedule
responses:
'200':
description: List of the schedule events
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ScheduleEvent'
'400':
$ref: '#/components/responses/BadRequest'
operationId: listSchedule
tags:
- Schedule
post:
operationId: updateSchedule
description: Perform multiple event updates
responses:
'201':
description: item created
'400':
description: 'invalid input, object invalid'
'409':
description: an existing item already exists
requestBody:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ScheduleEvent'
examples:
Single event:
value:
- id: 1
state: active
time: '14:15:22Z'
days:
- monday
Daily Timer:
value:
- id: 1
state: active
days:
- monday
- tuesday
- wednesday
- thursday
- friday
- saturday
- sunday
time: '07:00:00'
- id: 2
state: disabled
days:
- monday
- tuesday
- wednesday
- thursday
- friday
- saturday
- sunday
time: '10:00:00'
description: Inventory item to add
tags:
- Schedule
summary: Batch update schedule
'/schedule/{id}':
parameters:
- in: path
name: id
required: true
schema:
type: integer
description: Numeric ID of the event
get:
summary: Get event details
description: |
This will get the details of a specific event in the schedule.
The response will be the EVSE state to set for that event.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: ./models/EvseState.yaml
operationId: getScheduleEvent
tags:
- Schedule
post:
description: |
Update the details of a specific event in the schedule.
responses:
'200':
$ref: '#/components/responses/UpdateSuccessful'
requestBody:
content:
application/json:
schema:
$ref: ./models/EvseState.yaml
description: ''
operationId: setScheduleEvent
tags:
- Schedule
summary: Update event details
delete:
description: |
Remove a specific event from the schedule.
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
examples: {}
operationId: removeScheduleEvent
tags:
- Schedule
summary: Remove event
/schedule/plan:
get:
summary: Get planned events and state
description: This will return the planned events by day and also the current state of the scheduler
responses:
'200':
description: List of planed events
content:
application/json:
schema:
type: object
properties:
current_day:
$ref: '#/components/schemas/Day'
operationId: getSchedulePlan
tags:
- Schedule
/logs:
get:
summary: Get event block information
tags:
- Event Log
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
min:
type: integer
max:
type: integer
operationId: getEventBlockInfo
description: 'Retrieve the start and end indexes of the log event blocks. Each log event block contains '
parameters: []
parameters: []
'/logs/{index}':
get:
summary: Get log block events
tags:
- Event Log
responses:
'200':
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/LogEvent'
'404':
$ref: '#/components/responses/NotFound'
operationId: getEventBlock
description: |
Retrieve the log events for a specific block.
The block index range is returned by the /logs endpoint.
parameters:
- schema:
type: integer
name: index
in: path
required: true
/restart:
post:
summary: restart gateway or evse modules
description: restart wifi gateway or openevse module
operationId: restart
tags:
- Restart
requestBody:
content:
application/json:
schema:
type: object
properties:
device:
type: string
description: gateway|evse
responses:
'200':
description: Restart successfull
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: restart gateway|evse
/limit:
get:
summary: Get charge limit
description: 'This will return the limit type, value and auto_release (true|false) defined if there''s one'
responses:
'200':
description: Limit properties
content:
application/json:
schema:
$ref: ./models/Limit.yaml
'404':
description: No limit
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: No limit
operationId: limit_get
tags:
- Limit
post:
summary: Set charge limit
description: 'This will set the limit type, value and auto_release (true|false)'
responses:
'200':
description: Limit set
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: created
'500':
description: Failed to parse data
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: Failed to parse JSON
requestBody:
content:
application/json:
schema:
$ref: ./models/Limit.yaml
operationId: limit_set
tags:
- Limit
delete:
summary: Get charge limit
description: This will clear current limit
responses:
'200':
description: Clear Limit ok
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: Deleted
'404':
description: No limit
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: No limit to clear
'500':
description: Failed to clear limit
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: Failed to clear limit
operationId: limit_clear
tags:
- Limit
/emeter:
delete:
summary: Reset Energy Meter
description: This will clear the Energy Meter
requestBody:
content:
application/json:
schema:
type: object
properties:
hard:
type: integer
description: 0|1 Enable hard reset ( reset total_counter & total_switches)
import:
type: integer
description: 0|1 Import OpenEvse module total kwh.
responses:
'200':
description: Reset counter ok
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: Reset done
'500':
description: Failed to reset counter
content:
application/json:
schema:
type: object
properties:
msg:
type: string
description: Reset failed
operationId: energymeter-reset
tags:
- Energy Meter
/tesla/vehicles:
get:
summary: Get Tesla vehicle list
tags:
- Tesla
responses:
'200':
description: OK
content:
application/json:
schema:
description: ''
type: object
x-examples:
example-1:
count: 3
vehicles:
- id: '1492932278133304'
name: AwesomeSAUCE
- id: '1492931610165415'
name: Herbie
- id: '1492930973960452'
name: 'Life, the Universe, and Everything'
properties:
count:
type: number
vehicles:
type: array
uniqueItems: true
items:
type: object
additionalProperties: false
properties:
id:
type: string
minLength: 1
name:
type: string
minLength: 1
required:
- id
- name
required:
- count
- vehicles
examples:
example-1:
value:
count: 1
vehicles:
- id: '2238974987235987'
name: My Tesla
operationId: get-tesla-vehicles
description: Once the Tesla account credentials have been configured via the `/config` API this endpoint will return a list of vehicles associated with the account. The ID of the vehicle to use for SoC/Range can then be set using `tesla_vehicle_id` on the `/config` endpoint.
/time:
get:
summary: Get the time
tags:
- Time
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
time:
type: string
x-stoplight:
id: 6q0laeyxt5u85
description: The time in UTC according to the OpenEVSE.
format: date-time
offset:
type: string
x-stoplight:
id: u5zngl88caktf
pattern: '^[+-][0-9]{4}$'
local_time:
type: string
x-stoplight:
id: 7h1cpgfjj5j9j
format: date-time
uptime:
type: integer
description: EVSE gateway uptime, in seconds
required:
- time
- offset
- local_time
- uptime
operationId: get-time
description: Gets the time set on the OpenEVSE
post:
summary: Set the time
tags:
- Time
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
x-examples:
Example 1:
sntp_enabled: false
time_zone: 'GMT0BST,M3.5.0/1,M10.5.0'
time: '2018-08-10T14:30:00Z'
properties:
sntp_enabled:
type: boolean
description: |
Set to `true` to enable receiving time updates via NTP, `false` will disable NTP updates.
default: false
time_zone:
type: string
description: The time zone to use on the OpenEVSE. This has the format `<location name>|<POSIX timezone>`. The `location name` is not used by the EVSE and is largely to for the UI to provide a human readable version of the timezone and differentiate between locations that use the same time zone.
default: UTC0
time:
type: string
description: If `sntp_enabled` is false this is the time to set. Must be in UTC.
format: date-time
'400':
$ref: '#/components/responses/BadRequest'
operationId: post-time
description: Set the time and associated config options. If not setting the time the `/config` endpoint can be used.
/certificates:
get:
summary: Get a list of certificates
description: |
Returns a list of certificates that have been uploaded to the OpenEVSE. The certificates are used to
authenticate the OpenEVSE to the MQTT broker, provide a secure web interface or as additional root CA
certificates.
operationId: listCertificates
tags:
- Certificates
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
certificates:
type: array
items:
$ref: './models/Certificate.yaml'
post:
summary: Upload a certificate
description: |
Upload a certificate to the OpenEVSE. The certificate can be used to authenticate the OpenEVSE to the MQTT
broker, provide a secure web interface or as additional root CA certificates.
operationId: uploadCertificate
tags:
- Certificates
requestBody:
content:
application/json:
schema:
$ref: './models/Certificate.yaml'
responses:
'200':
$ref: '#/components/responses/UpdateSuccessful'
'400':
$ref: '#/components/responses/BadRequest'
'/certificates/{id}':
get:
summary: Get a certificate
description: |
Returns a certificate that has been uploaded to the OpenEVSE. The certificate is used to
authenticate the OpenEVSE to the MQTT broker, provide a secure web interface or as additional root CA
certificates.
operationId: getCertificate
tags:
- Certificates
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: './models/Certificate.yaml'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
delete:
summary: Delete a certificate
description: |
Delete a certificate that has been uploaded to the OpenEVSE. The certificate is used to
authenticate the OpenEVSE to the MQTT broker, provide a secure web interface or as additional root CA
certificates.
operationId: deleteCertificate
tags:
- Certificates
parameters:
- in: path
name: id
required: true
schema:
type: string
responses:
'200':
$ref: '#/components/responses/UpdateSuccessful'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
components:
schemas:
Message:
title: Informational message
type: object
properties:
msg:
type: string
description: The message
Day:
type: string
enum:
- monday
- tuesday
- wednesday
- thursday
- friday
- saturday
- sunday
x-examples: {}
ScheduleEvent:
type: object
properties:
id:
type: integer
example: 1
state:
$ref: ./models/EvseState.yaml
time:
type: string
format: time
days:
type: array
uniqueItems: true
items:
$ref: '#/components/schemas/Day'
required:
- state
- time
- days
title: ''
LogEvent:
title: LogEvent
type: object
x-examples:
example-1:
value:
time: '2021-08-24T14:15:22Z'
type: information
managerState: active
evseState: 1
evseFlags: 123
pilot: 32
energy: 1234.5
elapsed: 123456
temperature: 35.4
tempuratureMax: 50.4
divertMode: 1
properties:
time:
type: string
format: date-time
readOnly: true
type:
type: string
enum:
- information
- notification
- warning
managerState:
$ref: ./models/EvseState.yaml
evseState:
type: integer