forked from nicupavel/rainmachine-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapiary.apib
More file actions
2886 lines (2589 loc) · 92.9 KB
/
Copy pathapiary.apib
File metadata and controls
2886 lines (2589 loc) · 92.9 KB
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
FORMAT: X-1A
HOST: https://device.ip:8080/api/4/
# RainMachine
RainMachine API version 4.2 for accesing [RainMachine](http://www.rainmachine.com) devices. Document revision 1.5.
### Compatible devices
- 1st generation RainMachine: `hwVer: 1.0` partial support where noted
- [RainMachine Mini 8](http://www.rainmachine.com/products/rainmachine-mini-8.html): `hwVer: 2.0` full support
- [RainMachine Touch HD](http://www.rainmachine.com/products/rainmachine-touch-hd-12.html): `hwVer: 3.0` full support
For 1st generation RainMachine the RESTful interface is accessible via HTTPS on port 443 or via HTTP on port 80. Use of HTTPS is highly recommended.
For the [RainMachine Mini 8](http://www.rainmachine.com/products/rainmachine-mini-8.html) and [RainMachine Touch HD](http://www.rainmachine.com/products/rainmachine-touch-hd-12.html) the RESTful interface is accessible via HTTPS on port 8080. HTTP access is only allowed from localhost and it's bound to port 18080.
### Allowed HTTPS requests
- `POST` - Creates or updates a resource
- `GET` - Retrieves a resource or list of resources
### Typical Server Responses
- 200 `OK` - The request was successful
- 400 `Bad Request` - The request could not be understood or was missing required parameters.
- 401 `Unauthorized` - Authentication failed or user does not have permissions for the requested operation.
- 404 `Not Found` - Resource was not found.
- 405 `Method Not Allowed` - Requested method is not supported for the specified resource.
- 460 `Cannot Change Password` - Cannot change password
- 501 `Exception Occured` - Exception occured while processing the call
- 540 `Database Error` - Error saving data to database
- 541 `Provision Failed` - Cannot provision unit
### Authentication
After authenticating using `POST /auth/login` [described below](#post-auth-login), additional API calls must contain the returned `access_token` as a URL parameter.
Example: `GET /api/4/program?access_token=YOUR_ACCESS_TOKEN`
### Changes from API 4.0 to API 4.1
- **NEW** - `POST /dev/import/sshkey` Allow user to upload its own ssh key for login into RainMachine Touch HD.
- **NEW** - `POST /parser/{id}/delete` Delete an existing user (custom uploaded) parser.
- **NEW** - `POST /restrictions/hourly/{id}` Modify the specified hourly restriction.
- **NEW** - `GET /restrictions/currently` Get a summary of currently active restrictions on device.
- **NEW** - `POST /dev/beta` Subscribe to the beta channel for software updates
- **NEW** - `POST /dev/trigger` Send a trigger to the notification server
- **MODIFICATION** - `GET /watering/log` Added *userDuration* field
- **MODIFICATION** - `GET /zone` Added *active* field
- **MODIFICATION** - `GET /diag` Added internetStatus, uptimeSeconds, cloudstatus fields
- **MODIFICATION** - `GET /watering/available` Added possibility to specify start date and days
- **MODIFICATION** - `GET /watering/past` Added possibility to specify start date and days
- **MODIFICATION** - `GET /dailystats` Return an error code if simulation is still being run
- **MODIFICATION** - `GET /parser` Added lastKnownError, isRunning fields
### Changes from API 4.1 to API 4.2
- **NEW** - `POST /dev/parser/{id}/defaults` Reset parser parameters to default values
- **NEW** - `GET /auth/totp` Generates a timebased one time password for guest/support access with 1 day valability
- **MODIFICATION** - `GET and POST /program` Added *(optional)* startTimeParams that are used to set program start time at sunrise or sunset +/- a specified offset in minutes.
- **MODIFICATION** - `GET /parser` Added description, hasForecast, hasHistorical fields for extra information about a parser.
# Group API versions
## GET /apiVer
Returns the software, hardware and api level versions.
*Available on 1st gen. Response: "apiVer":"4.0.0", "hwVer":"1.0", "swVer":"3.63".*
+ Response 200 (application/json)
{
"apiVer": "4.2.0",
"hwVer": 2,
"swVer": "4.0.636"
}
# Group Authentication
<a name="post-auth-login"></a>
## POST /auth/login
Request auth with the device response will include a token to be used on subsequent calls
*Available on 1st gen. Response: "access_token", "statusCode", "expires_in".*
+ Request
{
"pwd": "password",
"remember": 1
}
+ Response 200 (application/json)
{
"access_token": "fb127e22a7cd1294df47cce8acb4cd88c87eb27236b0a3be7dfd1f82",
"checksum": "14245b630a7affb06f7dad6004da60c0f928545e34f7e9c3dcf81ec747937bba06a1665ff61a6923fe12e8e4cc1057c89f25735f778c9b87",
"expiration": "Mon, 09 Dec 2019 06:43:17 GMT",
"statusCode": 0
}
## POST /auth/change
Request a password change
*Partial support on 1st gen: "newPass", "oldPass". Response: "statusCode", "message".*
+ Request
{
newPass: "newPass",
oldPass: "oldPass"
}
+ Response 200 (application/json)
{
"access_token": "13d45261540dc77f4cd130eaca2ce8ca7d42aa674dea76a9e2d24cd7",
"checksum": "266ce876ab8df7f8e0d6e503a820eab39c60d1dd4a9b9f8ffcfdd746b0cf1c28868aa13dad57b4a7d1e07b0a5b8a602095dce7e291983415",
"expiration": "Mon, 09 Dec 2019 06:50:03 GMT",
"statusCode": 0
}
## POST /auth/check
Request a password check.
*Available on 1st gen. Response: "statusCode", "message".*
+ Request
{
"pwd": "password"
}
+ Response 200 (application/json)
{
"statusCode": 0
}
## GET /auth/totp
Generates a 6 characters Time-based One-time Password that can be used in subsequent auth calls for a limited duration guest login (1 day)
+ Response 200 (application/json)
{
"totp": 123456
}
# Group Provision
Device provision related functions
## /provision
### GET
Get device settings
#### System
| Variable | Type | Description |
| ------------------------------|------------|--------------------- |
| `httpEnabled` | *boolean* | If the HTTP server is enabled |
| `programSingleSchedule` | *boolean* | Allows multiple runs of same program in the same day (eg: rescheduled to another hour) |
| `mixerHistorySize` | *integer* | The number of days mixer will save in it's history |
| `programZonesShowInactive` | *boolean* | List program inactive zones in queries |
| `standaloneMode` | *boolean* | If the device is configured but left in Access Point mode (no internet weather) |
| `masterValveAfter` | *integer* | Seconds for which the master valve will open after each zone |
| `apiVersion` | *string* | Version of software API |
| `selfTest` | *boolean* | Reserved |
| `defaultZoneWateringDuration` | *integer* | Default seconds that a zone will be watered when started manually |
| `maxLEDBrightness` | *integer* | Maximum brightness for the front panel leds (0 - 255) |
| `simulatorHistorySize` | *integer* | How many days to keep simulated data in database (default 0) |
| `masterValveBefore` | *integer* | Seconds for which the master valve will open before each zone |
| `touchProgramToRun` | *integer* | Which program can be run from touch interface on Mini 8 (id of program) |
| `useRainSensor` | *boolean* | Set to true if you have a rain sensor connected. Will stop watering if rain is detected|
| `wizardHasRun` | *boolean* | Indicates if the wizard from a mobile device has been run |
| `waterLogHistorySize` | *integer* | How many days to keep watering information in database (default 365) |
| `netName` | *string* | Device Name |
| `touchSleepTimeout` | *integer* | After how many seconds of inactivity to close the leds on Mini 8 |
| `touchAdvanced` | *boolean* | Activate touch panel advanced usage that allows queueing of zones on Mini 8 |
| `hardwareVersion` | *integer* | Hardware version of the device (same as hwVer from /apiVer call) |
| `touchLongPressTimeout` | *integer* | After how many seconds a long touch will register automatically on Mini 8 |
| `parserDataSizeInDays` | *integer* | How many days of forecast parsers should get |
| `programListShowInactive` | *boolean* | List inactive programs in queries |
| `parserHistorySize` | *integer* | How many past days the parsers will keep in database |
| `minLEDBrightness` | *integer* | Minimum brightness for the front panel leds |
| `minWateringDurationThreshold`| *integer* | If calculated watering duration in seconds is lower that this the zone won't be started|
| `localValveCount` | *integer* | Number of valves this device has available |
| `touchAPSeconds` | *integer* | Delay after which the user won't be alloed to login when device is in setup mode |
| `useCommandLineArguments` | *boolean* | If the application was started with extra arguments |
| `databasePath` | *string* | File system path to the databases |
| `touchCyclePrograms` | *string* | If the local touch interface on Mini 8 should also allow program start besides zones |
| `zoneListShowInactive` | *boolean* | List inactive zones in queries |
| `zoneDuration` | *int array*| Default list of zone durations for manual running |
| `useCorrectionForPast` | *boolean* | If watering algorithm should also consider past weather data |
| `useMasterValve` | *boolean* | If a Master Valve is connected to Valve 1 |
| `maxWateringCoef` | *integer* | How much over-watering is allowed |
#### Location
| Variable | Type | Description |
| ------------------------------|------------|--------------------------------------------------------------------------------------- |
| `stationID` | *integer* | The closest weather station ID |
| `elevation` | *float* | Terrain elevation in meters |
| `doyDownloaded` | *boolean* | If et0 data for each day of year has been downloaded for this location |
| `zip` | *integer* | Location ZIP ( **obsolete** ) |
| `windSensitivity` | *float* | Sensitivity to wind speed (as percentage in float) |
| `krs` | *float* | Adjustment coefficient used in ET0 ASCE formula |
| `state` | *string* | Location state |
| `stationSource` | *string* | Where the weather station list comes from, station list or grid list |
| `et0Average` | *float* | The average ET0 value for this location |
| `latitude` | *float* | Location latitude |
| `windElevation` | *integer* | The elevation at which wind is measured for this location used in ET0 ASCE formula |
| `stationName` | *string* | Weather station name |
| `wsDays` | *integer* | For how many days the water savings are taken in account |
| `stationDownloaded` | *boolean* | If nearby weather stations had been downloaded |
| `address` | *string* | Location address |
| `rainSensitivity` | *float* | How much precipitation influences ET0 formula, as percentage represented in float |
| `timezone` | *string* | Timezone description |
| `longitude` | *float* | Location longitude |
| `name` | *string* | Location name |
+ Response 200 (application/json)
{
"system": {
"httpEnabled": true,
"programSingleSchedule": false,
"mixerHistorySize": 365,
"programZonesShowInactive": false,
"standaloneMode": false,
"masterValveAfter": 0,
"apiVersion": "4.0.0",
"selfTest": false,
"defaultZoneWateringDuration": 300,
"maxLEDBrightness": 80,
"simulatorHistorySize": 0,
"masterValveBefore": 0,
"touchProgramToRun": null,
"useRainSensor": false,
"wizardHasRun": true,
"waterLogHistorySize": 365,
"netName": "Nicu-SPK2",
"touchSleepTimeout": 10,
"touchAdvanced": false,
"hardwareVersion": 2,
"touchLongPressTimeout": 3,
"parserDataSizeInDays": 6,
"programListShowInactive": true,
"parserHistorySize": 365,
"minLEDBrightness": 0,
"minWateringDurationThreshold": 0,
"localValveCount": 8,
"touchAuthAPSeconds": 60,
"useCommandLineArguments": false,
"databasePath": "/rainmachine-app/DB/Default",
"touchCyclePrograms": true,
"zoneListShowInactive": true,
"zoneDuration": [
300,
300,
300,
300,
300,
300,
300,
300
],
"useCorrectionForPast": false,
"useMasterValve": false,
"maxWateringCoef": 2
},
"location": {
"stationID": 9234,
"elevation": 106.87275695799999,
"doyDownloaded": true,
"zip": null,
"windSensitivity": 0.5,
"krs": 0.19,
"state": "Default",
"stationSource": "station",
"et0Average": 6,
"latitude": 37.662431199999994,
"windElevation": 2,
"stationName": "LIVERMORE MUNI AP",
"wsDays": 2,
"stationDownloaded": true,
"address": "Default",
"rainSensitivity": 0.8,
"timezone": "America/Los_Angeles",
"longitude": -121.87467890000001,
"name": "Pleasanton, CA, United States"
}
}
### POST
Sets device provision settings. See above for parameter explanation. Settings can be sent in full list, multiple keys/values or just one key/value.
+ Request (application/json)
{
"system": {
"httpEnabled": true,
"programSingleSchedule": false,
"mixerHistorySize": 365,
"programZonesShowInactive": false,
"standaloneMode": false,
"masterValveAfter": 0,
"apiVersion": "4.0.0",
"selfTest": false,
"defaultZoneWateringDuration": 300,
"maxLEDBrightness": 80,
"simulatorHistorySize": 0,
"masterValveBefore": 0,
"touchProgramToRun": null,
"useRainSensor": false,
"wizardHasRun": true,
"waterLogHistorySize": 365,
"netName": "RainMachine",
"touchSleepTimeout": 10,
"touchAdvanced": false,
"hardwareVersion": 2,
"touchLongPressTimeout": 3,
"parserDataSizeInDays": 6,
"programListShowInactive": true,
"parserHistorySize": 365,
"minLEDBrightness": 0,
"minWateringDurationThreshold": 0,
"localValveCount": 8,
"touchAuthAPSeconds": 60,
"useCommandLineArguments": false,
"databasePath": "/rainmachine-app/DB/Default",
"touchCyclePrograms": true,
"zoneListShowInactive": true,
"zoneDuration": [
300,
300,
300,
300,
300,
300,
300,
300
],
"useCorrectionForPast": false,
"useMasterValve": false,
"maxWateringCoef": 2
},
"location": {
"stationID": 9234,
"elevation": 106.87275695799999,
"doyDownloaded": true,
"zip": null,
"windSensitivity": 0.5,
"krs": 0.19,
"state": "Default",
"stationSource": "station",
"et0Average": 6,
"latitude": 37.662431199999994,
"windElevation": 2,
"stationName": "LIVERMORE MUNI AP",
"wsDays": 2,
"stationDownloaded": true,
"address": "Default",
"rainSensitivity": 0.8,
"timezone": "America/Los_Angeles",
"longitude": -121.87467890000001,
"name": "Pleasanton, CA, United States"
}
}
+ Response 200 (application/json)
{
"statusCode": 0
}
## /provision/name
### GET
Returns device name (shortcut to provision.system.netName)
+ Response 200 (application/json)
{"name": "RainMachine"}
## POST
Sets device name
*Available on 1st gen. Response: "statusCode", "message".*
+ Response 200 (application/json)
{
"statusCode": 0
}
## GET /provision/wifi
Returns current WIFI configuration
+ Response 200 (application/json)
{
"interface": "wlan0",
"macAddress": "18:c8:e7:81:a2:6e",
"ipAddress": "192.168.12.126",
"hasClientLink": true,
"mode": "managed"
}
## GET /provision/wifi/scan
Returns Access Points in range with RainMachine
+ Response 200 (application/json)
{
"scanResults": [
{
"SSID": "LinuxConsulting",
"isEncrypted": true,
"signal": "-52",
"isWEP": false,
"BSS": "00:23:69:F9:55:D1",
"isWPA": false,
"isWPA2": true,
"channel": "3"
},
{
"SSID": "RainMachine",
"isEncrypted": false,
"signal": "-41",
"isWEP": false,
"BSS": "1A:C8:E7:81:9A:B8",
"isWPA": false,
"isWPA2": false,
"channel": "11"
}
]
}
## POST /provision/wifi/settings
Sets the Access Point to which RainMachine will connect to and network settings such as ip, netmask, gateway unless networkType is set as dhcp
+ Response 200 (application/json)
{
"statusCode": 0
}
# Group Programs
Watering Programs, each program can contain several Zones and rules that control the irrigation
## /program
### GET
Get all watering programs defined on device
*Partial support on 1st gen: "uid", "name", "active", "startTime", "cycles", "soak", "cs_on", "delay", "delay_on", "status", "frequency", "ignoreInternetWeather", "futureField1", "freq_modified", "nextRun", "wateringTimes".*
| Variable | Type | Description |
| ------------------------------|---------------------|--------------------------------------------------------------------------------------- |
| `uid` | *integer* | Program unique ID. Automatically generated when a new program is created |
| `name` | *string* | Program Name |
| `active` | *boolean* | If program is not active it won't be started |
| `startTime` | *string* | Program start time in HH:MM format |
| `cycles` | *integer* | The number of cycles that the duration of each zone will be split into |
| `soak` | *integer* | How many seconds to wait before starting next cycle for same zone |
| `cs_on` | *boolean* | If cycle and soak settings are enabled or not for this program |
| `delay` | *integer* | The delay between starting next zone (to build water pressure) |
| `delay_on` | *boolean* | If the delay between zones is enabled or not |
| `status` | *integer* | Watering status: 0 - not running, 1 - running, 2 - queued |
| `frequency` | *object* | |
| `coef` | *float* | |
| `ignoreInternetWeather` | *boolean* | |
| `futureField1` | *integer* | |
| `freq_modified` | *integer* | |
| `useWaterSense` | *boolean* | |
| `nextRun` | *string* | Next scheduled run in YYYY-MM-DD format |
| `wateringTimes` | *array of objects* | |
| `startTimeParams` | *object* | Used to set program start time at sunrise/sunset. Start hour, minute is automatically computed every time the program starts (see below) |
| **frequency** Object keys | Type | Description |
| ------------------------------|---------------------|-------------------------------------------------------------- |
| `type` | *integer* | Daily: 0, Every N days: 1, Weekday: 2, Odd/Even day: 4 |
| `param` | *integer* | Odd days: 1, Even days: 0, EveryNFormat: days, Weekday: "SSFTWTM0" |
|**startTimeParams** Object keys | Type | Description |
| ------------------------------|---------------------|-------------------------------------------------------------- |
| `type` | *integer* | Normal start time: 0, Sunrise: 1, Sunset: 2 |
| `offsetMinutes` | *integer* | Minutes after/before sunrise/sunset |
| `offsetSign` | *integer* | -1 offsetMinutes are before selected type, 1 means after |
+ Response 200 (application/json)
{
"programs": [
{
"uid": 1,
"name": "Program1",
"active": true,
"startTime": "06:00",
"cycles": 0,
"soak": 0,
"cs_on": false,
"delay": 0,
"delay_on": false,
"status": 0,
"startTimeParams": {
"type": 2,
"offsetMinutes": 190,
"offsetSign": -1
},
"frequency": {
"type": 0,
"param": "0"
},
"coef": 0.0,
"ignoreInternetWeather": false,
"futureField1": 0,
"freq_modified": 0,
"useWaterSense": false,
"nextRun": "2015-06-17",
"wateringTimes": [
{
"id": 1,
"name": "Zone 1",
"duration": 300,
"active": true
},
{
"id": 2,
"name": "Zone 2",
"duration": 0,
"active": false
},
{
"id": 3,
"name": "Zone 3",
"duration": 0,
"active": false
},
{
"id": 4,
"name": "Zone 4",
"duration": 0,
"active": false
},
{
"id": 5,
"name": "Zone 5",
"duration": 0,
"active": false
},
{
"id": 6,
"name": "Zone 6",
"duration": 0,
"active": false
},
{
"id": 7,
"name": "Zone 7",
"duration": 0,
"active": false
},
{
"id": 8,
"name": "Zone 8",
"duration": 0,
"active": false
}
]
}
]
}
### POST
Create a new Program (program id will be automatically generated)
*Available on 1st gen. Response: "statusCode", "message".*
+ Response 200 (application/json)
{ "statusCode": 0 }
## GET /program/nextrun
Returns next running date/time for all active programs
*Available on 1st gen.*
+ Response 200 (application/json)
{
"nextRuns": [
{
"pid": 31,
"startTime": "05:55"
},
{
"pid": 33,
"startTime": "11:22"
}
]
}
##/program/{id}
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the program to retrieve
### GET
Get program with specified id
*Partial support on 1st gen: "uid", "name", "active", "startTime", "cycles", "soak", "cs_on", "delay", "delay_on", "status", "frequency", "ignoreInternetWeather", "futureField1", "freq_modified", "nextRun", "wateringTimes".*
+ Response 200 (application/json)
{
"uid": 1,
"name": "Program1",
"active": true,
"startTime": "06:00",
"cycles": 0,
"soak": 0,
"cs_on": false,
"delay": 0,
"delay_on": false,
"status": 0,
"startTimeParams": {
"type": 2,
"offsetMinutes": 190,
"offsetSign": -1
},
"frequency": {
"type": 0,
"param": "0"
},
"coef": 0.0,
"ignoreInternetWeather": false,
"futureField1": 0,
"freq_modified": 0,
"useWaterSense": false,
"nextRun": "2015-06-04",
"wateringTimes": [
{
"id": 1,
"name": "Zone 1",
"duration": 300,
"active": true
},
{
"id": 2,
"name": "Zone 2",
"duration": 0,
"active": false
},
]
}
### POST
Update program parameters with specified id
*Partial support on 1st gen: "uid", "name", "active", "startTime", "cycles", "soak", "cs_on", "delay", "delay_on", "status", "frequency", "ignoreInternetWeather", "futureField1", "freq_modified", "nextRun", "wateringTimes". Response: "statusCode", "message".*
+ Response 200 (application/json)
{ "statusCode": 0 }
## POST /program/{id}/delete
Delete Program with id
*Available on 1st gen. Response: "statusCode", "message".*
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the program to retrieve
+ Response 200 (application/json)
{ "statusCode": 0 }
## POST /program/{id}/start
Start watering Program with id
*Available on 1st gen. Response: "statusCode", "message".*
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the program to retrieve
+ Response 200 (application/json)
{ "statusCode": 0 }
## POST /program/{id}/stop
Remove Program with id from watering queue
*Available on 1st gen.*
+ Parameters
+ id (required, number, `1`) ... Numeric `id` of the program to retrieve
+ Response 200 (application/json)
{ "statusCode": 0 }
# Group Zones
Irrigation zones, each zone corresponds to a valve connector on device
## GET /zone
Returns a list of *all* zones and their generic properties
*Partial support on 1st gen: "uid", "name", "state", "remaining", "type", "master".*
| Variable | Type | Description |
| ------------------------------|---------------------|--------------------------------------------------------------------------------------- |
| `uid` | *integer* | Zone unique ID Usually from 1 to max number of valves |
| `name` | *string* | Name of the zone |
| `state` | *integer* | Watering status: 0 - not running, 1 - running, 2 - queued |
| `userDuration` | *integer* | Duration in seconds that was set by user for this zone |
| `machineDuration` | *integer* | Duration of actual watering that was calculated by RainMachine |
| `remaining` | *integer* | Remaining duration when watering has started |
| `cycle` | *integer* | The current cycle for this zone (if running from a program with cycles enabled) |
| `noOfCycles` | *integer* | Total number of cycles for this zone for running program |
| `restriction` | *boolean* | If the zone is in any current restrictions |
| `type` | *integer* | Vegetation Type (**review**) |
| `master` | *boolean* | If the zone is set as master valve |
| `watersense` | *boolean* | If the zone is in a watersense program |
+ Response 200 (application/json)
{
"zones": [
{
"uid": 1,
"name": "Zone 1",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
},
{
"uid": 2,
"name": "Zone 2",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
},
{
"uid": 3,
"name": "Zone 3",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
},
{
"uid": 4,
"name": "Zone 4",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
},
{
"uid": 5,
"name": "Zone 5",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
},
{
"uid": 6,
"name": "Zone 6",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
},
{
"uid": 7,
"name": "Zone 7",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
},
{
"uid": 8,
"name": "Zone 8",
"state": 0,
"userDuration": 0,
"machineDuration": 0,
"remaining": 0,
"cycle": 0,
"noOfCycles": 0,
"restriction": false,
"type": 1,
"master": false,
"waterSense": false
}
]
}
## GET /zone/properties
Returns advanced properties for *all* zones
*Partial support on 1st gen: "uid", "name", "active", "type", "internet", "history", "master", "before", "after".*
+ Response 200 (application/json)
{
"zones": [
{
"uid": 1,
"name": "Zone 1",
"valveid": 1,
"ETcoef": 1,
"active": true,
"type": 1,
"internet": true,
"savings": 50,
"slope": 1,
"sun": 1,
"soil": 1,
"group_id": 0,
"history": true,
"master": false,
"before": 0,
"after": 0,
"waterSense": {
"maxAllowedDepletion": 0.0,
"precipitationRate": 0.0,
"appEfficiency": 0.0,
"allowedSurfaceAcc": 0.0,
"rootDepth": 0,
"isTallPlant": 0,
"soilIntakeRate": 0.0,
"detailedMonthsKc": [
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0
],
"permWilting": 0.0,
"fieldCapacity": 0.0
}
},
{
"uid": 2,
"name": "Zone 2",
"valveid": 2,
"ETcoef": 1,
"active": true,
"type": 1,
"internet": true,
"savings": 50,
"slope": 1,
"sun": 1,
"soil": 1,
"group_id": 0,
"history": true,
"master": false,
"before": 0,
"after": 0,
"waterSense": {
"maxAllowedDepletion": 0.5,
"precipitationRate": 40.64,
"appEfficiency": 0.55000000000000012,
"allowedSurfaceAcc": 6.35,
"rootDepth": 254,
"isTallPlant": 0,
"soilIntakeRate": 8.8899999999999988,
"detailedMonthsKc": [
0.41,
0.46,
0.52,
0.56000000000000012,
0.6,
0.62,
0.62,
0.6,
0.56000000000000012,
0.5,
0.45,
0.4
],
"permWilting": 0.03,
"fieldCapacity": 0.2
}
},
{
"uid": 3,
"name": "Zone 3",
"valveid": 3,
"ETcoef": 1,
"active": true,
"type": 1,
"internet": true,
"savings": 50,
"slope": 1,
"sun": 1,
"soil": 1,
"group_id": 0,
"history": true,
"master": false,
"before": 0,
"after": 0,
"waterSense": {
"maxAllowedDepletion": 0.4,
"precipitationRate": 40.64,
"appEfficiency": 0.6,
"allowedSurfaceAcc": 4.064,
"rootDepth": 205.73999999999997,
"isTallPlant": 0,
"soilIntakeRate": 3.8099999999999994,
"detailedMonthsKc": [
0.52,
0.64,
0.7,
0.73,
0.73,
0.71,
0.69,
0.67000000000000012,
0.64,
0.6,
0.56999999999999988,
0.53
],
"permWilting": 0.03,
"fieldCapacity": 0.2
}
},
{
"uid": 4,
"name": "Zone 4",
"valveid": 4,
"ETcoef": 1,
"active": true,
"type": 1,
"internet": true,
"savings": 50,
"slope": 1,
"sun": 1,
"soil": 1,
"group_id": 0,
"history": true,
"master": false,
"before": 0,
"after": 0,
"waterSense": {
"maxAllowedDepletion": 0.5,
"precipitationRate": 35.559999999999994,
"appEfficiency": 0.7,
"allowedSurfaceAcc": 6.604,
"rootDepth": 508,
"isTallPlant": 0,
"soilIntakeRate": 12.7,
"detailedMonthsKc": [
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012,
0.55000000000000012
],
"permWilting": 0.03,
"fieldCapacity": 0.12