-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
1392 lines (1377 loc) · 46 KB
/
openapi.yaml
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.1.0"
info:
title: Stash Energy API
license:
name: "BSD"
url: "#"
version: ""
contact:
name: API Support
url: https://stash.energy/contact
email: dev@stash.energy
description: |
# Introduction
Welcome to the Stash Energy API documentation!
If you're interested in integrating your utility management software with
Stash Energy, please contact us!
## Changelog
### 2024-05-02
- Added: New heat pump modes fan only and dehumidify
- Changed: Compressor speed from 0-100% to 0-120hz
- Removed: max charge, max capacity, max charge rate, charge limit, charge rate, discharge rate, and max demand
### 2022-02-23
- Added: The serial number of a unit is now included in the `serialNumber` property of Unit responses
- Changed: Tags can now include any character
- Changed: Pairing codes now expire in 24 hours
security:
- OAuth2:
- "openid 032d91df-6ddf-43d3-bcc9-8015d1f5a539"
servers:
- url: https://api.stash.energy
description: Production Server
paths:
/user:
get:
tags:
- User
operationId: getUser
summary: Get current authenticated user
description: Returns a User resource
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/InternalError"
/utilities:
get:
tags:
- Utilities
operationId: getUtilities
summary: Get utilities
description: |
Returns a collection of Utility resources that the user has access to.
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/Utilities"
"401":
$ref: "#/components/responses/Unauthorized"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}:
parameters:
- $ref: "#/components/parameters/Utility"
get:
tags:
- Utilities
operationId: getUtilityById
summary: Get a utility
description: Returns the Utility resource corresponding to the provided id.
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/Utility"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/pairing-codes:
parameters:
- $ref: "#/components/parameters/Utility"
post:
tags:
- Utilities
operationId: createUnitPairingCode
summary: Create a unit pairing code
description: |
Creates and returns a pairing code that can be entered into a Stash unit to pair that unit with the utility.
When creating a pairing code, the `status` will always be `"new"` and the `unitId` will always be `null`. Continue monitoring these fields by querying the code at the [Get a unit pairing code](#operation/getUnitPairingCode) endpoint
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/PairingCode"
examples:
one:
$ref: "#/components/examples/NewPairingCodeResponseExample"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/pairing-codes/{pairingCodeId}:
parameters:
- $ref: "#/components/parameters/Utility"
- $ref: "#/components/parameters/PairingCode"
get:
tags:
- Utilities
operationId: getUnitPairingCode
summary: Get a unit pairing code
description: Returns information for an existing pairing code
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/PairingCode"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/units:
parameters:
- $ref: "#/components/parameters/Utility"
get:
tags:
- Units
operationId: getUnitsForUtility
parameters:
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Page"
- $ref: "#/components/parameters/Expand"
- $ref: "#/components/parameters/Research"
- name: weeklyScheduleUtcOffset
in: query
description: A number denoting how much the weekly storage schedule will be offset from UTC time (in seconds).
schema:
type: integer
format: int32
minimum: -86399
maximum: 86399
default: 0
- name: tags
in: query
description: Filter units by tag. Only units with these tags will be returned. Currently only accepts 1 tag.
style: form
explode: true
schema:
type: array
items:
type: string
summary: Get a utility's storage units
description: Returns a collection of Unit resources controlled by the given Utility.
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/Units"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/units/update:
parameters:
- $ref: "#/components/parameters/Utility"
patch:
tags:
- Units
summary: Update units by id
description: Update units by providing an array of individual unit updates
operationId: units_update
requestBody:
$ref: "#/components/requestBodies/UpdateUnitsRequestBody"
responses:
"204":
description: SUCCESS
"401":
$ref: "#/components/responses/Unauthorized"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
"422":
$ref: "#/components/responses/UnprocessableEntity"
/utilities/{utilityId}/units/update-by-tags:
parameters:
- $ref: "#/components/parameters/Utility"
patch:
tags:
- Units
summary: Update units by tag
description: Send an update to a group of units.
operationId: units_updateByTags
requestBody:
$ref: "#/components/requestBodies/UpdateUnitsByTagsRequestBody"
responses:
"204":
description: SUCCESS
"401":
$ref: "#/components/responses/Unauthorized"
"400":
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/NotFound"
"422":
$ref: "#/components/responses/UnprocessableEntity"
/utilities/{utilityId}/units/{unitId}:
parameters:
- $ref: "#/components/parameters/Utility"
- $ref: "#/components/parameters/Unit"
get:
parameters:
- $ref: "#/components/parameters/Research"
- name: weeklyScheduleUtcOffset
in: query
description: A number denoting how much the weekly storage schedule will be offset from UTC time (in seconds).
schema:
type: integer
format: int32
minimum: -86399
maximum: 86399
default: 0
tags:
- Units
operationId: getUnitByIdForUtility
summary: Get a storage unit
description: |
Returns a Unit resource corresponding to the given id, provided it is controlled by the given utility.
**NOTE: all unit properties are expanded by default.**
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/UnitResponse"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/units/{unitId}/past-states:
parameters:
- $ref: "#/components/parameters/Utility"
- $ref: "#/components/parameters/Unit"
- $ref: "#/components/parameters/StartTimestamp"
- $ref: "#/components/parameters/EndTimestamp"
- $ref: "#/components/parameters/Limit"
- $ref: "#/components/parameters/Research"
get:
tags:
- Units
operationId: getPastStatesForUtilityUnit
summary: Get a unit's past states
description: |
Returns a collection of State resources.
A State is a "snapshot" of a unit's physical state and/or the state of its environment
at a particular moment in time (given by the `timestamp` property).
Use this endpoint to see the history of a unit's changing properties.
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/PastStates"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/units/{unitId}/past-states/{stateId}:
parameters:
- $ref: "#/components/parameters/Utility"
- $ref: "#/components/parameters/Unit"
- $ref: "#/components/parameters/State"
- $ref: "#/components/parameters/Research"
get:
tags:
- Units
operationId: getPastStateByIdForUtilityUnit
summary: Get a past state
description: Returns a State corresponding to the given id.
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/State"
- $ref: "#/components/schemas/ResearchState"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/units/{unitId}/realtime-schedule:
parameters:
- $ref: "#/components/parameters/Utility"
- $ref: "#/components/parameters/Unit"
get:
tags:
- Unit Storage
operationId: getRealtimeScheduleForUtilityUnit
summary: Get a realtime storage schedule
description: |
The realtime schedule tells a unit what storage mode to switch to at specific datetimes.
This is the schedule used when the `scheduleMode` of a unit is `"realtime"`.
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/RealtimeStorageScheduleResponse"
examples:
one:
$ref: "#/components/examples/RealtimeStorageScheduleResponseExample"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
put:
tags:
- Unit Storage
operationId: setRealtimeScheduleForUtilityUnit
summary: Set a unit's realtime storage schedule
description: |
Provide a realtime storage schedule for a unit.
A successful request means the schedule will be guaranteed to be delivered to the unit within 5 minutes. You can check whether the schedule has been delivered by querying the schedule's `hasBeenDelivered` property.
requestBody:
$ref: "#/components/requestBodies/RealtimeStorageScheduleRequestBody"
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/RealtimeStorageScheduleResponse"
examples:
one:
$ref: "#/components/examples/RealtimeStorageScheduleResponseExample"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"422":
$ref: "#/components/responses/UnprocessableEntity"
"500":
$ref: "#/components/responses/InternalError"
/utilities/{utilityId}/units/{unitId}/weekly-schedule:
parameters:
- $ref: "#/components/parameters/Utility"
- $ref: "#/components/parameters/Unit"
get:
tags:
- Unit Storage
operationId: getWeeklyScheduleForUtilityUnit
parameters:
- $ref: "#/components/parameters/UtcOffset_wsget"
summary: Get a weekly storage schedule
description: |
This schedule is executed when there are no future storage mode changes in the realtime schedule.
This is the schedule used when the `scheduleMode` of a unit is `"weekly"`.
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/WeeklySchedule"
examples:
one:
$ref: "#/components/examples/WeeklyStorageScheduleResponseExample"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"500":
$ref: "#/components/responses/InternalError"
put:
tags:
- Unit Storage
operationId: setWeeklyScheduleForUtilityUnit
parameters:
- $ref: "#/components/parameters/UtcOffset_wsput"
summary: Set a unit's weekly storage schedule
description: |
Provide a weekly storage schedule for a unit.
A successful request means the schedule will be guaranteed to be delivered to the unit within 5 minutes. You can check whether the schedule has been delivered by querying the schedule's `hasBeenDelivered` property.
requestBody:
$ref: "#/components/requestBodies/WeeklyStorageScheduleRequestBody"
responses:
"200":
description: SUCCESS
content:
application/json:
schema:
$ref: "#/components/schemas/WeeklySchedule"
examples:
one:
$ref: "#/components/examples/WeeklyStorageScheduleResponseExample"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
"422":
$ref: "#/components/responses/UnprocessableEntity"
"500":
$ref: "#/components/responses/InternalError"
components:
securitySchemes:
OAuth2:
type: oauth2
description: |
## Authentication
Tokens should be made using the OAuth Bearer Token specification,
using the Authorization header in the request.
Here is an example:
```
GET /utilities HTTP/1.1
Host: api.stash.energy
Authorization: Bearer {token}
```
### Authentication flow
1. Get an `id` and `key` from your Stash Energy representative (one time only)
2. Send a POST command to [this URL](https://auth.api.stash.energy/60658de9-a14c-4bb9-8dc5-26d1bd003872/oauth2/v2.0/token?p=b2c_1_auth&grant_type=password&scope=openid%20032d91df-6ddf-43d3-bcc9-8015d1f5a539&client_id=032d91df-6ddf-43d3-bcc9-8015d1f5a539&response_type=token) with the following parameters in the `x-www-form-urlencoded` format:
* username = `<id>`
* password = `<key>`
3. Retrieve the access token from the `access_token` property of the JSON response
4. Use this token to authenticate your API requests. (Include it in the Authorization header)
**NOTE: The access token will be valid for 4 hours**
## Security best practices
* ALWAYS keep your password and access tokens in a secure location.
* DO NOT share your password or access tokens.
* NEVER check your password or access tokens into version control (ex. git).
* It is RECOMMENDED to change your password at least every 6 months.
We reserve the right to revoke access to any user who abuses the API.
flows:
password:
tokenUrl: https://auth.api.stash.energy/60658de9-a14c-4bb9-8dc5-26d1bd003872/oauth2/v2.0/token?p=b2c_1_auth&grant_type=password&scope=openid%20032d91df-6ddf-43d3-bcc9-8015d1f5a539&client_id=032d91df-6ddf-43d3-bcc9-8015d1f5a539&response_type=token
scopes: {}
responses:
BadRequest: # 400
description: BAD_REQUEST
content:
application/json:
schema:
$ref: "#/components/schemas/BadRequest"
examples:
one:
$ref: "#/components/examples/BadRequestResponseExample"
Unauthorized: # 401
description: UNAUTHORIZED
content:
text/plain:
schema:
$ref: "#/components/schemas/Unauthorized"
Forbidden: # 403
description: FORBIDDEN
content:
text/plain:
schema:
$ref: "#/components/schemas/Forbidden"
NotFound: # 404
description: NOT_FOUND
content:
application/json: # What we send back
schema:
$ref: "#/components/schemas/NotFound"
examples:
one:
$ref: "#/components/examples/NotFoundResponseExample"
UnprocessableEntity: # 422
description: UNPROCESSABLE_ENTITY
content:
application/json:
schema:
$ref: "#/components/schemas/UnprocessableEntity"
examples:
one:
$ref: "#/components/examples/UnprocessableEntityResponseExample"
InternalError: # 500
description: INTERNAL_ERROR
content:
text/plain:
schema:
$ref: "#/components/schemas/InternalError"
schemas:
User:
type: object
properties:
href:
type: string
format: uri
description: Link to self
examples:
- https://api.stash.energy/user
name:
type: string
description: User's name
readOnly: true
examples:
- Username
Utilities:
type: object
readOnly: true
properties:
href:
type: string
format: uri
description: Link to self
readOnly: true
examples:
- https://api.stash.energy/utilities
pagination:
$ref: "#/components/schemas/Pagination"
utilities:
type: array
items:
$ref: "#/components/schemas/Utility"
description: List of utilities
Utility:
type: object
properties:
href:
type: string
format: uri
description: Link to self
readOnly: true
examples:
- https://api.stash.energy/utilities/12abcde3-fgh4-5ij6-k7l8-9012345mn678
id:
type: string
readOnly: true
description: Utility ID
examples:
- 1-12abcde3-fgh4-5ij6-k7l8-9012345mn678
name:
type: string
description: Utility's name
examples:
- Stash Electric
Units:
type: object
readOnly: true
properties:
href:
type: string
format: uri
description: Link to self
examples:
- https://api.stash.energy/utilities/12abcde3-fgh4-5ij6-k7l8-9012345mn678/units
pagination:
$ref: "#/components/schemas/Pagination"
units:
type: array
items:
$ref: "#/components/schemas/UnitResponse"
description: List of units
UnitResponse:
type: object
required:
- href
- id
- tags
- type
- firmwareVersion
- connectionReliability
properties:
href:
type: string
format: uri
description: URL to self
readOnly: true
examples:
- https://api.stash.energy/utilities/12abcde3-fgh4-5ij6-k7l8-9012345mn678/units/ac57ae8227db0eb6977413961b6168a02dd59b59f2d78215908a1a04adc95fde0762fe1a107a795b2842fc91e43d7b50a4827765f757eae1a9a72232368b9788
id:
type: string
readOnly: true
description: Unit's ID
examples:
- ac57ae8227db0eb6977413961b6168a02dd59b59f2d78215908a1a04adc95fde0762fe1a107a795b2842fc91e43d7b50a4827765f757eae1a9a72232368b9788
serialNumber:
type: string
readOnly: true
description: Unit's serial number
examples:
- ABCDEF01
type:
type: string
readOnly: true
description: The type of storage unit, e.g. M1
examples:
- M1
tags:
type: array
readOnly: true
items:
type: string
description: Array of tags assigned to this unit.
examples:
- ["tag1"]
connectionReliability:
type: number
readOnly: true
description: Percentage of how likely the device is to be connected to the Internet (%)
minimum: 0.0
maximum: 100.0
examples:
- 89.7
firmwareVersion:
type: string
readOnly: true
description: The unit's Stash firmware version
examples:
- v1.1.0 (2019102513)
state:
description: The unit's most recent recorded state
oneOf:
- $ref: "#/components/schemas/State"
- $ref: "#/components/schemas/ResearchState"
weeklySchedule:
$ref: "#/components/schemas/WeeklyScheduleResponse"
realtimeSchedule:
$ref: "#/components/schemas/RealtimeScheduleResponse"
PairingCode:
type: object
readOnly: true
properties:
href:
type: string
format: uri
description: URL to self
readOnly: true
examples:
- https://api.stash.energy/utilities/12abcde3-fgh4-5ij6-k7l8-9012345mn678/pairing-codes/01234567
code:
type: string
description: The pairing code to be entered into the Stash device
examples:
- "01234567"
expiresOn:
type: integer
description: Unix timestamp of when this code expires
examples:
- 1617836800
status:
type: string
enum:
- "success"
- "new"
- "error"
- "unitAlreadyPaired"
description: |
The status of the pairing:
* `"new"`: The pairing code is new and hasn't been used yet
* `"success"`: The pairing was completed successfully
* `"error"`: There was an error pairing the device but you can try again with the same code
* `"unitAlreadyPaired"`: The unit cannot be paired because it is already paired with another utility
unitId:
type: string
description: The ID of the unit that was paired successfully to the utility. Only populated when the pairing code `status` is `"success"`.
examples:
- ac57ae8227db0eb6977413961b6168a02dd59b59f2d78215908a1a04adc95fde0762fe1a107a795b2842fc91e43d7b50a4827765f757eae1a9a72232368b9788
PastStates:
type: object
readOnly: true
properties:
href:
type: string
format: uri
description: Link to self
examples:
- https://api.stash.energy/utilities/12abcde3-fgh4-5ij6-k7l8-9012345mn678/units/ac57ae8227db0eb6977413961b6168a02dd59b59f2d78215908a1a04adc95fde0762fe1a107a795b2842fc91e43d7b50a4827765f757eae1a9a72232368b9788/past-states
start:
type: integer
description: Start Unix timestamp that was provided in the request query parameters
examples:
- 1577836800
end:
type: integer
description: End Unix timestamp that was provided in the request query parameters. If it was not provided, it is the timestamp of when the request was received
examples:
- 1577851200
pagination:
$ref: "#/components/schemas/Pagination"
pastStates:
type: array
items:
oneOf:
- $ref: "#/components/schemas/State"
- $ref: "#/components/schemas/ResearchState"
description: List of past states
State:
type: object
description: An object representing the unit's dynamic info at a specific time in history
readOnly: true
properties:
href:
type: string
format: uri
description: Link to self
examples:
- https://api.stash.energy/utilities/12abcde3-fgh4-5ij6-k7l8-9012345mn678/units/12abcde3-fgh4-5ij6-k7l8-9012345mn678/past-states/12abcde3-fgh4-5ij6-k7l8-9012345mn678
id:
type: string
description: State ID (GUID)
examples:
- "12abcde3-fgh4-5ij6-k7l8-9012345mn678"
timestamp:
type: integer
description: Unix timestamp of when this state was recorded
examples:
- 1577836801
scheduleMode:
$ref: "#/components/schemas/ScheduleModeEnum"
storageMode:
$ref: "#/components/schemas/StorageModeEnum"
demand:
type: number
description: The electrical energy the heat pump is using (kW)
readOnly: true
examples:
- 1.25
outdoorTemp:
type: number
description: The outdoor ambient temperature (ºC)
readOnly: true
examples:
- 16.5
ResearchState:
allOf:
- $ref: "#/components/schemas/State"
- type: object
readOnly: true
properties:
indoorTemp:
type: number
description: The ambient indoor temperature as recorded by the unit (ºC)
readOnly: true
examples:
- 21.5
indoorOutTemp:
type: number
description: The temperature of the air exiting the unit (ºC)
readOnly: true
examples:
- 30.0
indoorFanSpeed:
type: integer
description: Percentage of how fast the indoor fan is running (%)
minimum: 0
maximum: 100
readOnly: true
examples:
- 75
outdoorFanSpeed:
type: integer
description: Percentage of how fast the outdoor heat pump fan is running (%)
minimum: 0
maximum: 100
readOnly: true
examples:
- 0
compressorSpeed:
type: integer
description: How fast the compressor is running (hz)
minimum: 0
maximum: 120
readOnly: true
examples:
- 0
defrost:
type: integer
description: Whether or not the heat pump is defrosting (0 - no, 1 - yes)
minimum: 0
maximum: 1
examples:
- 0
setpoint:
type: number
description: The user-set setpoint (ºC)
readOnly: true
examples:
- 23.5
heatPumpMode:
$ref: "#/components/schemas/HeatPumpModeEnum"
StorageModeEnum:
type: string
description: |
Describes the storage mode of the unit. The allowed values are:
* `"charge"`: The unit is charging
* `"discharge"`: The unit is discharging
* `"maintain"`: The unit is maintaining its charge
enum:
- charge
- discharge
- maintain
examples:
- charge
HeatPumpModeEnum:
type: string
description: |
The user-set heat pump mode.
* `"off"`: The heat pump is off
* `"heat"`: The heat pump is in heating mode
* `"cool"`: The heat pump is in cooling mode
* `"dehumidify"`: The heat pump is in dehumidify mode
* `"fan"`: The heat pump is in fan only mode
enum:
- off
- heat
- cool
- dehumidify
- fan
examples:
- heat
RealtimeStorageScheduleResponse:
type: object
description: A unit's schedule, consisting of a list of StorageEvents. Times are Unix timestamps
properties:
href:
type: string
format: uri
description: Link to self
readOnly: true
hasBeenDelivered:
type: boolean
description: If the schedule has been delivered to the unit
readOnly: true
schedule:
type: array
description: A list of times to change the unit's storage mode
items:
$ref: "#/components/schemas/StorageEvent"
required:
- href
- schedule
- hasBeenDelivered
RealtimeScheduleResponse:
required:
- events
- hasBeenDelivered
type: object
properties:
events:
type: array
items:
$ref: "#/components/schemas/StorageEvent"
description: The schedule events
hasBeenDelivered:
type: boolean
description: If the schedule has been delivered to the unit
description: Realtime storage schedule
WeeklySchedule:
type: object
description: |
A unit's weekly schedule, consisting of a list of weekdays and 24h times when to change the storage mode.
The unit will use this schedule if no other schedule is provided. This schedule is only active when a Units' scheduleMode state is set to "weekly"
properties:
href:
type: string
format: uri
description: Link to self
readOnly: true
utcOffset:
type: integer
format: int32
description: The UTC offset in seconds as was requested in the query parameter
minimum: -86399
maximum: 86399
readOnly: true
hasBeenDelivered:
type: boolean
description: If the schedule has been delivered to the unit
readOnly: true
schedule:
type: array
items:
$ref: "#/components/schemas/WeeklyStorageModeChange"
description: Weekly schedule
required:
- utcOffset
- schedule
- hasBeenDelivered
WeeklyScheduleResponse:
required:
- hasBeenDelivered
- events
- utcOffset
type: object
properties:
hasBeenDelivered:
type: boolean
description: If the schedule has been delivered to the unit
events:
type: array
items:
$ref: "#/components/schemas/WeeklyStorageModeChange"
description: The schedule events
utcOffset:
type: integer
format: int32
description: The UTC offset (in seconds) of the returned schedule
description: Weekly storage schedule
ScheduleModeEnum:
type: string
description: |
Describes the schedule mode of the unit. The allowed values are:
* `"off"`: The unit is not using a schedule and the storage mode will be set to "maintain"
* `"weekly"`: The unit is using its weekly schedule to determine its storage mode
* `"realtime"`: The unit is using the provided real-time schedule to determine its storage mode
enum:
- off
- weekly
- realtime
StorageEvent:
type: object
properties:
start:
type: integer
description: When the event should begin (Unix timestamp)
examples:
- 1577836800
end:
type: integer
description: When the event should end (Unix timestamp)
examples:
- 1577851200
storageMode:
$ref: "#/components/schemas/StorageModeEnum"
required:
- start
- end
- storageMode
WeeklyStorageModeChange:
type: object
properties:
storageMode:
$ref: "#/components/schemas/StorageModeEnum"
time:
type: integer