forked from CoolKit-Technologies/apiDocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateStatusHttp_en.html
764 lines (434 loc) · 20.8 KB
/
updateStatusHttp_en.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="keywords" content=" ">
<title>Update Device Status | Jekyll theme for documentation</title>
<link rel="stylesheet" href="css/syntax.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">-->
<link rel="stylesheet" href="css/modern-business.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/customstyles.css">
<link rel="stylesheet" href="css/boxshadowproperties.css">
<!-- most color styles are extracted out to here -->
<link rel="stylesheet" href="css/theme-blue.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="js/jquery.navgoco.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- Anchor.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/2.0.0/anchor.min.js"></script>
<script src="js/toc.js"></script>
<script src="js/customscripts.js"></script>
<link rel="shortcut icon" href="images/favicon.ico">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="alternate" type="application/rss+xml" title="" href="http://localhost:4000/feed.xml">
<script>
$(document).ready(function() {
// Initialize navgoco with default options
$("#mysidebar").navgoco({
caretHtml: '',
accordion: true,
openClass: 'active', // open
save: false, // leave false or nav highlighting doesn't work right
cookie: {
name: 'navgoco',
expires: false,
path: '/'
},
slide: {
duration: 400,
easing: 'swing'
}
});
$("#collapseAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', false);
});
$("#expandAll").click(function(e) {
e.preventDefault();
$("#mysidebar").navgoco('toggle', true);
});
});
</script>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
<script>
$(document).ready(function() {
$("#tg-sb-link").click(function() {
$("#tg-sb-sidebar").toggle();
$("#tg-sb-content").toggleClass('col-md-9');
$("#tg-sb-content").toggleClass('col-md-12');
$("#tg-sb-icon").toggleClass('fa-toggle-on');
$("#tg-sb-icon").toggleClass('fa-toggle-off');
});
});
</script>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-static-top">
<div class="container topnavlinks">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="fa fa-home fa-lg navbar-brand" href="index.html"> <span class="projectTitle"> CoolKit Cloud Platform</span></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li style="line-height: 50px;">
<label><a href="index.html">中文</a></label>
<label><a href="platformOverview_en.html">English</a></label>
</li>
<li>
<!--start search-->
<div id="search-demo-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
</div>
<script src="js/jekyll-search.js" type="text/javascript"></script>
<script type="text/javascript">
SimpleJekyllSearch.init({
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
dataSource: 'search.json',
searchResultTemplate: '<li><a href="{url}" title="Update Device Status">{title}</a></li>',
noResultsText: 'No results found.',
limit: 10,
fuzzy: true,
})
</script>
<!--end search-->
</li>
</ul>
</div>
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<div class="container">
<div id="main">
<!-- Content Row -->
<div class="row">
<!-- Sidebar Column -->
<div class="col-md-3" id="tg-sb-sidebar">
<ul id="mysidebar" class="nav">
<li class="sidebarTitle">CoolKit Cloud Platform 2.0</li>
<li>
<a href="platformOverview_en.html">Platform Overview</a>
<ul>
</ul>
</li>
<li>
<a href="apiFee_en.html">API Fee</a>
<ul>
</ul>
</li>
<li>
<a href="#">Getting Started</a>
<ul>
<li><a href="developerGuide_en.html">Developer Guide</a></li>
<li><a href="develop_en.html">Prepare Your Development Environment</a></li>
<li><a href="developer_en.html">Become A Developer</a></li>
<li><a href="application_en.html">Create Your First Application</a></li>
<li><a href="instruction_en.html">General Developer Instruction</a></li>
<li><a href="pair_en.html">Pairing Process</a></li>
<li><a href="sdk_en.html">SDK</a></li>
</ul>
</li>
<li>
<a href="#">API Center</a>
<ul>
<li><a href="apiOverview_en.html">API Overview</a></li>
<li class="subfolders">
<a href="#">Region</a>
<ul>
<li><a href="region_en.html">Check current region</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Account Management</a>
<ul>
<li><a href="code_en.html">Verification code</a></li>
<li><a href="register_en.html">Register</a></li>
<li><a href="findpassword_en.html">Reset password</a></li>
<li><a href="updatePassword_en.html">Change Password</a></li>
<li><a href="login_en.html">Login</a></li>
<li><a href="token_en.html">Token Refresh</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Device Management</a>
<ul>
<li><a href="devices_en.html">Device List</a></li>
<li><a href="device_en.html">Check Device</a></li>
<li><a href="addDevice_en.html">Add Device</a></li>
<li><a href="deleteDevice_en.html">Delete Device</a></li>
<li><a href="updateDevice_en.html">Change Device Name</a></li>
<li><a href="addGsm_en.html">Add GSM Device</a></li>
<li><a href="addDeviceGroup_en.html">Add Group</a></li>
<li><a href="updateGroup_en.html">Change Group</a></li>
<li><a href="deleteGroup_en.html">Delete Group</a></li>
<li><a href="addToGroup_en.html">Add device to Group</a></li>
<li><a href="findGroup_en.html">Check Group</a></li>
</ul>
</li>
<li class="subfolders">
<a href="#">Device Control</a>
<ul>
<li><a href="dispatch_en.html">Server Dispatch</a></li>
<li><a href="handshake_en.html">Handshake</a></li>
<li><a href="online_en.html">Device Online/Offline</a></li>
<li><a href="deviceStatus_en.html">Update/Report Status</a></li>
<li><a href="findStatus_en.html">Check Device Status</a></li>
<li><a href="share_en.html">Share Device</a></li>
<li><a href="shareUpdate_en.html">Update Share</a></li>
<li><a href="shareCancel_en.html">Cancel Share</a></li>
<li><a href="deviceStatusHttp_en.html">Check Device Status</a></li>
<li class="active"><a href="updateStatusHttp_en.html">Update Device Status</a></li>
</ul>
</li>
</ul>
</li>
<li>
<a href="#">FAQ</a>
<ul>
<li><a href="faqOauth_en.html">Authentication</a></li>
<li><a href="faqCode_en.html">Verification code</a></li>
<li><a href="faqAccount_en.html">Account</a></li>
<li><a href="faqDevice_en.html">Device</a></li>
</ul>
</li>
<li>
<a href="contactUs_en.html">Contact Us</a>
<ul>
</ul>
</li>
<!-- if you aren't using the accordion, uncomment this block:
<p class="external">
<a href="#" id="collapseAll">Collapse All</a> | <a href="#" id="expandAll">Expand All</a>
</p>
-->
</ul>
<!-- this highlights the active parent class in the navgoco sidebar. this is critical so that the parent expands when you're viewing a page. This must appear below the sidebar code above. Otherwise, if placed inside customscripts.js, the script runs before the sidebar code runs and the class never gets inserted.-->
<script>$("li.active").parents('li').toggleClass("active");</script>
</div>
<!-- Content Column -->
<div class="col-md-9" id="tg-sb-content">
<div class="post-header">
<h1 class="post-title-main">Update Device Status</h1>
</div>
<div class="post-content">
<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
<script>
$( document ).ready(function() {
// Handler for .ready() called.
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
/* this offset helps account for the space taken up by the floating toolbar. */
$('#toc').on('click', 'a', function() {
var target = $(this.getAttribute('href'))
, scroll_target = target.offset().top
$(window).scrollTop(scroll_target - 10);
return false
})
});
</script>
<div id="toc"></div>
<p>Update device status such as turning on/off device, setting up timers, etc.</p>
<ul>
<li>Production environment URL: <code class="highlighter-rouge">https://cn(区域)-api.coolkit.cn:8080/api/user/device/status</code></li>
<li>Test environment URL: <code class="highlighter-rouge">https://testapi.coolkit.cn:8080/api/user/device/status</code></li>
<li>Request method: POST</li>
<li>Request parameters:</li>
</ul>
<table>
<thead>
<tr>
<th style="text-align: left">Parameter</th>
<th style="text-align: left">Required</th>
<th style="text-align: left">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">deviceid</td>
<td style="text-align: left">Yes</td>
<td style="text-align: left">String</td>
<td>device id</td>
</tr>
<tr>
<td style="text-align: left">params</td>
<td style="text-align: left">Yes</td>
<td style="text-align: left">JSON</td>
<td> </td>
</tr>
</tbody>
</table>
<p>params example:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Example of single channel switch:
"params":{
"switch":"on"
}
Example of multi-channel switch:
"params":{
"switches":[
{
"switch":"off",
"outlet":0
},
{
"switch":"off",
"outlet":1
},
{
"switch":"off",
"outlet":2
},
{
"switch":"off",
"outlet":3
}
]
}
</code></pre></div></div>
<p>Timer examples:
Generally speaking, multiple timers can be added to a device. Everytime timer is added, modified, or deleted, complete timer array needs to be resubmitted. For example,we have two timers now,when we add another, the timer array submitted will include the info of both the new timer and the previous two.</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Single timer, which activates once only.
"params":{
"timers":[
{
"enabled":1, //1 means it is enabled
"mId":"c102f00f-db6f-fef0-f296-9dd10fdc2193", //random,for app to locate it
"type":"once", //for app only, once means single timer, repeat means repeating timer
"at":"2017-07-24T08:28:00.000Z", //activation time,based on GMT+0
"do":{ //the operation to trigger
"switch":"on" //this example shows the operation of single-channel switch.Refer to multi-channel example above for multi-channel device.
},
"coolkit_timer_type":"once" //for app only
}
]
}
Repeating timer:
"params":{
"timers":[
{
"enabled":1,
"mId":"847b296e-9043-ac94-ca37-aa5f91d22338",
"type":"repeat", // a repeating timer
"at":"36 8 * * 1,3",//refer to cron for time format
"do":{
"switch":"on"
},
"coolkit_timer_type":"repeat" //activates repeatedly
}
]
}
Loop timer:
"params":{
"timers":[
{
"enabled":1,
"mId":"847b296e-9043-ac94-ca37-aa5f91d22338",
"type":"duration",
"at":"2018-11-21T10:24:00.980Z 10 5",//start time, loop cycle, 10 mins,reactivates after, 5 mins
"startDo":{
"switch":"on" //start action
},
"endDo":{
"switch":"off" //end action
},
"coolkit_timer_type":"duration" //activates repeatedly
}
]
}
Countdown timer(Activates after specified time, which fires once only.A qucik way to add timer):
"params":{
"timers":[
{
"enabled":1,
"mId":"95303c64-fbb4-f497-1341-c592432d1d0d",
"type":"once",
"at":"2017-07-24T09:10:43.223Z",
"do":{
"switch":"on"
},
"period":"30",
"coolkit_timer_type":"delay" //countdown timer
}
]
}
</code></pre></div></div>
<ul>
<li>Return parameters</li>
</ul>
<table>
<thead>
<tr>
<th style="text-align: left">Parameter</th>
<th style="text-align: left">Required</th>
<th style="text-align: left">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">error</td>
<td style="text-align: left">Yes</td>
<td style="text-align: left">Int</td>
<td>error code</td>
</tr>
<tr>
<td style="text-align: left">deviceid</td>
<td style="text-align: left">Yes</td>
<td style="text-align: left">String</td>
<td>device id</td>
</tr>
</tbody>
</table>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>error code
0:success
400:wrong parameter
401:authorization failed
403:no permission
500:server error
503:Device offline
</code></pre></div></div>
</div>
<hr class="shaded"/>
<footer>
<div class="row">
<div class="col-lg-12 footer">
©2019 Coolkit Technology Co.,Ltd. All rights reserved. <br />
<span>Page last updated:</span> 2019-03-20<br/>
<p><img src="images/coolkit.png" alt="CoolKit"/></p>
</div>
</div>
</footer>
</div>
<!-- /.row -->
</div>
<!-- /.container -->
</div>
<!-- /#main -->
</div>
</body>
</html>