-
Notifications
You must be signed in to change notification settings - Fork 21
/
tabletUI.json
1523 lines (1523 loc) · 280 KB
/
tabletUI.json
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
[
{
"id": "96647521.427728",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/MyFamily",
"method": "get",
"swaggerDoc": "",
"x": 126,
"y": 1242,
"wires": [
[
"2d6e12bf.0cfbfe"
]
]
},
{
"id": "c941b9d7.68c588",
"type": "function",
"z": "1b96200.289cfe",
"name": "GenLocationMap",
"func": "//if(msg.req.headers.authorization && msg.req.headers.authorization==\"Bearer \"+context.global.FREEBOARD_TOKEN){\n//if ((msg.req.body.uid==context.global.WinkUser.uid && msg.req.body.pwd==context.global.WinkUser.pwd) ||context.global.getCookie('exchange_token',msg.req.headers.cookie)==context.global.FREEBOARD_TOKEN || msg.payload.token==context.global.FREEBOARD_TOKEN){\nif ('bfp' in msg.payload && context.global.getCookieVerified('exchange_token',msg.req.headers.cookie, msg.payload.bfp)==context.global.FREEBOARD_TOKEN){\n//if (true){\nmsg.statusCode=\"200\";\nmsg.payload.pwd_str=context.global.FREEBOARD_TOKEN;\nmsg.payload.ifttt_token=context.global.FREEBOARD_TOKEN;\nmsg.payload.home_location={lat:context.global.HomeLocation.lat,lng:context.global.HomeLocation.lon};\nmsg.payload.home_radius=context.global.OwnTracksGeoRadius || 50;\ngeo_locations=[];\nfor (var geo in context.global.winkState.sensor_pods){\n //node.warn(geo);\n if(geo.indexOf('Geo')!=-1){\n var geo_s=context.global.winkState.sensor_pods[geo];\n if ('device_manufacturer' in geo_s && geo_s.device_manufacturer=='OwnTracks') { \n geo_locations.push({\n name:geo_s.name.split('_')[0],\n id:geo_s.object_id,\n lat:geo_s.lat,\n lng:geo_s.lon,\n lastWaypoint:geo_s.lastWaypoint,\n lastEvent:geo_s.lastEvent,\n trigger:geo_s.trigger,\n distanceFromHome:geo_s.distanceFromHome \n });\n }\n }\n}\nmsg.payload.geo_locations=geo_locations;\nmsg.res.statusCode=\"200\";\nif (msg.topic=='json'){\n var Etag=\"\";\n if ('CRYPTO' in context.global) Etag=context.global.CRYPTO.createHash(\"md5\").update(JSON.stringify(msg.payload),\"utf8\").digest(\"hex\");\n msg.headers={\n 'Content-Type': 'application/json',\n 'ETag': Etag\n };\n}\n} else {\nmsg.statusCode=\"403\";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 522,
"y": 1263,
"wires": [
[
"f2938704.61b8d8"
]
]
},
{
"id": "571fa4c8.e9e49c",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 992,
"y": 1262,
"wires": []
},
{
"id": "77a332cd.423f1c",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n\t<meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <meta name=\"viewport\" content = \"width = device-width, initial-scale = 1.0, user-scalable = yes\" />\n <title>Cameras control</title>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" />\n <style>\n ::-webkit-scrollbar {\n width: 12px;\n }\n \n ::-webkit-scrollbar-track {\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); \n border-radius: 10px;\n }\n \n ::-webkit-scrollbar-thumb {\n border-radius: 10px;\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); \n }\n\n html, body {\n height: 100%;\n margin: 0;\n padding: 0;\n }\n #map {\n height: 100%;\n }\n </style>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.4.1/fingerprint2.min.js\"></script> \n <script src=\"https://maps.googleapis.com/maps/api/js?key=AIzaSyBscuO_7CupdIdn3xIT7fnCh7clEvgeiqE\"></script>\n <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n <script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\" async></script>\n <script type=\"text/javascript\" src=\"js/jquery.noty.packaged.min.js\" async></script>\n <script type=\"text/javascript\" src=\"js/eModalBl.min.js\" async></script> \n <script>\n function initialize() {\n var home = {lat:{{payload.home_location.lat}},lng:{{payload.home_location.lng}} }\n //{ lat: 12.97, lng: 77.59 };\n var map = new google.maps.Map(document.getElementById('map'), {\n zoom: 14,\n center: home\n });\n // Add a marker at the center of the map.\n addMarker(home, map,'Home');\n var homeCircle = new google.maps.Circle({\n strokeColor: '#99e6ff',\n strokeOpacity: 0.8,\n strokeWeight: 2,\n fillColor: ' #99e6ff',\n fillOpacity: 0.25,\n map: map,\n center: home,\n radius: {{payload.home_radius}}\n });\n Regions.homeCircle=homeCircle;\n {{#payload.geo_locations}}\n addMarker({lat:{{lat}},lng:{{lng}}},map,'{{name}}');\n {{/payload.geo_locations}} \n };\n\n // Adds a marker to the map.\n function addMarker(location, map,label) {\n // Add the marker at the clicked location, and add the next-available label\n // from the array of alphabetical characters.\n marker = new google.maps.Marker({\n position: location,\n label: label,\n map: map\n });\n Markers[label]={\"marker\":marker};\n };\nfunction moveMarker(marker,lat,lng ) {\n marker.setPosition(new google.maps.LatLng(lat, lng));\n}\nfunction executeQuery() {\n $.ajax({\n url: 'myfamilyjson?bfp='+$myFngrp,\n method: 'GET',\n ifModified:true,\n// dataType: 'JSON',\n headers: {\n// 'Authorization':'Bearer {{payload.pwd_str}}',\n 'Content-Type':'application/json',\n 'If-None-Match':$eTag\n },\n success: function(data,status, xhr) {\n if (xhr.status===200){\n if (Regions.homeCircle) Regions.homeCircle.setRadius(data.home_radius);\n var geo_markers=data.geo_locations;// JSON.parse(data);\n $eTag=xhr.getResponseHeader('Etag');\n for(var i=0;i<geo_markers.length;i++){\n var g=geo_markers[i];\n moveMarker(Markers[g.name].marker,g.lat,g.lng);\n }\n }\n } \n });\n};\n $(document).ready(function() {\n Markers={};\n Regions={};\n $eTag=\"sasd12312sdfsdf=\"; \n google.maps.event.addDomListener(window, 'load', initialize);\n $myFngrp='';\n var fp=new Fingerprint2();\n fp.get(function(result){\n $myFngrp=btoa(result);\n executeQuery(); \n }); \n setInterval(executeQuery, 12000); \n });\n </script>\n </head>\n<body>\n<div id=\"map\"></div>\n</body>\n</html>\n<!-- data-angleOffset=-125 data-angleArc=250 -->",
"x": 847,
"y": 1232,
"wires": [
[
"571fa4c8.e9e49c"
]
]
},
{
"id": "751e1d2a.e6dc94",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/MyFamilyjson",
"method": "get",
"swaggerDoc": "",
"x": 128,
"y": 1308,
"wires": [
[
"9e721e6c.f33c"
]
]
},
{
"id": "2d6e12bf.0cfbfe",
"type": "function",
"z": "1b96200.289cfe",
"name": "",
"func": "msg.topic='page';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 327,
"y": 1243,
"wires": [
[
"c941b9d7.68c588"
]
]
},
{
"id": "9e721e6c.f33c",
"type": "function",
"z": "1b96200.289cfe",
"name": "",
"func": "msg.topic='json';\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 318,
"y": 1307,
"wires": [
[
"c941b9d7.68c588"
]
]
},
{
"id": "f2938704.61b8d8",
"type": "switch",
"z": "1b96200.289cfe",
"name": "",
"property": "topic",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "page",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"outputs": 2,
"x": 695,
"y": 1266,
"wires": [
[
"77a332cd.423f1c"
],
[
"d7cb8331.afe14"
]
]
},
{
"id": "d7cb8331.afe14",
"type": "json",
"z": "1b96200.289cfe",
"name": "",
"x": 853,
"y": 1286,
"wires": [
[
"571fa4c8.e9e49c"
]
]
},
{
"id": "5eaec333.395d8c",
"type": "function",
"z": "1b96200.289cfe",
"name": "",
"func": "function genJwtToken(reqBody) {\n var md5Str = new Buffer(reqBody.pwd,'base64').toString();\n var dgst_str=context.global.WinkUser.uid+':'+context.global.WinkUser.pwd;\n var md5dgst=context.global.CRYPTO.createHash(\"md5\").update(dgst_str,\"utf8\").digest('hex');\n var clientId = new Buffer(reqBody.uuid,'base64').toString();\n node.warn(clientId);\n if (reqBody.uid==context.global.WinkUser.uid && md5Str==md5dgst) {\n var token = context.global.wnr.jwt.sign({'cliendId':clientId},context.global.FREEBOARD_TOKEN);\n node.warn(token);\n flow.set('token',token);\n return true;\n } else return false;\n}\n//if ((msg.req.body.uid==context.global.WinkUser.uid && md5Str==md5dgst) || msg.payload.token==context.global.FREEBOARD_TOKEN){\nvar cred=context.global.genJwtToken(msg.req.body);\nif (cred.isSet){\nmsg.statusCode=\"200\";\n//msg.res.cookie('exchange_token',context.global.FREEBOARD_TOKEN);\n//msg.headers={\n// \"Set-Cookie\":\"exchange_token=\"+context.global.FREEBOARD_TOKEN+'; Path=/'\n//}\nmsg.headers={\n \"Set-Cookie\":\"exchange_token=\"+cred.token+'; Path=/'\n}\n//msg.res.winktoken=context.global.FREEBOARD_TOKEN;\nmsg.payload.pwd_str=context.global.FREEBOARD_TOKEN;\nmsg.payload.ui_shortcuts=[]\nif ('cameras' in context.global.winkState) msg.payload.cameras=true; else msg.payload.cameras=false;\nif ('robots' in context.global.winkState) msg.payload.robots=true; else msg.payload.robots=false;\n msg.payload.geo=false;\nif ('sensor_pods' in context.global.winkState) {\n for (var v in context.global.winkState.sensor_pods){\n if (v.indexOf('Geo') !=-1) { \n msg.payload.geo=true;\n break;\n }\n }\n}\nif ('CustomTabUrl' in context.global && context.global.CustomTabUrl!=='') {\n msg.payload.custom_tab=true; \n msg.payload.CustomTabUrl=context.global.CustomTabUrl;\n msg.payload.CustomTabName=context.global.CustomTabName || 'My Tab';\n}\n else msg.payload.custom_tab=false;\n msg.payload.ui_shortcuts=[];\n var k=0;\n if(!Array.isArray(context.global.tab_ui_shortcuts)) { \n msg.payload.ui_shortcuts[0]={ name:context.global.tab_ui_shortcuts,shortcut:context.global.tab_ui_shortcuts};\n k=1;\n }\nfor (var i=k;i<6;i++){\n msg.payload.ui_shortcuts[i]={}\n if ('tab_ui_shortcuts' in context.global && Array.isArray(context.global.tab_ui_shortcuts) && context.global.tab_ui_shortcuts[i]){\n msg.payload.ui_shortcuts[i].name=context.global.tab_ui_shortcuts[i];\n msg.payload.ui_shortcuts[i].shortuct=context.global.tab_ui_shortcuts[i];\n } else {\n msg.payload.ui_shortcuts[i].name='Shortcut '+(i+1);\n msg.payload.ui_shortcuts[i].shortuct='#';\n }\n }\nmsg.payload.ifttt_token=(context.global.IFTTT_TOKEN!=='undefined' ? context.global.IFTTT_TOKEN : context.global.FREEBOARD_TOKEN) ;\n//if ('camera_name' in msg.payload && msg.payload.camera_name!=='undefined') msg.payload.camera_name=msg.req.body.camera_name\n} else {\nmsg.res.statusCode=\"403\";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 354,
"y": 68,
"wires": [
[
"5dfe4b32.a4d4d4"
]
]
},
{
"id": "445af09b.2e1ea",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/ui",
"method": "post",
"swaggerDoc": "",
"x": 126,
"y": 68.99996948242188,
"wires": [
[
"5eaec333.395d8c"
]
]
},
{
"id": "ae4bfb78.6344f8",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<!--<html lang=\"en\" manifest=\"manifest.cache\"> -->\n<html>\n<head>\n <meta charset=\"utf-8\">\n\t<meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <meta name=\"viewport\" content = \"width = device-width, height = device-height, initial-scale = 1.0, user-scalable = no\" />\n <title>Home Dashboard</title>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" />\n \n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/animate.css\" />\n \n \n \n <link rel=\"shortcut icon\" href=\"assets/img/main_ico_02.png\">\n <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n <script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\" async></script>\n <script type=\"text/javascript\" src=\"js/jquery.noty.packaged.min.js\" async></script>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.4.1/fingerprint2.min.js\"></script> \n <!-- you need to include the shieldui css and js assets in order for the charts to work -->\n <!--<script type=\"text/javascript\" src=\"https://www.prepbootstrap.com/Content/js/gridData.js\" async></script> -->\n <style>\n .spinner {\n display: inline-block;\n opacity: 0;\n width: 0;\n\n -webkit-transition: opacity 0.25s, width 0.25s;\n -moz-transition: opacity 0.25s, width 0.25s;\n -o-transition: opacity 0.25s, width 0.25s;\n transition: opacity 0.25s, width 0.25s;\n}\n\n.has-spinner.active {\n cursor:progress;\n}\n\n.has-spinner.active .spinner {\n opacity: 1;\n width: auto; /* This doesn't work, just fix for unkown width elements */\n}\n\n.has-spinner.btn-mini.active .spinner {\n width: 10px;\n}\n\n.has-spinner.btn-small.active .spinner {\n width: 13px;\n}\n\n.has-spinner.btn.active .spinner {\n width: 16px;\n}\n\n.has-spinner.btn-large.active .spinner {\n width: 19px;\n}\n.mainbody {\n background-color: rgb(0, 0, 0);\n}\n</style>\n</head>\n<body>\n <div class=\"col-xs-12 col-md-12 mainbody\" id=\"mainbody\">\n <header>\n <ul id=\"tabs\" class=\"nav nav-tabs lg-nav-justified md-nav-justified\">\n <li class=\"active\">\n <a data-toggle=\"tab\" href=\"#Dashboard0\">Summary</a>\n </li> \n <li class=\"\">\n <a data-toggle=\"tab\" href=\"#Dashboard1\">Details</a>\n </li>\n {{#payload.cameras}}\n <li class=\"hidden-xs\">\n <a data-toggle=\"tab\" href=\"#Dashboard2\">Cameras</a>\n </li>\n {{/payload.cameras}}\n <li class=\"\">\n <a data-toggle=\"tab\" href=\"#Dashboard3\">Controls</a>\n </li>\n {{#payload.robots}}\n <li class=\"hidden-xs\">\n <a data-toggle=\"tab\" href=\"#RobotsDashboard\">Robots</a>\n </li>\n {{/payload.robots}} \n {{#payload.custom_tab}}\n <li class=\"hidden-xs\">\n <a data-toggle=\"tab\" href=\"#CustomDashboard\">{{payload.CustomTabName}}</a>\n </li>\n {{/payload.custom_tab}}\n \n {{#payload.geo}}\n <li class=\"\">\n <a data-toggle=\"tab\" href=\"#Family\">My Family</a>\n </li>\n {{/payload.geo}} \n \n <li class=\"hidden-xs hidden-sm hidden-md\">\n <a data-toggle=\"tab\" href=\"#Config\">Configuration</a>\n </li>\n </ul>\n </header>\n <div class=\"body tab-content\">\n <div class=\"tab-pane fade active in\" id=\"Dashboard0\">\n<!-- <iframe frameBorder=\"0\" seamless=\"seamless\" allowtransparency=\"true\" id=\"Iframe0\" src=\"TopRow\" width=\"100%\"></iframe> -->\n <iframe frameBorder=\"0\" seamless=\"seamless\" allowtransparency=\"true\" id=\"Iframe0\" src=\"\" width=\"100%\"></iframe> \n {{#payload.ui_shortcuts}}\n <div class=\"col-sm-2 col-md-2 hidden-xs\"> \n <button id=\"{{name}}\" type=\"button\" class=\"btn btn-primary btn-block has-spinner\" style=\"margin-bottom:4px;white-space:normal;\">\n <div style=\"overflow: hidden;text-overflow: ellipsis;display: inline;\">\n <span class=\"spinner\"><i class=\"fa fa-spinner fa-spin\"></i></span>\n {{name}}</div>\n </button>\n </div>\n {{/payload.ui_shortcuts}}\n </div>\n <div class=\"tab-pane fade in\" id=\"Dashboard1\">\n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"freeboard1\" src=\"\" width=\"100%\" seamless=\"seamless\"></iframe>\n </div>\n {{#payload.cameras}}\n <div class=\"tab-pane fade in\" id=\"Dashboard2\">\n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"freeboard2\" src=\"\" width=\"100%\" seamless=\"seamless\"></iframe>\n </div>\n {{/payload.cameras}}\n <div class=\"tab-pane fade in\" id=\"Dashboard3\">\n <!--<div class=\"col-xs-12\" style=\"height:4px;\"></div> -->\n <div class=\"container-fluid\">\n <div class=\"panel-group\" id=\"accordion\" role=\"tablist\" aria-multiselectable=\"true\">\n <div class=\"panel panel-primary\">\n <div class=\"panel-heading\" role=\"tab\" id=\"headingOne\">\n <h5 class=\"panel-title\">\n <a role=\"button\" data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#collapseOne\" aria-expanded=\"true\" aria-controls=\"collapseOne\">\n <span class=\"fa fa-lightbulb-o\" aria-hidden=\"true\"></span>\n Lights and Switches\n </a>\n </h5>\n </div>\n <div id=\"collapseOne\" class=\"panel-collapse collapse in\" role=\"tabpanel\" aria-labelledby=\"headingOne\">\n <div class=\"panel-body\" clearfix style=\"border : 1px;\"> \n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"freeboard3\" src=\"\" width=\"100%\" seamless=\"seamless\" style=\" border : 0; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover\"></iframe>\n </div>\n </div> \n </div>\n <div class=\"panel panel-primary\" clearfix style=\"background:none;\">\n <div class=\"panel-heading\" role=\"tab\" id=\"headingTwo\">\n <h5 class=\"panel-title\">\n <a class=\"collapsed\" role=\"button\" data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#collapseTwo\" aria-expanded=\"false\" aria-controls=\"collapseTwo\">\n <!-- <p class=\"text-nowrap\"> -->\n <span class=\"fa fa-lock\" aria-hidden=\"true\"></span> \n Locks and Garage Doors\n <!-- </p> -->\n </a>\n </h5>\n </div>\n <div id=\"collapseTwo\" class=\"panel-collapse collapse\" role=\"tabpanel\" aria-labelledby=\"headingTwo\">\n <div class=\"panel-body\">\n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"freeboard3L\" src=\"\" width=\"100%\" seamless=\"seamless\" style=\" border : 0; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover\"></iframe>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n {{#payload.robots}}\n <div class=\"tab-pane fade in\" id=\"RobotsDashboard\">\n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"robots_tab\" src=\"\" width=\"100%\" seamless=\"seamless\"></iframe>\n </div>\n {{/payload.robots}} \n {{#payload.custom_tab}}\n <div class=\"tab-pane fade in\" id=\"CustomDashboard\">\n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"custom_tab\" src=\"{{payload.CustomTabUrl}}\" width=\"100%\" seamless=\"seamless\"></iframe>\n </div>\n {{/payload.custom_tab}} \n {{#payload.geo}}\n <div class=\"tab-pane fade in\" id=\"Family\">\n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"family\" src=\"\" width=\"100%\" seamless=\"seamless\"></iframe>\n </div>\n {{/payload.geo}} \n <div class=\"tab-pane fade in hidden-xs hidden-s hidden-md\" id=\"Config\" >\n <iframe frameBorder=\"0\" allowtransparency=\"true\" id=\"Controls\" src=\"\" width=\"100%\" seamless=\"seamless\"></iframe>\n </div>\n </div>\n </div>\n <!-- /#wrapper -->\n\n <script type=\"text/javascript\">\n function getCookie(cname) {\n var name = cname + \"=\";\n var ca = document.cookie.split(';');\n for(var i=0; i<ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0)==' ') c = c.substring(1);\n if (c.indexOf(name) == 0) return c.substring(name.length,c.length);\n }\n return \"\";\n}\n\n jQuery(function ($) {\n $myFngrp=\"\";\n var fp=new Fingerprint2();\n fp.get(function(result){\n $myFngrp=btoa(result);\n $( \"#Iframe0\" ).attr(\"src\",\"mySummary?bfp=\"+$myFngrp);\n $( \"#freeboard1\" ).attr(\"src\",\"winkautogroup?bfp=\"+$myFngrp);\n $( \"#freeboard2\" ).attr(\"src\",\"mycameras?bfp=\"+$myFngrp);\n $( \"#freeboard3\" ).attr(\"src\",\"lightcontrols?bfp=\"+$myFngrp);\n $( \"#freeboard3L\" ).attr(\"src\",\"lockcontrols?bfp=\"+$myFngrp);\n $( \"#robots_tab\" ).attr(\"src\",\"RobotControls?bfp=\"+$myFngrp);\n $( \"#family\" ).attr(\"src\",\"MyFamily?bfp=\"+$myFngrp);\n $( \"#Controls\" ).attr(\"src\",\"getconfig?bfp=\"+$myFngrp); \n }); \n $Curr_Tab=$(\"ul#tabs li.active\")[0].lastElementChild.hash;\n $('.panel-collapse').css('background','black');\n $(\"#Iframe0\").css('height', $( window ).height()-100);\n $(\"#freeboard1\").css('height', $( window ).height()-75);\n {{#payload.cameras}}\n $(\"#freeboard2\").css('height', $( window ).height()-75);\n {{/payload.cameras}}\n {{#payload.robots}}\n $(\"#robots_tab\").css('height', $( window ).height()-75);\n {{/payload.robots}} \n {{#payload.custom_tab}}\n $(\"#custom_tab\").css('height', $( window ).height()-75);\n {{/payload.custom_tab}} \n {{#payload.geo}}\n $(\"#family\").css('height', $( window ).height()-75);\n {{/payload.geo}} \n $(\"#freeboard3\").css('height', $( window ).height()-215);\n $(\"#freeboard3L\").css('height', $( window ).height()-235);\n $( \"#Controls\" ).css('height', $( window ).height()-75);\n $( \"#Controls\" ).css('width', \"100%\");\n $(\"#mainbody\").css('background',\"#111\");\n }); \n $( window ).resize(function () {\n //console.log('window got resized '+$( window ).height());\n //console.log('freeboard height '+$( \"#freeboard2\" ).height());\n $(\"#Iframe0\").css('height', $( window ).height()-100);\n $(\"#Iframe0\").css('width',\"100%\");\n $( \"#freeboard1\" ).css('height', $( window ).height()-75);\n $( \"#freeboard1\" ).css('width', \"100%\");\n {{#payload.cameras}}\n $( \"#freeboard2\" ).css('height', $( window ).height()-75);\n $( \"#freeboard2\" ).css('width', \"100%\");\n {{/payload.cameras}}\n {{#payload.robots}}\n $(\"#robots_tab\").css('height', $( window ).height()-75);\n $( \"#robots_tab\" ).css('width', \"100%\"); \n {{/payload.robots}} \n {{#payload.custom_tab}}\n $(\"#custom_tab\").css('height', $( window ).height()-75);\n $( \"#custom_tab\" ).css('width', \"100%\"); \n {{/payload.custom_tab}} \n {{#payload.geo}}\n $(\"#family\").css('height', $( window ).height()-75);\n $( \"#family\" ).css('width', \"100%\"); \n {{/payload.geo}} \n $( \"#freeboard3\" ).css('height', $( window ).height()-215);\n $(\"#freeboard3L\").css('height', $( window ).height()-235);\n $( \"#freeboard3\" ).css('width', \"100%\");\n $( \"#freeboard3L\" ).css('width', \"100%\");\n $( \"#Controls\" ).css('height', $( window ).height()-75);\n $( \"#Controls\" ).css('width', \"100%\"); \n });\n $(\".btn-block\").click(function(){\n var me=$(this);\n $(this).toggleClass('active').removeClass('btn-primary').addClass('btn-warning');\n $.post( \"/red/ifttt\", {\"winkName\":this.id,\"type\":\"shortcut\",\"cmd\":\"\",\"level\":\"\" , \"iftttkey\" : getCookie('exchange_token')}).done(function(data) {\n setTimeout(function(){ me.toggleClass('active').removeClass('btn-warning').addClass('btn-primary'); }, 3000);\n });\n });\n $(document).on('shown.bs.tab', 'a[data-toggle=\"tab\"]', function (e) {\n $Curr_Tab=e.target.hash;\n });\n </script>\n</body>\n</html>\n",
"x": 829,
"y": 61,
"wires": [
[
"583621e5.3ee27"
]
]
},
{
"id": "583621e5.3ee27",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 971,
"y": 91,
"wires": []
},
{
"id": "d9d7c628.379b58",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "html",
"syntax": "mustache",
"template": "\n<!DOCTYPE html>\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <title>Home Dashboard</title>\n <!--<link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" /> -->\n <!-- <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" /> -->\n <!-- <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" /> -->\n <!-- Material Design fonts -->\n <!-- Bootstrap -->\n <link href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" rel=\"stylesheet\"> \n <link rel=\"stylesheet\" href=\"//fonts.googleapis.com/css?family=Roboto:300,400,500,700\" type=\"text/css\">\n <link href=\"//fonts.googleapis.com/icon?family=Material+Icons\" rel=\"stylesheet\">\n\n \n <link href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css\" rel=\"stylesheet\"> \n <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.5.9/css/bootstrap-material-design.min.css\" />\n <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.5.9/css/ripples.min.css\" /> \n \n <link rel=\"shortcut icon\" href=\"assets/img/main_ico_02.png\">\n <style>\n .container {\n background-color: rgb(12, 12, 12);\n height: 100vh;\n width: 100vw;\n }\n\n.panel-primary {\n /* background-color: rgb(12, 12, 12); */\n\n }\n\n.panel.panel-primary>.panel-heading {\n background-color: #2A9FD6;\n} \n </style>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.4.1/fingerprint2.min.js\"></script>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/core-min.js\"></script> \n <script src=\"//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/md5-min.js\"></script> \n</head>\n<body>\n<div class=\"container\">\n<form id=\"Form1\" role=\"form\" class=\"form-signin\" action=\"/freeboard/ui\" method=\"POST\"> \n <br>\n <br>\n <br>\n <br>\n <div class=\"col-md-9 col-md-offset-1\">\n <div class=\"panel panel-primary\">\n <div class=\"panel-heading\">\n <h3>Please login using Wink app credentials</h3>\n </div> \n <div class=\"panel-body\">\n <div class=\"col-md-9 col-lg-9 col-sm-12 col-xs-12\">\n <div class=\"input-group input-primary\">\n <span class=\"input-group-addon input-primary\"><i class=\"material-icons\">account_circle</i></span>\n <input type=\"email\" name=\"uid\" class=\"form-control input-lg\" id=\"emailaddress\" placeholder=\"Enter email address\">\n </div>\n </div>\n <div class=\"col-md-9 col-lg-9 col-sm-12 col-xs-12\">\n <br>\n <div class=\"input-group\">\n <span class=\"input-group-addon input-primary\"><i class=\"material-icons\">lock</i></span>\n <input type=\"password\" name=\"pwd\" class=\"form-control input-lg\" id=\"password\" placeholder=\"Enter Password\">\n </div>\n </div>\n <div class=\"col-md-4 col-lg-4 col-sm-4 col-xs-4\">\n\n <div class=\"form-group\">\n <input type=\"hidden\" id=\"fingerprint\" name=\"uuid\">\n <input type=\"hidden\" id=\"uidhash\" name=\"uidhash\"> \n <button type=\"submit\" id=\"sbm\" class=\"btn btn-info btn-raised btn-lg\">\n Login\n </button>\n </div>\n </div>\n </div> \n </div>\n </div> \n</form> \n</div>\n <!-- /#wrapper -->\n <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n <script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\" async></script>\n <!--<script type=\"text/javascript\" src=\"https://www.prepbootstrap.com/Content/js/gridData.js\" async></script> -->\n<script>\n function genHash(uid,pwd)\n {\n return btoa(CryptoJS.MD5(uid+':'+pwd).toString()); \n }\n $(document).ready(function() { \n $('#sbm').prop(\"disabled\",true); \n $myFngrp=\"\";\n var fp=new Fingerprint2();\n fp.get(function(result){\n $myFngrp=result;\n $('#sbm').prop(\"disabled\",false); \n }); \n });\n $('#Form1').submit(function(){\n var uid=$('#emailaddress').val();\n var pwd=$('#password').val();\n $('#password').val(genHash(uid,pwd));\n $('#fingerprint').val(btoa($myFngrp));\n $('#uidhash').val(btoa(CryptoJS.MD5(uid)).toString());\n $('#emailaddress').val('********************');\n return true;\n });\n</script>\n</body>\n</html>\n\n",
"x": 348,
"y": 124,
"wires": [
[
"667e99ca.201988"
]
]
},
{
"id": "667e99ca.201988",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 501,
"y": 124,
"wires": []
},
{
"id": "2168a531.d4bb4a",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/UI",
"method": "get",
"swaggerDoc": "",
"x": 129,
"y": 121,
"wires": [
[
"d9d7c628.379b58"
]
]
},
{
"id": "5dfe4b32.a4d4d4",
"type": "switch",
"z": "1b96200.289cfe",
"name": "",
"property": "statusCode",
"rules": [
{
"t": "eq",
"v": "200"
},
{
"t": "eq",
"v": "403"
}
],
"checkall": "true",
"outputs": 2,
"x": 483,
"y": 65,
"wires": [
[
"9be093be.1abf"
],
[
"96acaed0.29e0b"
]
]
},
{
"id": "96acaed0.29e0b",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<!--<html lang=\"en\" manifest=\"manifest.cache\"> -->\n<html>\n<head>\n <META http-equiv=\"refresh\" content=\"3;URL=/freeboard/ui\">\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Home Dashboard</title>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" />\n\n <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n <script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\"></script>\n\n <!-- you need to include the shieldui css and js assets in order for the charts to work -->\n\n <!--<script type=\"text/javascript\" src=\"https://www.prepbootstrap.com/Content/js/gridData.js\" async></script> -->\n<body>\n<div class=\"center-block\">\n <div class=\"col-lg-8\">\n <div class=\"alert alert-dismissable alert-info\">\n <div class=\"panel-heading\">\n <h3>Incorrect User Id or Password...</h3>\n </div> \n </div>\n </div>\n</div>\n</body>\n</html>",
"x": 825,
"y": 114,
"wires": [
[
"583621e5.3ee27"
]
]
},
{
"id": "9be093be.1abf",
"type": "function",
"z": "1b96200.289cfe",
"name": "",
"func": "msg.payload.freeboard_token=context.global.FREEBOARD_TOKEN\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 679,
"y": 60,
"wires": [
[
"ae4bfb78.6344f8"
]
]
},
{
"id": "3853b171.5fa93e",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/red/getGroupsJson",
"method": "get",
"swaggerDoc": "",
"x": 141.5,
"y": 361.5,
"wires": [
[
"26e80456.6ecabc"
]
]
},
{
"id": "544f236b.e0185c",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 849.5,
"y": 360.5,
"wires": []
},
{
"id": "543b356e.13150c",
"type": "json",
"z": "1b96200.289cfe",
"name": "",
"x": 684.5,
"y": 361.5,
"wires": [
[
"544f236b.e0185c"
]
]
},
{
"id": "be43317.e358fd",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/LightControl",
"method": "get",
"swaggerDoc": "",
"x": 148,
"y": 568,
"wires": [
[
"ad541076.5152"
]
]
},
{
"id": "c610d219.c52d5",
"type": "json",
"z": "1b96200.289cfe",
"name": "",
"x": 837,
"y": 565,
"wires": [
[
"bf863d7b.2f0c"
]
]
},
{
"id": "63078668.502268",
"type": "comment",
"z": "1b96200.289cfe",
"name": "Main page---------------------------------------",
"info": "",
"x": 179,
"y": 22,
"wires": []
},
{
"id": "45314459.78328c",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<head>\n <meta charset=\"UTF-8\">\n <title>freeboard</title>\n\t<meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <meta name=\"viewport\" content = \"width = device-width, initial-scale = 1.0, user-scalable = yes\" />\n <link href=\"css/freeboard.min.css\" rel=\"stylesheet\" />\n <script src=\"js/freeboard.thirdparty.min.js\"></script>\n <script type=\"text/javascript\">\n head.js(\"js/freeboard.js\",\"js/freeboard.plugins.min.js\",\"../freeboard_api/datasources\",\n \"lib/js/thirdparty/wink.js\",\n\n // *** Load more plugins here ***\n function(){\n $(function()\n { //DOM Ready\n freeboard.initialize(true);\n\n //var hash = window.location.hash;\n //if (hash !== null) {\n $.get({{context.global.BlueMixUrlBase}}\"/red/getGroupsJson?auth={{payload.pwd_str}}\", function(data) {\n\t\t\t\t\t\t\t\tvar datap=JSON.parse(data);\n\t\t\t\t\t\t\t\tif (!datap.empty){\n\t\t\t\t\t\t\t\t\tfreeboard.loadDashboard(datap, function() {\n\t\t\t\t\t\t\t\t\t\tfreeboard.setEditing(false);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n });\n //}\n\n });\n });\n </script>\n</head>\n<body>\n<div id=\"board-content\">\n <img id=\"dash-logo\" data-bind=\"attr:{src: header_image}, visible:header_image()\">\n <div class=\"gridster responsive-column-width\">\n <ul data-bind=\"grid: true\">\n </ul>\n </div>\n</div>\n<header id=\"main-header\" data-bind=\"if:allow_edit\">\n <div id=\"admin-bar\">\n <div id=\"admin-menu\">\n <div id=\"board-tools\">\n <h1 id=\"board-logo\" class=\"title bordered\">freeboard</h1>\n <div id=\"board-actions\">\n <ul class=\"board-toolbar vertical\">\n <!--<li data-bind=\"click: loadDashboardFromLocalFile\"><i id=\"full-screen-icon\" class=\"icon-folder-open icon-white\"></i><label id=\"full-screen\">Load Freeboard</label></li>-->\n <li data-bind=\"click: saveDashboard\"><i class=\"icon-download-alt icon-white\"></i><label>Save Freeboard</label></li>\n <li id=\"add-pane\" data-bind=\"click: createPane\"><i class=\"icon-plus icon-white\"></i><label>Add Pane</label></li>\n </ul>\n </div>\n </div>\n <div id=\"datasources\">\n <h2 class=\"title\">DATASOURCES</h2>\n\n <div class=\"datasource-list-container\">\n <table class=\"table table-condensed sub-table\" id=\"datasources-list\" data-bind=\"if: datasources().length\">\n <thead>\n <tr>\n <th>Name</th>\n <th>Last Updated</th>\n <th> </th>\n </tr>\n </thead>\n <tbody data-bind=\"foreach: datasources\">\n <tr>\n <td>\n <span class=\"text-button datasource-name\" data-bind=\"text: name, pluginEditor: {operation: 'edit', type: 'datasource'}\"></span>\n </td>\n <td data-bind=\"text: last_updated\"></td>\n <td>\n <ul class=\"board-toolbar\">\n <li data-bind=\"click: updateNow\"><i class=\"icon-refresh icon-white\"></i></li>\n <li data-bind=\"pluginEditor: {operation: 'delete', type: 'datasource'}\">\n <i class=\"icon-trash icon-white\"></i></li>\n </ul>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <span class=\"text-button table-operation\" data-bind=\"pluginEditor: {operation: 'add', type: 'datasource'}\">ADD</span>\n </div>\n </div>\n </div>\n\t<div id=\"column-tools\" class=\"responsive-column-width\">\n\t\t<ul class=\"board-toolbar left-columns\">\n\t\t\t<li class=\"column-tool add\" data-bind=\"click: addGridColumnLeft\"><span class=\"column-icon right\"></span><i class=\"icon-arrow-left icon-white\"></i></li>\n\t\t\t<li class=\"column-tool sub\" data-bind=\"click: subGridColumnLeft\"><span class=\"column-icon left\"></span><i class=\"icon-arrow-right icon-white\"></i></li>\n\t\t</ul>\n\t\t<ul class=\"board-toolbar right-columns\">\n\t\t\t<li class=\"column-tool sub\" data-bind=\"click: subGridColumnRight\"><span class=\"column-icon right\"></span><i class=\"icon-arrow-left icon-white\"></i></li>\n\t\t\t<li class=\"column-tool add\" data-bind=\"click: addGridColumnRight\"><span class=\"column-icon left\"></span><i class=\"icon-arrow-right icon-white\"></i></li>\n\t\t</ul>\n\t</div>\n <div id=\"toggle-header\" data-bind=\"click: toggleEditing\">\n <i id=\"toggle-header-icon\" class=\"icon-wrench icon-white\"></i></div>\n</header>\n\n\n<div style=\"display:hidden\">\n <ul data-bind=\"template: { name: 'pane-template', foreach: panes}\">\n </ul>\n</div>\n\n<script type=\"text/html\" id=\"pane-template\">\n <li data-bind=\"pane: true\">\n <header>\n <h1 data-bind=\"text: title\"></h1>\n <ul class=\"board-toolbar pane-tools\">\n <li data-bind=\"pluginEditor: {operation: 'add', type: 'widget'}\">\n <i class=\"icon-plus icon-white\"></i>\n </li>\n <li data-bind=\"pluginEditor: {operation: 'edit', type: 'pane'}\">\n <i class=\"icon-wrench icon-white\"></i>\n </li>\n <li data-bind=\"pluginEditor: {operation: 'delete', type: 'pane'}\">\n <i class=\"icon-trash icon-white\"></i>\n </li>\n </ul>\n </header>\n <section data-bind=\"foreach: widgets\">\n <div class=\"sub-section\" data-bind=\"css: 'sub-section-height-' + height()\">\n <div class=\"widget\" data-bind=\"widget: true, css:{fillsize:fillSize}\"></div>\n <div class=\"sub-section-tools\">\n <ul class=\"board-toolbar\">\n <!-- ko if:$parent.widgetCanMoveUp($data) -->\n <li data-bind=\"click:$parent.moveWidgetUp\"><i class=\"icon-chevron-up icon-white\"></i></li>\n <!-- /ko -->\n <!-- ko if:$parent.widgetCanMoveDown($data) -->\n <li data-bind=\"click:$parent.moveWidgetDown\"><i class=\"icon-chevron-down icon-white\"></i></li>\n <!-- /ko -->\n <li data-bind=\"pluginEditor: {operation: 'edit', type: 'widget'}\"><i class=\"icon-wrench icon-white\"></i></li>\n <li data-bind=\"pluginEditor: {operation: 'delete', type: 'widget'}\"><i class=\"icon-trash icon-white\"></i></li>\n </ul>\n </div>\n </div>\n </section>\n </li>\n</script>\n\n</body>\n</html>\n",
"x": 721.5,
"y": 408,
"wires": [
[
"5dbf10ff.dd73d"
]
]
},
{
"id": "5dbf10ff.dd73d",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 861.5,
"y": 414,
"wires": []
},
{
"id": "5e7cdaf1.304ed4",
"type": "function",
"z": "1b96200.289cfe",
"name": "",
"func": "//if ((msg.req.body.uid==context.global.WinkUser.uid && msg.req.body.pwd==context.global.WinkUser.pwd)||context.global.getCookie('exchange_token',msg.req.headers.cookie)==context.global.FREEBOARD_TOKEN || msg.payload.token==context.global.FREEBOARD_TOKEN){\nif ('bfp' in msg.payload && context.global.getCookieVerified('exchange_token',msg.req.headers.cookie, msg.payload.bfp)==context.global.FREEBOARD_TOKEN){\nmsg.res.statusCode=\"200\";\nmsg.payload={\"pwd_str\":context.global.FREEBOARD_TOKEN}\n} else {\nmsg.res.statusCode=\"403\";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 405.5,
"y": 424,
"wires": [
[
"3b5811b0.1d817e"
]
]
},
{
"id": "716b9d25.f59354",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/winkautogroup",
"method": "get",
"swaggerDoc": "",
"x": 154,
"y": 424,
"wires": [
[
"5e7cdaf1.304ed4"
]
]
},
{
"id": "3b5811b0.1d817e",
"type": "switch",
"z": "1b96200.289cfe",
"name": "",
"property": "res.statusCode",
"rules": [
{
"t": "eq",
"v": "200"
},
{
"t": "eq",
"v": "403"
}
],
"checkall": "true",
"outputs": 2,
"x": 547.5,
"y": 425,
"wires": [
[
"45314459.78328c"
],
[
"47515ced.292714"
]
]
},
{
"id": "47515ced.292714",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<html>\n <head>\n <title>Invalid login</title>\n <META http-equiv=\"refresh\" content=\"3;URL=/freeboard/winkboardautogroup\">\n </head>\n <body bgcolor=\"#ffffff\">\n <center>Invalid user Id or Password</a>\n </center>\n </body>\n\n</html>",
"x": 723.5,
"y": 447,
"wires": [
[
"5dbf10ff.dd73d"
]
]
},
{
"id": "c6abbf95.05da9",
"type": "comment",
"z": "1b96200.289cfe",
"name": "Summary page---------------------------------------",
"info": "",
"x": 215,
"y": 170,
"wires": []
},
{
"id": "8abd45f8.b675f8",
"type": "comment",
"z": "1b96200.289cfe",
"name": "details page---------------------------------------",
"info": "",
"x": 193,
"y": 310,
"wires": []
},
{
"id": "c99cbffb.b345f",
"type": "comment",
"z": "1b96200.289cfe",
"name": "Controls page---------------------------------------",
"info": "",
"x": 197,
"y": 483,
"wires": []
},
{
"id": "dc9a0cf0.590f2",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/MyCameras",
"method": "get",
"swaggerDoc": "",
"x": 145,
"y": 841,
"wires": [
[
"2d92263e.c4207a"
]
]
},
{
"id": "2d92263e.c4207a",
"type": "function",
"z": "1b96200.289cfe",
"name": "GenCameras",
"func": "if ('bfp' in msg.payload && context.global.getCookieVerified('exchange_token',msg.req.headers.cookie, msg.payload.bfp)==context.global.FREEBOARD_TOKEN){\nmsg.statusCode=\"200\";\nmsg.payload.pwd_str=context.global.FREEBOARD_TOKEN;\nmsg.payload.ifttt_token=context.global.FREEBOARD_TOKEN;\ncameras=[]\nfor (var cam in context.global.winkState.cameras){\n var camera=context.global.winkState.cameras[cam];\n if(camera.device_manufacturer!='canary'){\n cameras.push({\n name:camera.name,\n id:camera.object_id,\n connection:camera.connection,\n url:encodeURI(camera.snap_url),\n history_url:encodeURI(camera.history_url),\n refresh_interval:30\n });\n }\n}\nmsg.payload.cameras=cameras;\nmsg.res.statusCode=\"200\";\n} else {\nmsg.statusCode=\"403\";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 385,
"y": 840,
"wires": [
[
"c4659b28.fa6378"
]
]
},
{
"id": "c4659b28.fa6378",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n\t<meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <meta name=\"viewport\" content = \"width = device-width, initial-scale = 1.0, user-scalable = yes\" />\n <title>Cameras control</title>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" />\n <style>\n ::-webkit-scrollbar {\n width: 12px;\n }\n \n ::-webkit-scrollbar-track {\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); \n border-radius: 10px;\n }\n \n ::-webkit-scrollbar-thumb {\n border-radius: 10px;\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); \n }\n </style>\n\n</head>\n<body>\n\n<div class=\"container\">\n {{#payload.cameras}}\n <div class=\"col-md-6 col-sm-12 col-xs-12\">\n <div class=\"panel panel-primary panel-{{id}}\">\n <!-- Default panel contents -->\n <div class=\"panel-heading {{name}}\" id=\"Header {{name}}\">\n <p class=\"text-nowrap\">\n <button type=\"button\" class=\"btn btn-warning btn-sm\" onclick=\"SnapShot('{{name}}');\"><span class=\"fa fa-camera\" aria-hidden=\"true\"> </span></button>\n {{name}}\n <button type=\"button\" class=\"btn btn-success btn-sm pull-right\" onclick=\"ShowCamHist('cam_history?camera_name={{name}}','{{name}} History');\">{{name}} history</button>\n </p> \n </div>\n <div class=\"panel-body panel-image panel-image-{{id}}\" id=\"{{id}}\" name=\"{{url}}\" style=\"width: 100%; height: 380px; background-image: url({{url}});-webkit-background-size: contain; -moz-background-size: contain; -o-background-size: contain; background-size: contain; background-repeat: no-repeat; background-position: center;\">\n\n </div>\n </div>\n </div>\n {{/payload.cameras}}\n</div>\n\n<script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n<script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\" async></script>\n<script type=\"text/javascript\" src=\"js/jquery.noty.packaged.min.js\" async></script>\n<script type=\"text/javascript\" src=\"js/eModalBl.min.js\" async></script>\n\n<script>\n \n function ShowCamHist(hist_url,title){\n var options = {\n url: hist_url,\n title:title,\n size: eModal.size.lg,\n buttons: [\n {text: 'OK', style: 'success', close: true}\n ]\n };\n eModal.iframe(options);\n }\n \n function SnapShot(cam_name){\n $.ajax({\n url: \"/red/save_images?cam_list=\"+cam_name+'&object_name=UI',\n type: \"GET\",\n success: function(){\n //alert(\"Information has been updated successfully\");\n var n = noty({\n layout : 'center',\n text : '<b>Success<b><br>Snapshot has been saved successfully',\n type : 'information',\n modal : true,\n theme : 'relax',\n buttons : [\n { addClass: 'btn btn-primary', text: 'Ok', onClick: function (n) {\n n.close();\n }\n }\n ]\n });\n }\n });\n\n }\n\n $(document).ready(function() {\n function updateImage()\n {\n if(window.parent.$Curr_Tab=='#Dashboard2'){\n for (var i=0;i<$('.panel-image').length;i++){\n widget='.panel-image-'+ $('.panel-image')[i].id;\n var imageURL = $(widget).attr('name'); //.css(\"background-image\");\n imageURL = imageURL.replace(/.*\\s?url\\([\\'\\\"]?/, '').replace(/[\\'\\\"]?\\).*/, '')\n var cacheBreakerURL = imageURL + (imageURL.indexOf(\"?\") == -1 ? \"?\" : \"&\") + Date.now();\n $(widget).css({\n \"background-image\" : \"url(\" + cacheBreakerURL + \")\"\n });\n }\n } \n }\n \n setInterval(updateImage, 30000);\n });\n</script>\n</body>\n</html>\n<!-- data-angleOffset=-125 data-angleArc=250 -->",
"x": 578,
"y": 826,
"wires": [
[
"59032b89.1a57a4"
]
]
},
{
"id": "59032b89.1a57a4",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 736,
"y": 827,
"wires": []
},
{
"id": "7271a272.6ed74c",
"type": "comment",
"z": "1b96200.289cfe",
"name": "Cameras page---------------------------------------",
"info": "",
"x": 196.5,
"y": 801,
"wires": []
},
{
"id": "ec1e039f.c045b",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/cam_history",
"method": "get",
"swaggerDoc": "",
"x": 144,
"y": 956,
"wires": [
[
"92489d3a.b8fc9"
]
]
},
{
"id": "92489d3a.b8fc9",
"type": "function",
"z": "1b96200.289cfe",
"name": "",
"func": "if (msg.payload.token ==context.global.FREEBOARD_TOKEN || context.global.getCookie('exchange_token',msg.req.headers.cookie)==context.global.FREEBOARD_TOKEN){\n msg.statusCode=\"200\";\n var cam_array=[]\n if ( 'camera_name' in msg.payload && msg.payload.camera_name!=='' && 'activities' in context.global.winkState.cameras[msg.payload.camera_name]){\n for (var i=0;i<context.global.winkState.cameras[msg.payload.camera_name].activities.length;i++){\n var activity=context.global.winkState.cameras[msg.payload.camera_name].activities[i];\n var datetime=new Date(activity.cuepoint_id*1000+context.global.Weather.Offset*60*60*1000);\n cam_array.push({\n position:i,\n is_active:(i===0 ? true:false),\n title_tm: datetime.toLocaleTimeString(),\n title_dt: datetime.toLocaleDateString(),\n //toString(\"dddd, MMMM dd, yyyy h:mm:ss tt\"),\n img_url:activity.snapshot_url\n });\n }\n msg.payload.cam_activities=cam_array;\n if (!('headers' in msg)) msg.headers={}\n msg.headers['Cache-Control']=\"max-age=0,no-cache,no-store,post-check=0,pre-check=0\"\n } \n} else {\n msg.statusCode=\"403\"; \n }\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 357,
"y": 955,
"wires": [
[
"2f737cfc.c3fc74"
]
]
},
{
"id": "2f737cfc.c3fc74",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/animate.css\" />\n <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n <script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\" async></script>\n <style>\n .carousel-inner > .item > img,\n .carousel-inner > .item > a > img {\n width: 100%;\n margin: auto;\n height: 420px;\n }\n .carousel-fade .carousel-inner .item {\n opacity: 0;\n -webkit-transition-property: left;\n -moz-transition-property: left;\n -o-transition-property: left;\n transition-property: left;\n}\n.carousel-fade .carousel-inner .active {\n opacity: 1;\n}\n.carousel-fade .carousel-inner .active.left,\n.carousel-fade .carousel-inner .active.right {\n left: 0;\n opacity: 0;\n z-index: 14;\n}\n.carousel-fade .carousel-inner .next.left,\n.carousel-fade .carousel-inner .prev.right {\n opacity: 1;\n}\n.carousel-fade .carousel-control {\n z-index: 14;\n}\n </style>\n</head>\n<body>\n<div class=\"container\">\n <br>\n <br>\n <div id=\"myCarousel\" class=\"carousel slide carousel-fade col-md-12 col-lg-12 col-sm-12 col-xs-12 col-offset-3\" data-ride=\"carousel\">\n <!-- Indicators -->\n <ol class=\"carousel-indicators\">\n {{#payload.cam_activities}}\n <li data-target=\"#myCarousel\" data-slide-to=\"{{position}}\" {{#is_active}}class=\"active \"{{/is_active}}></li>\n {{/payload.cam_activities}}\n </ol>\n \n <!-- Wrapper for slides -->\n <div class=\"carousel-inner\">\n {{#payload.cam_activities}}\n <div class=\"item{{#is_active}} active{{/is_active}}\">\n <img src=\"{{img_url}}\" alt=\"{{title}}\" class=\"img-responsive animated fadeIn\" >\n <div class=\"carousel-caption\">\n <p>Date: {{title_dt}}</p>\n <p>Time: {{title_tm}}</p>\n </div>\n </div>\n {{/payload.cam_activities}}\n </div>\n \n <!-- Left and right controls -->\n <a class=\"left carousel-control\" href=\"#myCarousel\" role=\"button\" data-slide=\"prev\">\n <span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Previous</span>\n </a>\n <a class=\"right carousel-control\" href=\"#myCarousel\" role=\"button\" data-slide=\"next\">\n <span class=\"glyphicon glyphicon-chevron-right\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\">Next</span>\n </a>\n </div>\n\n</div>\n</body>\n</html>",
"x": 511,
"y": 955,
"wires": [
[
"b97b688d.ddd588"
]
]
},
{
"id": "b97b688d.ddd588",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 687,
"y": 955,
"wires": []
},
{
"id": "9c5aa294.e9461",
"type": "catch",
"z": "1b96200.289cfe",
"name": "",
"x": 110,
"y": 1352,
"wires": [
[
"3f688cbc.e8a534"
]
]
},
{
"id": "3f688cbc.e8a534",
"type": "debug",
"z": "1b96200.289cfe",
"name": "",
"active": true,
"console": "true",
"complete": "error",
"x": 312,
"y": 1376,
"wires": []
},
{
"id": "b12035f1.33f9d8",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/MySummary",
"method": "get",
"swaggerDoc": "",
"x": 143,
"y": 213,
"wires": [
[
"d9d20b8e.d406d8"
]
]
},
{
"id": "da1814b5.896f68",
"type": "function",
"z": "1b96200.289cfe",
"name": "GenSummary",
"func": "var pct = function(value) {\n return ((value > 1.0 ? value : value * 100).toFixed(0) + '%')\n}\nvar dual_temp = function (value) {\n return (typeof value === 'number' ? (value.toFixed(1) + 'C / ' + ((value * 1.8) + 32).toFixed(1) + 'F') : '')\n}\n//if ((msg.req.body.uid==context.global.WinkUser.uid && msg.req.body.pwd==context.global.WinkUser.pwd)||context.global.getCookie('exchange_token',msg.req.headers.cookie)==context.global.FREEBOARD_TOKEN || msg.payload.token==context.global.FREEBOARD_TOKEN){\n//if (true){\nif ('bfp' in msg.payload && context.global.getCookieVerified('exchange_token',msg.req.headers.cookie, msg.payload.bfp)==context.global.FREEBOARD_TOKEN){\nmsg.statusCode=\"200\";\nmsg.payload={}\n//msg.payload.pwd_str=context.global.FREEBOARD_TOKEN;\n//msg.payload.ifttt_token=context.global.FREEBOARD_TOKEN;\nmsg.payload.home_lat=('HomeLocation' in context.global ? context.global.HomeLocation.lat : null);\nmsg.payload.home_lon=('HomeLocation' in context.global ? context.global.HomeLocation.lon : null);\nmsg.payload.weather=context.global.Weather || null;\nmsg.payload.HoursFormat24=context.global.HoursFormat24 || false;\nmsg.payload.Schedules=('Schedules' in context.global && context.global.Schedules=='on' ? true : false);\nmsg.payload.VacationMode=('VacationMode' in context.global && context.global.VacationMode=='on' ? true : false);\n//msg.payload.lights=context.global.winkState.groups['@lights'];\n//msg.payload.wholeHouse=context.global.winkState.groups['.all'];\nvar all=context.global.winkState.groups['.all'];\nvar l=context.global.winkState.groups['@lights'];\nmsg.payload.home_components=[];\n//msg.payload.hasLocks=false;\n//msg.payload.hasCoAlarms=false;\n//msg.payload.hasLights=false;\nvar Wmsg = context.global.render_home_components('.all');\nmsg.payload.home_components=Wmsg.payload.home_components;\nmsg.res.statusCode=\"200\";\nif (msg.topic=='json'){\n var Etag=\"\";\n if ('CRYPTO' in context.global) Etag=context.global.CRYPTO.createHash(\"md5\").update(JSON.stringify(msg.payload),\"utf8\").digest(\"hex\");\n msg.headers={\n 'Content-Type': 'application/json',\n 'ETag': Etag\n };\n}\n} else {\nmsg.res.statusCode=\"403\";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 542,
"y": 246,
"wires": [
[
"d585a2a7.5057d"
]
]
},
{
"id": "1a0cd163.e361ef",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<!--<html lang=\"en\" manifest=\"manifest.cache\"> -->\n<html>\n<head>\n <meta charset=\"utf-8\">\n\t<meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <meta name=\"viewport\" content = \"width = device-width, initial-scale = 1.0, user-scalable = yes\" />\n <title>Summary</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" />\n <link href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n\n \n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" /> \n <link rel=\"stylesheet\" href=\"css/weather-icons.css\">\n <link rel=\"stylesheet\" href=\"css/weather-icons-wind.css\">\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/animate.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/c-ico.css\">\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/tabletui.min.css\">\n<style>\n::-webkit-scrollbar {\n width: 12px;\n}\n \n::-webkit-scrollbar-track {\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); \n border-radius: 10px;\n}\n \n::-webkit-scrollbar-thumb {\n border-radius: 10px;\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); \n}\n.btn-sm-head {\n line-height: 0.9;\n}\n.badge-sm {\n color: #337ab7;\n background-color: #fff;\n font-size: 11px;\n line-height: 0.45;\n}\n</style>\n</head>\n<body>\n\n<div class=\"container-fluid\">\n <div class=\"row\">\n <div class=\"col-lg-9 col-md-9 col-sm-12 col-xs-12\">\n <div class=\"row\">\n <div class=\"col-lg-6 col-md-6 col-sm-6 hidden-xs\">\n <div class=\"panel panel-primary panel-time\">\n <div class=\"panel-heading weather\" id=\"Header time\">\n <span class=\"fa fa-clock-o\" aria-hidden=\"true\"></span>\n Time\n </div>\n <div class=\"panel-body panel-clock\" id=\"clock\">\n <div class=\"row\">\n <div id=\"DateName\" class=\"detail-txt pull-left\" style=\"margin-left: 10px;\">\n {{payload.weather.DateName}}\n </div> \n </div>\n <div class=\"row\">\n <ul class=\"clock-list\">\n \t<li class=\"clock-list-item\" id=\"hours\">00</li>\n <li class=\"clock-list-item\" id=\"point\">:</li>\n <li class=\"clock-list-item\" id=\"min\">00</li>\n <li class=\"clock-list-item\" id=\"point\">:</li>\n <li class=\"clock-list-item\" id=\"sec\">00</li>\n </ul>\n </div>\n <div class=\"row\">\n <div id=\"sun_data\" class=\"detail-txt pull-right\" style=\"margin-right: 10px;\">\n {{payload.weather.sun_data}}\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col-lg-6 col-md-6 col-sm-6 col-xs-12 hidden-xs\">\n <div class=\"panel panel-primary panel-weather\" id=\"PWeather\">\n <div class=\"panel-heading weather\" id=\"Header weather\">\n <span class=\"fa fa-sun-o\" aria-hidden=\"true\"></span>\n Current Weather\n </div>\n <div class=\"panel-body panel-weather\" id=\"weather2\">\n <div class=\"row\">\n <table class=\"weather_table\">\n <tbody>\n <tr>\n <td>\n <span id=\"WeatherIcon\" class=\"wi wi-large {{payload.weather.currently.web_icon}}\" aria-hidden=\"true\"></span>\n <div class=\"weather-text\" id=\"curr_weather\">\n {{payload.weather.WeatherSummary}}\n </div>\n </td>\n <td>\n <div class=\"detail-txt pull-right\">\n <table class=\"detail-txt table\" style=\"margin-bottom: 6px;border-top: transparent;\">\n <tbody>\n <tr>\n <td>Temperature</td>\n <td id=\"curr_temp\">{{payload.weather.currently.dual_temp}}</td>\n </tr>\n <tr>\n <td>Cloud Cover</td>\n <td id=\"clouds\">{{payload.weather.currently.clouds_pct}}</td>\n </tr>\n <tr>\n <td>Humidity</td>\n <td id=\"humidity\">{{payload.weather.currently.humidity_pct}}</td>\n </tr>\n </tbody>\n </table>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n </div>\n </div> \n </div>\n <div class=\"row\"> <!-- main panel with status icons -->\n <div class=\"col-lg-12 col-md-12 col-sm-12 col-xs-12\">\n <div class=\"panel panel-primary panel-homestat\">\n <div class=\"panel-heading homestat\" id=\"Header homestat\">\n <div class=\"btn-toolbar\"> \n <span class=\"fa fa-home\" aria-hidden=\"true\"></span>\n Home status\n <button type=\"button\" id=\"VacationMode\" class=\"btn Vaca {{#payload.VacationMode}}btn-success{{/payload.VacationMode}}{{^payload.VacationMode}}btn-warning{{/payload.VacationMode}} btn-sm btn-sm-head pull-right\">Vacation Mode <span class=\"badge badge-VacationMode badge-sm\">{{#payload.VacationMode}}On{{/payload.VacationMode}}{{^payload.VacationMode}}Off{{/payload.VacationMode}}</span></button>\n <button type=\"button\" id=\"Schedules\" class=\"btn Sche {{#payload.Schedules}}btn-success{{/payload.Schedules}}{{^payload.Schedules}}btn-warning{{/payload.Schedules}} btn-sm btn-sm-head pull-right hidden-xs\">Schedules <span class=\"badge badge-Schedules badge-sm\">{{#payload.Schedules}}On{{/payload.Schedules}}{{^payload.Schedules}}Off{{/payload.Schedules}}</span></button>\n </div>\n </div>\n <div class=\"panel-body panel-stat\" id=\"homestat\">\n {{#payload.home_components}}\n <div class=\"col-lg-3 col-md-3 col-sm-3 col-xs-4\">\n <div class=\"panel panel-default panel-no_border panel-{{type}}\">\n <div class=\"panel-body panel-tile panel-no_border panel-body-{{type}}\">\n <div class=\"row\">\n <table style=\"background:transparent;margin-left:5px;\">\n <tbody>\n <tr>\n <td><div class=\"{{icon}} {{icon_color}}\" area-hidden=\"true\" id=\"icon-{{type}}\"></div></td>\n <td style=\"padding-left: 5px;\"><div class=\"detail-txt-home detail-{{type}} {{icon_color}} pull-right\" id=\"txt-{{type}}\">{{value}}</div></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n </div>\n </div> \n {{/payload.home_components}}\n </div>\n </div>\n </div>\n </div>\n</div> \n <div class=\"col-lg-3 col-md-3 hidden-sm hidden-xs\">\n <div class=\"panel panel-primary panel-messages\">\n <div class=\"panel-heading messages\" id=\"Header messages\">\n <span class=\"fa fa-rss\" aria-hidden=\"true\"></span>\n Events log\n </div>\n <div class=\"panel-body panel-messages\" id=\"messages\" style=\"height:0px;\">\n </div>\n </div>\n </div>\n </div>\n</div> \n<script src=\"//cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.4.1/fingerprint2.min.js\"></script>\n<script type=\"text/javascript\" src=\"js/jquery-1.12.0.min.js\"></script>\n<script type=\"text/javascript\" async src=\"bootstrap/js/bootstrap.min.js\" async></script>\n<script type=\"text/javascript\" async src=\"js/jquery.noty.packaged.min.js\" async></script>\n<!-- you need to include the shieldui css and js assets in order for the charts to work -->\n<!--<script type=\"text/javascript\" src=\"https://www.prepbootstrap.com/Content/js/gridData.js\" async></script> -->\n<script type=\"text/javascript\" async src=\"js/eModalBl.min.js\" async></script>\n\n<script>\n function getCookie(cname) {\n var name = cname + \"=\";\n var ca = document.cookie.split(';');\n for(var i=0; i<ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0)==' ') c = c.substring(1);\n if (c.indexOf(name) == 0) return c.substring(name.length,c.length);\n }\n return \"\";\n}\n function displayForecast(){\n $Forecast.forEach(function(day){\n txt='<div class=\"row\"><div class=\"col-lg-3 col-md-3\"><i class=\"wi wi-med '+day.web_icon+'\" aria-hidden=\"true\"></i></div><div class=\"col-lg-9 col-md-9 fcast-text\">'+day.weekday.substring(0,3)+': '+day.summary+'<br>Max: '+day.temperatureMax+'<br>Min: '+day.temperatureMin+'</div></div>'\n// txt='<iframe id=\"forecast_embed\" type=\"text/html\" frameborder=\"0\" height=\"245\" width=\"100%\" src=\"http://forecast.io/embed/#lat=42.3583&lon=-71.0603&name=Downtown Boston\"> </iframe>'\n var wthr = noty({\n //layout : 'centerRight',\n layout : 'topCenter',\n text : txt,\n type : 'information',\n maxVisible : 4,\n force : false,\n timeout : 8000,\n dismissQueue: true,\n theme :'relax' //'bootstrapTheme' //'defaultTheme' \n });\n });\n \n }\n $(\"#WeatherIcon\").click(function(){\n displayForecast();\n });\n \n function update_weather_data(weather){\n $('#DateName').html(weather.DateName);\n $('#sun_data').html(weather.sun_data);\n var curr_cls=$('#WeatherIcon').attr(\"class\").split(\" \")[2];\n $('#WeatherIcon').removeClass(curr_cls).addClass(weather.currently.web_icon);\n $('#curr_temp').html(weather.currently.dual_temp);\n $('#clouds').html(weather.currently.clouds_pct);\n $('#humidity').html(weather.currently.humidity_pct);\n $('#curr_weather').html(weather.WeatherSummary); \n $Forecast=weather.daily;\n }\n function update_home_status(home_data){\n //console.log(home_data);\n for(var i=0;i<home_data.length;i++){\n var o=home_data[i];\n var curr_cls_a=$('#icon-'+o.type).attr(\"class\").split(\" \");\n var curr_icon=$('#icon-'+o.type).attr(\"class\").split(\" \")[2];\n var color_cls=curr_cls_a[curr_cls_a.length-1];\n $('#icon-'+o.type).removeClass(curr_icon).addClass(o.icon);\n $('#icon-'+o.type).removeClass(color_cls).addClass(o.icon_color);\n $('#txt-'+o.type).removeClass(color_cls).addClass(o.icon_color);\n $('#txt-'+o.type).html(o.value);\n }\n }\n function display_notification(data){\n var datetime = new Date();\n var title_tm=datetime.toLocaleTimeString();\n var title_dt=datetime.toLocaleDateString();\n if('id' in data && data.id!==null){\n if (data.id in $noty_arr && $.noty.get($noty_arr[data.id].options.id)){\n $.noty.setText($noty_arr[data.id].options.id,title_tm+': '+data.message);\n $.noty.setType($noty_arr[data.id].options.id,data.alertType);\n }\n else {\n $noty_arr[data.id] = $('div#messages').noty({\n //layout : 'centerRight',\n layout : 'top',\n text : title_tm+': '+data.message,\n type : data.alertType,\n maxVisible : 30,\n force : true,\n timeout : (data.alertType=='error' ? false : data.timeout || 3600000),\n dismissQueue: true,\n theme : 'relax'\n });\n }\n } else {\n var n = $('div#messages').noty({\n //layout : 'centerRight',\n layout : 'top',\n text : title_tm+': '+data.message,\n type : data.alertType,\n maxVisible : 30,\n force : true,\n timeout : (data.alertType=='error' ? false : data.timeout || 3600000),\n dismissQueue: true,\n theme : 'relax'\n });\n }\n }\n function wsDisconnect(){\n if (typeof ws !=='undefined'){\n ws.disconnect();\n }\n }\n function wsConnect() {\n var ws;\n var wsUri = \"ws:\";\n var loc = window.location;\n if (loc.protocol === \"https:\") { wsUri = \"wss:\"; }\n wsUri += \"//\" + loc.host + \"/ws/winkStat\";\n ws = new WebSocket(wsUri);\n ws.onmessage = function(msg) {\n var data = JSON.parse(msg.data);\n //console.log(data);\n if ('alertType' in data){\n display_notification(data);\n }\n if ('weather' in data){\n update_weather_data(data.weather); \n }\n if ('home_components' in data){\n update_home_status(data.home_components); \n }\n if ('config' in data){\n HoursFormat24=data.config.HoursFormat24;\n }\n if ('varName' in data){\n updateBtn(data.varName,data.varVal);\n }\n }\n ws.onopen = function() {\n console.log(\"connected\");\n if (typeof getDataIn !== 'undefined' && getOnly) clearInterval(getDataIn);\n if(getOnly){\n getDataIn=setInterval(executeQuery, 120000);\n getOnly=false;\n }\n }\n ws.onclose = function() {\n // console.log(\"re connecting\");\n setTimeout(wsConnect(),3000);\n }\n ws.onerror = function(event){\n if (typeof getDataIn !== 'undefined' && !getOnly) clearInterval(getDataIn);\n if (!getOnly){\n getDataIn=setInterval(executeQuery, 2000);\n console.log('websocket error, activating get');\n getOnly=true;\n }\n }\n };\n\nfunction clock()\n{\n var seconds = new Date().getSeconds();\n\tvar minutes = new Date().getMinutes();\n\tvar hours = new Date().getHours();\n\tif (HoursFormat24){\n \t$(\"#hours\").html(( hours < 10 ? \"0\" : \"\" ) + hours);\n \t$(\"#min\").html(( minutes < 10 ? \"0\" : \"\" ) + minutes);\n \t$(\"#sec\").html(( seconds < 10 ? \"0\" : \"\" ) + seconds);\n\t} else {\n \tvar day_frame = (hours<12 ? \" AM\" : \" PM\")\n \thours=(hours<13 ? hours : hours-12)\n \t$(\"#hours\").html(( hours < 10 ? \"0\" : \"\" ) + hours);\n \t$(\"#min\").html(( minutes < 10 ? \"0\" : \"\" ) + minutes);\n \t$(\"#sec\").html(( seconds < 10 ? \"0\" : \"\" ) + seconds+ day_frame);\n\t}\n}\n $( window ).resize(function () {\n $(\"#messages\").css('height', $( window ).height()-75);\n// if( viewport.is('xs') ) $(\"#homestat\").css('height', $( window ).height()-(75))\n// else \n $(\"#homestat\").css('height', $( window ).height()-(103+178));\n \n });\n $(document).ready(function() {\n $noty_arr = {};\n {{#payload.HoursFormat24}}\n HoursFormat24=true;\n \t {{/payload.HoursFormat24}}\n\t {{^payload.HoursFormat24}}\n\t HoursFormat24=false;\n\t {{/payload.HoursFormat24}}\n $(\"#messages\").css('height', $( window ).height()-75);\n// if( viewport.is('xs') ) $(\"#homestat\").css('height', $( window ).height()-(75))\n// else \n $(\"#homestat\").css('height', $( window ).height()-(103+178)); \n setInterval(clock, 1000);\n });\n \n function executeQuery() {\n $.ajax({\n url: 'MySummaryJson?bfp='+$myFngrp,\n method: 'GET',\n ifModified:true,\n// dataType: 'JSON',\n headers: {\n// 'Authorization':'Bearer {{payload.pwd_str}}',\n 'Content-Type':'application/json',\n 'If-None-Match':$eTag\n },\n success: function(data,status, xhr) {\n if (xhr.status===200){\n $eTag=xhr.getResponseHeader('Etag');\n // console.log(wink_obj.haveLights);\n if ('weather' in data){\n update_weather_data(data.weather); \n }\n if ('home_components' in data){\n update_home_status(data.home_components); \n }\n if ('config' in data){\n HoursFormat24=data.config.HoursFormat24;\n }\n } \n }\n });\n }\n //setTimeout(executeQuery, 5000); // you could choose not to continue on failure...\n $(document).ready(function() {\n $eTag=\"sasd12312sefsdf=\";\n $noty_arr=[]; \n $Forecast=[];\n getOnly=false;\n $myFngrp='';\n var fp=new Fingerprint2();\n fp.get(function(result){\n $myFngrp=btoa(result);\n executeQuery(); \n });\n // run the first time; all subsequent calls will take care of themselves\n //setInterval(executeQuery, 3000);\n if (\"WebSocket\" in window) wsConnect();\n else GetDataIn=setInterval(executeQuery,2000);\n });\n \n function updateBtn(btn_name,val){\n var badge=$(\".badge-\"+$(\"#\"+btn_name).attr('id'));\n $(badge).text((val=='on' ? 'On' : 'Off'));\n (val=='on' ? $(\"#\"+btn_name).removeClass('btn-warning').addClass('btn-success') : $(\"#\"+btn_name).removeClass('btn-success').addClass('btn-warning'));\n $(\"#\"+btn_name).blur();\n }\n \n $(\".btn\").click(function(){\n var badge=$(\".badge-\"+$(this).attr('id'));\n// console.log($(this).attr('id'));\n var nrVar= ($(this).attr('id')=='VacationMode' ? 'VacationMode' : 'Schedules')\n var isOn=($(badge).text()=='On' ? false : true);\n\n// console.log($(this).attr('class'));\n// $(this).removeClass('btn-warning').addClass('btn-success');\n// console.log($(badge).text());\n// $(badge).text((isOn ? 'On' : 'Off'));\n $.post( \"/red/ifttt\", {\"nodeRedVar\":nrVar,\"value\":(isOn ? 'on' : 'off'), \"iftttkey\" : getCookie('exchange_token')}); \n }); \n</script>\n</body>\n</html>",
"x": 861,
"y": 233,
"wires": [
[
"ff097a85.02f8f8"
]
]
},
{
"id": "ff097a85.02f8f8",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 1023,
"y": 249,
"wires": []
},
{
"id": "6f2570fc.2f1af",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/LockControls",
"method": "get",
"swaggerDoc": "",
"x": 145,
"y": 619,
"wires": [
[
"75813ef2.4b9b4"
]
]
},
{
"id": "d544f740.68ee18",
"type": "function",
"z": "1b96200.289cfe",
"name": "GenLocks",
"func": "//if(msg.req.headers.authorization && msg.req.headers.authorization==\"Bearer \"+context.global.FREEBOARD_TOKEN){\n//if ((msg.req.body.uid==context.global.WinkUser.uid && msg.req.body.pwd==context.global.WinkUser.pwd)||context.global.getCookie('exchange_token',msg.req.headers.cookie)==context.global.FREEBOARD_TOKEN || msg.payload.token==context.global.FREEBOARD_TOKEN){\nif ('bfp' in msg.payload && context.global.getCookieVerified('exchange_token',msg.req.headers.cookie, msg.payload.bfp)==context.global.FREEBOARD_TOKEN){\n//if (true){\nmsg.statusCode=\"200\";\nmsg.headers={'Cache-Control':\"max-age=0,no-cache,no-store,post-check=0,pre-check=0\"};\nmsg.payload.pwd_str=context.global.FREEBOARD_TOKEN;\nmsg.payload.ifttt_token=context.global.FREEBOARD_TOKEN;\nmsg.payload.haveLLocks=false\nvar locks=[]\nif ('locks' in context.global.winkState){\n for (var l_lock in context.global.winkState.locks){\n var lock=context.global.winkState.locks[l_lock];\n locks.push({\n name:lock.name,\n object_type:lock.object_type,\n //class_name:'dial '+bulb.object_id,\n object_id:lock.object_id,\n isLock:(lock.object_type==='locks' ? true:false),\n locked:lock.locked,\n not_locked:!lock.locked\n });\n }\n msg.payload.haveLocks=true\n}\n/*\nif ('garage_doors' in context.global.winkState){\n for (var l_lock in context.global.winkState.garage_doors){\n var lock=context.global.winkState.garage_doors[l_lock];\n locks.push({\n name:lock.name,\n object_type:lock.object_type, \n //class_name:'dial '+bulb.object_id,\n object_id:lock.object_id,\n locked:(lock.position>0 ? false:true),\n not_locked:(lock.position>0 ? true:false)\n });\n }\n msg.payload.haveLocks=true\n}\n*/\nmsg.payload.locks=locks;\nif (msg.topic=='json'){\n var Etag=\"\";\n if ('CRYPTO' in context.global) Etag=context.global.CRYPTO.createHash(\"md5\").update(JSON.stringify(msg.payload),\"utf8\").digest(\"hex\");\n msg.headers={\n 'Content-Type': 'application/json',\n 'ETag': Etag\n };\n}\n} else {\nmsg.statusCode=\"403\";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 531,
"y": 645,
"wires": [
[
"fd0c71c6.6034a"
]
]
},
{
"id": "40f59bb4.637a34",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n\t<meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <meta name=\"viewport\" content = \"width = device-width, initial-scale = 1.0, user-scalable = yes\" />\n <title>light control</title>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap-toggle.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" />\n\n <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n <script type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\" async></script>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.4.1/fingerprint2.min.js\"></script>\n <script type=\"text/javascript\" src=\"bootstrap/js/bootstrap-toggle.min.js\" async></script>\n <script src=\"assets/js/jquery.knob.min.js\"></script>\n <script src=\"//crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js\"></script>\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.4.1/fingerprint2.min.js\"></script> \n <!-- you need to include the shieldui css and js assets in order for the charts to work -->\n <!-- <script type=\"text/javascript\" src=\"https://www.prepbootstrap.com/Content/js/gridData.js\" async></script> -->\n <style>\n .slow .toggle-group { transition: left 0.7s; -webkit-transition: left 0.7s; }\n ::-webkit-scrollbar {\n width: 12px;\n }\n \n ::-webkit-scrollbar-track {\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); \n border-radius: 10px;\n }\n \n ::-webkit-scrollbar-thumb {\n border-radius: 10px;\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); \n }\n </style>\n</head>\n<body onload=\"wsConnect();\">\n\n<!--<div class=\"container\"> -->\n {{#payload.locks}}\n <div class=\"col-xs-12 col-md-3 col-sm-3\" style=\"background:none;\"> \n <div class=\"panel panel-primary panel-{{object_id}}\">\n <!-- Default panel contents -->\n <div class=\"panel-heading {{name}}\" id=\"Header {{name}}\">\n <p class=\"text-nowrap\">\n <span class=\"fa fa-lock icon-{{object_id}}\" aria-hidden=\"true\"></span>\n <small>{{name}}</small>\n </p>\n </div>\n <div class=\"panel-body\">\n <input type=\"checkbox\" class=\"lock-{{object_id}}\" id=\"{{name}}|{{object_type}}\" name=\"{{object_id}}\" {{#locked}}checked{{/locked}} data-style=\"slow\" data-toggle=\"toggle\" data-onstyle=\"success\" data-offstyle=\"warning\" data-on=\"<i class='fa fa-lock'></i> {{#isLock}}Locked{{/isLock}}{{^isLock}}Closed{{/isLock}}\" data-off=\"<i class='fa fa-unlock'></i> {{#isLock}}Unlocked{{/isLock}}{{^isLock}}Open{{/isLock}}\" data-width=\"100%\" data-height=\"85\">\n </div>\n </div>\n </div>\n {{/payload.locks}} \n<!--</div> -->\n\n<script type=\"text/javascript\">\n function getCookie(cname) {\n var name = cname + \"=\";\n var ca = document.cookie.split(';');\n for(var i=0; i<ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0)==' ') c = c.substring(1);\n if (c.indexOf(name) == 0) return c.substring(name.length,c.length);\n }\n return \"\";\n}\n $('input[type=checkbox]').change(function(){\n //console.log(this.id);\n var LName=this.id.split('|')[0]; //.substring(0,this.id.length-3);\n var LType=this.id.split('|')[1];\n var Wcmd;\n var l_id='.panel-'+this.name;\n Wcmd = (LType==='locks' ? ($(this).prop('checked') ? 'lock' : 'unlock') : ($(this).prop('checked') ? 'close' : 'open'));\n WType = (LType==='garage_doors' ? 'garage' : 'lock');\n if($lock[this.name]==='undefined' || $lock[this.name]!==Wcmd){\n $.post( \"/red/ifttt\", {\"winkName\":LName,\"type\":WType,\"cmd\":Wcmd,\"level\":\"\" , \"iftttkey\" :getCookie('exchange_token'),\"uuid\":$myFngrp}); \n $lock[this.name]=Wcmd;\n }\n // (Wcmd=='unlock' ? $(l_id).removeClass('panel-primary').addClass('panel-warning') : $(l_id).removeClass('panel-warning').addClass('panel-primary'));\n });\n function wsDisconnect(){\n if (typeof ws !=='undefined'){\n ws.disconnect();\n }\n }\n function wsConnect() {\n var ws;\n var wsUri = \"ws:\";\n var loc = window.location;\n if (loc.protocol === \"https:\") { wsUri = \"wss:\"; }\n wsUri += \"//\" + loc.host + \"/ws/winkStat\";\n ws = new WebSocket(wsUri);\n ws.onmessage = function(msg) {\n var data = JSON.parse(msg.data);\n if('locked' in data){\n var l_id='.panel-'+data.object_id;\n var lock_id='.lock-'+data.object_id;\n var icon='.icon-'+data.object_id;\n $lock[data.object_id]=(data.object_type==='locks' ? (data.locked ? 'lock':'unlock') : (data.locked ? 'open':'close'));\n if(!data.locked) \n {\n $(l_id).removeClass('panel-primary').addClass('panel-warning');\n $(icon).removeClass('fa-lock').addClass('fa-unlock');\n $(lock_id).prop('checked', false).change()\n \n } else {\n $(l_id).removeClass('panel-warning').addClass('panel-primary');\n $(icon).removeClass('fa-unlock').addClass('fa-lock');\n $(lock_id).prop('checked', true).change()\n }\n }\n }\n ws.onopen = function() {\n console.log(\"connected\");\n }\n ws.onclose = function() {\n // console.log(\"re connecting\");\n setTimeout(wsConnect,3000);\n }\n };\n \n \n function executeQuery() {\n $.ajax({\n url: 'lockdata?bfp='+$myFngrp,\n method: 'GET',\n ifModified:true,\n// dataType: 'JSON',\n headers: {\n 'Authorization':'Bearer '+getCookie('exchange_token'),\n 'Content-Type':'application/json',\n 'If-None-Match':$eTag\n },\n success: function(data,status, xhr) {\n if (xhr.status===200){\n var wink_obj=data;// JSON.parse(data);\n \n $eTag=xhr.getResponseHeader('Etag');\n // console.log(wink_obj.haveLights);\n var locks=wink_obj.locks;\n for(var i=0;i<locks.length;i++){\n var l_id='.panel-'+locks[i].object_id;\n var lock_id='.lock-'+locks[i].object_id;\n $lock[locks[i].object_id]=(locks[i].object_type==='locks' ? (locks[i].locked ? 'lock':'unlock') : (locks[i].locked ? 'open':'close')); \n var icon='.icon-'+locks[i].object_id;\n if(locks[i].locked) \n {\n $(l_id).removeClass('panel-warning').addClass('panel-primary');\n $(icon).removeClass('fa-lock').addClass('fa-unlock');\n $(lock_id).prop('checked', true).change()\n } else {\n $(l_id).removeClass('panel-primary').addClass('panel-warning');\n $(icon).removeClass('fa-unlock').addClass('fa-lock');\n $(lock_id).prop('checked', false).change()\n }\n }\n }\n }\n });\n //setTimeout(executeQuery, 5000); // you could choose not to continue on failure...\n }\n\n $(document).ready(function() {\n $lock=[]\n $eTag=\"sasd12312sdfsdf=\";\n $myFngrp='';\n var fp=new Fingerprint2();\n fp.get(function(result){\n $myFngrp=btoa(result);\n executeQuery(); \n });\n // run the first time; all subsequent calls will take care of themselves\n //setInterval(executeQuery, 3000);\n setInterval(executeQuery, 120000);\n });\n</script>\n</body>\n</html>",
"x": 855,
"y": 622,
"wires": [
[
"f0b249b9.248488"
]
]
},
{
"id": "3d25475b.3bd608",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/LockData",
"method": "get",
"swaggerDoc": "",
"x": 136,
"y": 662,
"wires": [
[
"8b3b5f51.a9d56"
]
]
},
{
"id": "5040105a.bb961",
"type": "json",
"z": "1b96200.289cfe",
"name": "",
"x": 846,
"y": 677,
"wires": [
[
"f0b249b9.248488"
]
]
},
{
"id": "f0b249b9.248488",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 987,
"y": 651,
"wires": []
},
{
"id": "63386e89.7dbb2",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/LightControls",
"method": "get",
"swaggerDoc": "",
"x": 149,
"y": 529,
"wires": [
[
"ec4252ed.2a5a9"
]
]
},
{
"id": "519dacc4.af1534",
"type": "function",
"z": "1b96200.289cfe",
"name": "GenLights",
"func": "if ('bfp' in msg.payload && context.global.getCookieVerified('exchange_token',msg.req.headers.cookie, msg.payload.bfp)==context.global.FREEBOARD_TOKEN){\n//node.warn( context.global.getCookie('exchange_token',msg.req.headers.cookie));\nmsg.statusCode=\"200\";\nmsg.headers={'Cache-Control':\"max-age=0,no-cache,no-store,post-check=0,pre-check=0\"};\nmsg.payload.pwd_str=context.global.FREEBOARD_TOKEN;\nmsg.payload.ifttt_token=context.global.FREEBOARD_TOKEN;\nmsg.payload.haveLights=false;\nvar lights=[];\nif ('light_bulbs' in context.global.winkState){\n for (var l_bulb in context.global.winkState.light_bulbs){\n var bulb=context.global.winkState.light_bulbs[l_bulb];\n if ('color_model' in bulb || 'hue' in bulb) {\n var color=context.global.tinycolor('hsv '+(bulb.eco_system=='LIFX' ? bulb.hue : bulb.hue*360)+' '+bulb.saturation+' '+bulb.brightness);\n var hexColor=color.toHexString();\n } \n lights.push({\n name:bulb.name,\n clr_id:'.clr-'+bulb.object_id,\n isColor: (('color_model' in bulb || 'hue' in bulb) ? true:false),\n Color:(('color_model' in bulb || 'hue' in bulb) ? hexColor : null),\n class_name:'dial '+bulb.object_id,\n object_id:bulb.object_id,\n powered:bulb.powered,\n not_powered:!bulb.powered,\n step:1,\n brightness:Math.round(bulb.brightness*100)\n });\n }\n msg.payload.haveLights=true;\n}\nif ('binary_switches' in context.global.winkState){\n for (var bswitch in context.global.winkState.binary_switches){\n var bulb=context.global.winkState.binary_switches[bswitch];\n lights.push({\n name:bulb.name,\n class_name:'dial '+bulb.object_id,\n object_id:bulb.object_id,\n powered:bulb.powered,\n step:100,\n brightness:(bulb.powered ? 100:0)\n });\n}\n msg.payload.haveLights=true;\n}\n\nif ('powerstrips' in context.global.winkState){\n for (var bswitch in context.global.winkState.powerstrips){\n var bulb=context.global.winkState.powerstrips[bswitch];\n if (bulb.object_type==='outlet'){\n lights.push({\n name:bulb.name,\n class_name:'dial '+bulb.object_id,\n object_id:bulb.object_id,\n powered:bulb.powered,\n step:100,\n brightness:(bulb.powered ? 100:0)\n });\n }\n}\n msg.payload.haveLights=true;\n}\nmsg.payload.lights=lights;\nif (msg.topic=='json'){\n var Etag=\"\";\n if ('CRYPTO' in context.global) Etag=context.global.CRYPTO.createHash(\"md5\").update(JSON.stringify(msg.payload),\"utf8\").digest(\"hex\");\n msg.headers={\n 'Content-Type': 'application/json',\n 'ETag': Etag\n };\n}\n} else {\nmsg.statusCode=\"403\";\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 526,
"y": 549,
"wires": [
[
"4b1fa993.a2b808"
]
]
},
{
"id": "382c4733.d188b8",
"type": "template",
"z": "1b96200.289cfe",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n\t<meta name=\"mobile-web-app-capable\" content=\"yes\">\n <meta name=\"apple-mobile-web-app-capable\" content=\"yes\" />\n <meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black\" />\n <meta name=\"viewport\" content = \"width = device-width, initial-scale = 1.0, user-scalable = yes\" />\n <title>light control</title>\n\n <link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap/css/bootstrap.min.css\" /> \n <link rel=\"stylesheet\" type=\"text/css\" href=\"font-awesome/css/font-awesome.min.css\" />\n <link rel=\"stylesheet\" type=\"text/css\" href=\"css/local.css\" />\n <script src=\"//cdnjs.cloudflare.com/ajax/libs/fingerprintjs2/1.4.1/fingerprint2.min.js\"></script> \n <script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n <script async type=\"text/javascript\" src=\"bootstrap/js/bootstrap.min.js\" async></script> \n <script src=\"assets/js/jquery.knob.min.js\"></script>\n <script async src=\"//crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js\"></script>\n <script type=\"text/javascript\" src=\"js/jscolor.min.js\" async></script>\n <style>\n ::-webkit-scrollbar {\n width: 12px;\n }\n \n ::-webkit-scrollbar-track {\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); \n border-radius: 10px;\n }\n \n ::-webkit-scrollbar-thumb {\n border-radius: 10px;\n -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); \n }\n .color-bulb {\n opacity: 0;\n display: block;\n width: 32px;\n border: none;\n }\n .color-button {\n float: right;\n border: black;\n border-style: double;\n border-radius: 50%;\n }\n</style>\n \n </style>\n</head>\n<body>\n\n<!--<div class=\"container\" style=\"margin-top:5px;\"> -->\n {{#payload.lights}}\n <div class=\"col-xs-12 col-md-3 col-sm-6\" style=\"background:none;\"> \n <div class=\"panel panel-primary panel-{{object_id}}\">\n <!-- Default panel contents -->\n <div class=\"panel-heading {{name}}\" id=\"Header {{name}}\">\n <!-- <p class=\"text-nowrap\"> -->\n <span class=\"glyphicon glyphicon-off\" aria-hidden=\"true\"></span>\n <small class=\"text-nowrap\">{{name}}</small>\n {{#isColor}}<div id=\"bclr-{{object_id}}\" class=\"color-button clr-btn-{{object_id}}\" style=\"background-color:{{Color}};\"><input readonly=\"true\" name=\"favcolor{{object_id}}\" id=\"clr-{{name}}\" value=\"{{Color}}\" class=\"color-bulb pull-right clr-{{object_id}} jscolor {width:243, height:150,\n borderColor:'#FFF', insetColor:'#FFF', backgroundColor:'#666', position:'left'}\"></div>{{/isColor}}\n <!-- </p> -->\n </div>\n <div class=\"panel-body\">\n <div class=\"col-sm-8 col-md-8 col-xs-8\">\n <input id=\"{{name}}\" data-angleOffset=-125 data-angleArc=250 data-linecap=round data-fontWeight=\"regular\" data-displayPrevious=\"true\" data-thickness=\".5\" data-step=\"{{step}}\" data-width=80 data-height=80 class=\"{{class_name}}\" value={{brightness}}>\n </div>\n <div class=\"col-xs-2 col-md-2 col-sm-2\">\n <div id=\"btngrp {{name}}\" class=\"btn-group-vertical btn-md\" data-toggle=\"buttons\">\n <label class=\"btn btn-default btn-md\">\n <input type=\"radio\" data-toggle=\"radio-button\" name={{object_id}} id=\"{{name}}_On\" class=\"radio-popup-style radio-{{object_id}}-on{{#powered}} active{{/powered}}\"{{#powered}} checked{{/powered}}>On</input>\n </label>\n <label class=\"btn btn-default btn-md\">\n <input type=\"radio\" data-toggle=\"radio-button\" name={{object_id}} id=\"{{name}}_Of\" class=\"radio-popup-style radio-{{object_id}}-of{{#not_powered}} active{{/not_powered}}\"{{#not_powered}} checked{{/not_powered}}>Off</input>\n </label>\n </div>\n </div>\n </div>\n </div>\n </div>\n {{/payload.lights}} \n<!--</div> -->\n\n<script type=\"text/javascript\">\n function getCookie(cname) {\n var name = cname + \"=\";\n var ca = document.cookie.split(';');\n for(var i=0; i<ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0)==' ') c = c.substring(1);\n if (c.indexOf(name) == 0) return c.substring(name.length,c.length);\n }\n return \"\";\n}\n $(\".dial\").knob({\n 'dynamicDraw' : true,\n 'release' : function (v) {\n if(!webUpd){\n $.post( \"/red/ifttt\", {\"winkName\":this.$.attr('id'),\"type\":\"light\",\"cmd\":(v >0 ? 'on' : 'off' ),\"level\":(v<0 ? 0:v)}) \n }\n webUpd=false;\n }\n });\n \n $('.color-bulb').on('change', function() { \n var btn_id='.clr-btn-'+this.name.replace('favcolor','');\n console.log($(this).val().replace('#','')); \n $(btn_id).css('background-color','#'+$(this).val());\n $.post( \"/red/ifttt\", {\"winkName\":this.id.replace('clr-',''),\"type\":\"light\",\"cmd\":\"color\",\"level\":$(this).val().replace('#','')}) \n \n });\n \n $('input[type=radio]').change(function(){\n //console.log(this.id);\n var LName=this.id.substring(0,this.id.length-3);\n var Wcmd;\n var Wlevel=$('.dial.'+this.name)[0].value;\n var l_id='.panel-'+this.name;\n $(this).addClass(\"active\").siblings().removeAttr('checked').removeClass(\"active\").parent().removeClass('active');\n (this.id.indexOf(\"_On\")!=-1 ? Wcmd='on': Wcmd='off');\n $.post( \"/red/ifttt\", {\"winkName\":LName,\"type\":\"light\",\"cmd\":Wcmd,\"level\":Wlevel , \"iftttkey\" : getCookie('exchange_token')}); \n (Wcmd=='on' ? $(l_id).removeClass('panel-primary').addClass('panel-warning') : $(l_id).removeClass('panel-warning').addClass('panel-primary'));\n });\n \n function wsDisconnect(){\n if (typeof ws !=='undefined'){\n ws.disconnect();\n }\n }\n function wsConnect() {\n var ws;\n var wsUri = \"ws:\";\n var loc = window.location;\n if (loc.protocol === \"https:\") { wsUri = \"wss:\"; }\n wsUri += \"//\" + loc.host + \"/ws/winkStat\";\n ws = new WebSocket(wsUri);\n ws.onmessage = function(msg) {\n var data = JSON.parse(msg.data);\n if ('powered' in data){\n var l_id='.panel-'+data.object_id;\n var dial_name='.dial.'+data.object_id;\n var btn_id='.radio-'+data.object_id;\n if(data.powered) \n {\n $(l_id).removeClass('panel-primary').addClass('panel-warning');\n $(btn_id+'-on').prop('checked',true).parent().addClass('active').siblings().removeClass(\"active\").blur();\n $(btn_id+'-of').removeAttr('checked').prop('checked',false).parent().removeClass('active').blur();\n webUpd=true;\n if(data.isColor){\n $(data.clr_id).val(data.Color);\n var btn_id=data.clr_id.replace('clr','clr-btn');\n $(btn_id).css('background-color',data.Color); \n }\n $(dial_name).val(data.brightness).trigger(\"change\");\n webUpd=false;\n } else {\n $(l_id).removeClass('panel-warning').addClass('panel-primary');\n $(btn_id+'-of').prop('checked',true).parent().addClass('active').siblings().removeClass(\"active\").blur();\n $(btn_id+'-on').removeAttr('checked').prop('checked',false).parent().removeClass('active').blur();\n //$(l_id).parent().click();\n //$(l_id).parent().focus();\n }\n }\n }\n ws.onopen = function() {\n console.log(\"connected\");\n if (typeof getDataIn !== 'undefined' && getOnly) clearInterval(getDataIn);\n if(getOnly){\n getDataIn=setInterval(executeQuery, 120000);\n getOnly=false;\n }\n }\n ws.onclose = function() {\n // console.log(\"re connecting\");\n setTimeout(wsConnect,3000);\n }\n ws.onerror = function(event){\n if (typeof getDataIn !== 'undefined' && !getOnly) clearInterval(getDataIn);\n if (!getOnly){\n getDataIn=setInterval(executeQuery, 2000);\n console.log('websocket error, activating get');\n console.log(getDataIn)\n getOnly=true;\n }\n }\n };\n \n \n function executeQuery() {\n $.ajax({\n url: 'lightcontrol?bfp='+$myFngrp,\n method: 'GET',\n ifModified:true,\n// dataType: 'JSON',\n headers: {\n// 'Authorization':'Bearer {{payload.pwd_str}}',\n 'Content-Type':'application/json',\n 'If-None-Match':$eTag\n },\n success: function(data,status, xhr) {\n if (xhr.status===200){\n var wink_obj=data;// JSON.parse(data);\n \n $eTag=xhr.getResponseHeader('Etag');\n // console.log(wink_obj.haveLights);\n var lights=wink_obj.lights;\n for(var i=0;i<lights.length;i++){\n var l_id='.panel-'+lights[i].object_id;\n var dial_name='.dial.'+lights[i].object_id;\n var btn_id='.radio-'+lights[i].object_id;\n if(lights[i].powered) \n {\n $(l_id).removeClass('panel-primary').addClass('panel-warning');\n $(btn_id+'-on').prop('checked',true).parent().addClass('active').siblings().removeClass(\"active\").blur();\n $(btn_id+'-of').removeAttr('checked').prop('checked',false).parent().removeClass('active').blur();\n if(lights[i].isColor){\n $(lights[i].clr_id).val(lights[i].Color);\n var btn_id=lights[i].clr_id.replace('clr','clr-btn');\n $(btn_id).css('background-color',lights[i].Color); \n }\n } else {\n $(l_id).removeClass('panel-warning').addClass('panel-primary');\n $(btn_id+'-of').prop('checked',true).parent().addClass('active').siblings().removeClass(\"active\").blur();\n $(btn_id+'-on').removeAttr('checked').prop('checked',false).parent().removeClass('active').blur();\n }\n webUpd=true;\n $(dial_name).val(lights[i].brightness).trigger(\"change\");\n webUpd=false;\n }\n }\n }\n });\n //setTimeout(executeQuery, 5000); // you could choose not to continue on failure...\n }\n\n $(document).ready(function() {\n $eTag=\"sasd12312sdfsdf=\";\n webUpd=false;\n getOnly=false;\n $myFngrp='';\n var fp=new Fingerprint2();\n fp.get(function(result){\n $myFngrp=btoa(result);\n executeQuery(); \n });\n // run the first time; all subsequent calls will take care of themselves\n //setInterval(executeQuery, 3000);\n if (\"WebSocket\" in window) wsConnect();\n else GetDataIn=setInterval(executeQuery,2000);\n// GetDataIn=setInterval(executeQuery, 120000);\n });\n</script>\n</body>\n</html>",
"x": 838,
"y": 514,
"wires": [
[
"bf863d7b.2f0c"
]
]
},
{
"id": "bf863d7b.2f0c",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 981,
"y": 550,
"wires": []
},
{
"id": "f68fc022.1a0aa",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 722,
"y": 1055,
"wires": []
},
{
"id": "f25e4566.f6cab8",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/getConfig",
"method": "get",
"swaggerDoc": "",
"x": 121,
"y": 1053,
"wires": [
[
"2c385652.a168ca"
]
]
},
{
"id": "2c385652.a168ca",
"type": "function",
"z": "1b96200.289cfe",
"name": "Throw Config Data",
"func": "if ('bfp' in msg.payload && context.global.getCookieVerified('exchange_token',msg.req.headers.cookie, msg.payload.bfp)==context.global.FREEBOARD_TOKEN){\n//if (true){\n// text fields array\nint_txt_fields=[];\ntxt_fields=[];\nif (!('PresenceShortcuts' in context.global)) context.global.PresenceShortcuts = true;\nmsg.payload.nr_url=context.global.BlueMixUrlBase;\nmsg.payload.IFTTT_TOKEN=context.global.IFTTT_TOKEN;\n\ncheckDevCap=function(dev_fields){\n var result=false;\n dev_fields.forEach(function(dev_field){\n if(dev_field.field=='vacation_mode_enabled' || dev_field.field=='alarm_mode'){\n result=true;\n }\n });\n return result;\n};\n\nint_txt_fields.push({\n type:\"text\",\n item:\"wink_id\",\n label:\"Wink Client ID\",\n isCheck:false,\n value : context.global.wink_id || \"\" \n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"wink_secret\",\n label:\"Wink Client Secret\",\n isCheck:false,\n value : context.global.wink_secret || \"\" \n});\n\n\nint_txt_fields.push({\n type:\"text\",\n item:\"lat\",\n label:\"Home Lattitude\",\n isCheck:false,\n value :('HomeLocation' in context.global ? context.global.HomeLocation.lat : \"\" )\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"lon\",\n label:\"Home Longtitude\",\n isCheck:false,\n value :('HomeLocation' in context.global ? context.global.HomeLocation.lon : \"\" )\n});\n\nint_txt_fields.push({\n type:\"text\", \n item:\"BlueMixUrlBase\",\n label:\"BlueMix URL base\",\n isCheck:false,\n value: context.global.BlueMixUrlBase || \"\" \n});\n\nint_txt_fields.push({\n type:\"text\", \n item:\"FREEBOARD_TOKEN\",\n label:\"Application Access Token\",\n isCheck:false,\n value: context.global.FREEBOARD_TOKEN || \"\" \n});\n\n\n\nint_txt_fields.push({\n type:\"text\",\n item:\"forecastIoApiKey\",\n label:\"Forecast.io API Key\",\n isCheck:false,\n value : context.global.forecastIoApiKey || \"\" \n});\n//txt_fields.push({\n// type:\"text\", \n// item:\"FREEBOARD_TOKEN\",\n// label:\"Freeboard Token\",\n// value: context.global.FREEBOARD_TOKEN || \"\" \n//});\nint_txt_fields.push({\n type:\"text\", \n item:\"IFTTT_TOKEN\",\n label:\"IFTTT Token\",\n isCheck:false,\n value: context.global.IFTTT_TOKEN || \"\" \n});\nint_txt_fields.push({\n type:\"text\",\n item:\"LIFX_TOKEN\",\n label:\"Lifx API Key\",\n isCheck:false,\n value: context.global.LIFX_TOKEN || \"\" \n});\nint_txt_fields.push({\n type:\"text\",\n item:\"InitialStateKey\",\n label:\"InitialState.com API Key\",\n isCheck:false,\n value: context.global.InitialStateKey ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"BloomskyKey\",\n label:\"Bloomsky API Key\",\n isCheck:false,\n value: context.global.BloomskyKey ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"PushBulletKey\",\n label:\"PushBullet API Key\",\n isCheck:false,\n value: context.global.PushBulletKey ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"PushBulletChannel\",\n label:\"PushBullet Channel Tag\",\n isCheck:false,\n value: context.global.PushBulletChannel ||\"\"\n});\n\n\n\nint_txt_fields.push({\n type:\"text\",\n item:\"BlueIrisHost\",\n label:\"Blue Iris url\",\n isCheck:false,\n value: context.global.BlueIrisHost ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"BlueIrisUid\",\n label:\"Blue Iris user Id\",\n isCheck:false,\n value: context.global.BlueIrisUid ||\"\"\n});\n\n\nint_txt_fields.push({\n type:\"password\",\n item:\"BlueIrisPwd\",\n label:\"Blue Iris user Password\",\n isCheck:false,\n value: context.global.BlueIrisPwd ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"OwnTracksPwd\",\n label:\"OwnTracks Personal Key\",\n isCheck:false,\n value: context.global.OwnTracksPwd ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"OwnTracksGeoRadius\",\n label:\"OwnTracks Home Geofence Radius (meters)\",\n isCheck:false,\n value: context.global.OwnTracksGeoRadius ||\"100\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"OwnTracksMaxAcc\",\n label:\"Max. Accuracy for position updates (meters)\",\n isCheck:false,\n value: context.global.OwnTracksMaxAcc ||\"100\"\n});\n\n\nint_txt_fields.push({\n type:\"checkbox\",\n item:\"OwnTracksIgnorePing\",\n label:\"Ignore Owntracks iPhone Ping events\",\n isCheck:true,\n value: context.global.OwnTracksIgnorePing || false\n});\n\n\nint_txt_fields.push({\n type:\"text\",\n item:\"SmartThingsSecret\",\n label:\"SmartThings secret key\",\n isCheck:false,\n value: context.global.SmartThingsSecret ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"SmartThingsApiToken\",\n label:\"SmartThings API Token\",\n isCheck:false,\n value: context.global.SmartThingsApiToken ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"SmartThingsApiEndPoint\",\n label:\"SmartThings API Endpoint\",\n isCheck:false,\n value: context.global.SmartThingsApiEndPoint ||\"\"\n});\n\nint_txt_fields.push({\n type:\"text\",\n item:\"GrafanaHostPort\",\n label:\"Grafana Server Host:Port\",\n isCheck:false,\n value: context.global.GrafanaHostPort ||\"\"\n});\n\n/*\nint_txt_fields.push({\n type:\"text\",\n item:\"OwnTracksHomeRegion\",\n label:\"OwnTracks Home region name\",\n isCheck:false,\n value: context.global.OwnTracksHomeRegion ||\"home\"\n});\n*/\n\n/*\nint_txt_fields.push({\n type:\"text\",\n item:\"OwnTracksGeoMaxAccuracy\",\n label:\"OwnTracks Max GPS Accuracy (meters)\",\n isCheck:false,\n value: context.global.OwnTracksGeoMaxAccuracy ||\"200\"\n});\n*/\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"motionAdjustTstat\",\n label:\"Motion affects thermostat\",\n isCheck:true,\n value: context.global.motionAdjustTstat || false\n});\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"HoursFormat24\",\n label:\"Use 24 hours time format\",\n isCheck:true,\n value: context.global.HoursFormat24 || false\n});\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"LightsNotification\",\n label:\"Show Light Changes in the log\",\n isCheck:true, \n value: context.global.LightsNotification || false\n});\ntxt_fields.push({\n type:\"checkbox\", \n item:\"LightsNotificationM\",\n label:\"Send Lights Notification via Pushbullet\",\n isCheck:true, \n value: context.global.LightsNotificationM || false\n});\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"SensorsNotificationM\",\n label:\"Send Sensors Notification via Pushbullet\",\n isCheck:true, \n value: context.global.SensorsNotificationM || false\n});\n\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"ifttt\",\n label:\"Send data to IFTTT\",\n isCheck:true, \n value: context.global.ifttt || false\n});\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"useRobots\",\n label:\"WNR Robots\",\n isCheck:true, \n value: context.global.useRobots || false\n});\n\n\ntxt_fields.push({\n type:\"checkbox\",\n item:\"PresenceShortcuts\",\n label:\"Execute Presence Shortcuts\",\n isCheck:true,\n value: context.global.PresenceShortcuts || false\n});\n\n\ntxt_fields.push({\n type:\"checkbox\",\n item:\"WinkLocalCtrl\",\n label:\"Use Wink Local Control (only for local Wink Node Red instance!)\",\n isCheck:true,\n value: context.global.use_wink_local_ctrl || false\n});\n\ntxt_fields.push({\n type:\"text\",\n item:\"CustomTabName\",\n label:\"Custom Tab Name\",\n value: context.global.CustomTabName ||\"\"\n});\n\ntxt_fields.push({\n type:\"text\",\n item:\"CustomTabUrl\",\n label:\"Custom Tab Url\",\n value: context.global.CustomTabUrl ||\"\"\n});\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"CleanNonWink\",\n label:\"Clear non-wink devices from cache\",\n isCheck:true, \n value: false\n});\n\ntxt_fields.push({\n type:\"checkbox\", \n item:\"CleanPresence\",\n label:\"Clear Presence entries\",\n isCheck:true, \n value: false\n});\n\n/*\ntxt_fields.push({\n type:\"text\",\n item:\"note_timeout\",\n label:\"Note message timeoue (white),sec\",\n value: context.global.note_timeout ||\"15\"\n});\n\ntxt_fields.push({\n type:\"text\",\n item:\"info_timeout\",\n label:\"Info message timeout (blue),sec\",\n value: context.global.info_timeout ||\"60\"\n});\n\ntxt_fields.push({\n type:\"text\",\n item:\"warning_timeout\",\n label:\"Warning message timeout (yellow)\",\n value: context.global.warning_timeout ||\"90\"\n});\n\ntxt_fields.push({\n type:\"text\",\n item:\"weather_timeout\",\n label:\"InitialState.com Api Key\",\n value: context.global.weather_timeout ||\"40\"\n});\n*/\nmsg.payload.int_txt_fields=int_txt_fields;\nmsg.payload.txt_fields=txt_fields;\nmsg.payload.scenes=[];\nfor (var s in context.global.winkState.scenes){\n var scene=context.global.winkState.scenes[s];\n if ('name' in scene && context.global.tab_ui_shortcuts){\n msg.payload.scenes.push({\n name:scene.name,\n id:scene.id,\n selected:('tab_ui_shortcuts' in context.global && context.global.tab_ui_shortcuts.indexOf(scene.name)!=-1 ? true : false)\n });\n } else node.warn(scene);\n}\nmsg.payload.vaca_settings=[];\n\nmsg.payload.vaca_settings.push({\n type:\"text\", \n item:\"vaca_delay\",\n label:\"Delay befor activation (minutes)\",\n value: context.global.vaca_delay || 15\n});\n\nif ('Presence' in context.global){\nmsg.payload.vaca_settings.push({\n type:\"checkbox\", \n item:\"vaca_usePresence\",\n label:\"Use Presence to turn mode off\",\n isCheck:true, \n value: context.global.vaca_usePresence || false\n});\n}\n/*\nmsg.payload.vaca_settings.push({\n type:\"checkbox\", \n item:\"vaca_wnr_schedules_off\",\n label:\"Turn WNR schedules off\",\n isCheck:true, \n value: context.global.vaca_wnr_schedules_off || false\n});\n*/\nvar VacModeLock=false;\nif('winkState' in context.global && 'winkDevCap' in context.global && 'locks' in context.global.winkState){\n for (var l in context.global.winkState.locks){\n var fields=context.global.winkDevCap[l].fields;\n if (checkDevCap(fields)) { \n VacModeLock=true; \n break;\n }\n }\n}\nif (VacModeLock){\n msg.payload.vaca_settings.push({\n type:\"checkbox\", \n item:\"vaca_locks_vac\",\n label:\"Turn on locks vacation mode\",\n isCheck:true, \n value: context.global.vaca_locks_vac || false\n });\n}\n\nmsg.payload.vaca_light_bulbs=[];\nfor (var l in context.global.winkState.light_bulbs){\n var light=context.global.winkState.light_bulbs[l];\n if ('name' in light){\n msg.payload.vaca_light_bulbs.push({\n name:light.name,\n id:light.id,\n selected:('vaca_light_bulbs' in context.global && context.global.vaca_light_bulbs.indexOf(light.name)!=-1 ? true : false)\n });\n } else node.warn(light);\n}\n\nfor (var l in context.global.winkState.binary_switches){\n var light=context.global.winkState.binary_switches[l];\n if ('name' in light){\n msg.payload.vaca_light_bulbs.push({\n name:light.name,\n id:light.id,\n selected:('vaca_light_bulbs' in context.global && context.global.vaca_light_bulbs.indexOf(light.name)!=-1 ? true : false)\n });\n } else node.warn(light);\n} \nif ('groups' in context.global.winkState){\n msg.payload.vaca_groups=[];\n for (var g in context.global.winkState.groups){\n var group=context.global.winkState.groups[g];\n if ('name' in group){\n msg.payload.vaca_groups.push({\n name:group.name,\n id:group.id,\n selected:('vaca_groups' in context.global && context.global.vaca_groups.indexOf(group.name)!=-1 ? true : false)\n });\n } else node.warn(group);\n }\n}\n\ncolor_modes=['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'random'];\n\nmsg.payload.holiday_settings=[];\n\nmsg.payload.holiday_settings.push({\n type:\"text\", \n item:\"holiday_keep_color\",\n label:\"Delay befor color change (seconds) group 1\",\n value: context.global.holiday_keep_color || 30\n});\n\n msg.payload.holiday_settings.push({\n type:\"checkbox\", \n item:\"holiday_mode_group\",\n label:\"Same Color for all bulbs group 1\",\n isCheck:true, \n value: context.global.holiday_mode_group || false\n });\n\nmsg.payload.holiday_settings.push({\n type:\"text\", \n item:\"holiday_keep_color2\",\n label:\"Delay befor color change (seconds) group 2\",\n value: context.global.holiday_keep_color2 || 30\n});\n\n msg.payload.holiday_settings.push({\n type:\"checkbox\", \n item:\"holiday_mode_group2\",\n label:\"Same Color for all bulbs group2\",\n isCheck:true, \n value: context.global.holiday_mode_group2 || false\n });\nmsg.payload.holiday_settings.push({\n type:\"text\", \n item:\"holiday_keep_color3\",\n label:\"Delay befor color change (seconds) group 3\",\n value: context.global.holiday_keep_color3 || 30\n});\n\n msg.payload.holiday_settings.push({\n type:\"checkbox\", \n item:\"holiday_mode_group3\",\n label:\"Same Color for all bulbs group 3\",\n isCheck:true, \n value: context.global.holiday_mode_group3 || false\n });\n\n\n\nmsg.payload.holiday_light_bulbs=[];\nfor (var l in context.global.winkState.light_bulbs){\n var light=context.global.winkState.light_bulbs[l];\n if ('name' in light && 'hue' in light){\n msg.payload.holiday_light_bulbs.push({\n name:light.name,\n id:light.id,\n selected:('holiday_light_bulbs' in context.global && context.global.holiday_light_bulbs.indexOf(light.name)!=-1 ? true : false)\n });\n }\n}\nmsg.payload.holiday_light_mode=[];\nfor (var l in color_modes){\n var light=color_modes[l];\n msg.payload.holiday_light_mode.push({\n name:light,\n id:l,\n selected:('holiday_light_mode' in context.global && context.global.holiday_light_mode==light ? true : false)\n });\n}\n\nmsg.payload.holiday_light_bulbs2=[];\nfor (var l in context.global.winkState.light_bulbs){\n var light=context.global.winkState.light_bulbs[l];\n if ('name' in light && 'hue' in light){\n msg.payload.holiday_light_bulbs2.push({\n name:light.name,\n id:light.id,\n selected:('holiday_light_bulbs2' in context.global && context.global.holiday_light_bulbs2.indexOf(light.name)!=-1 ? true : false)\n });\n }\n}\nmsg.payload.holiday_light_mode2=[];\nfor (var l in color_modes){\n var light=color_modes[l];\n msg.payload.holiday_light_mode2.push({\n name:light,\n id:l,\n selected:('holiday_light_mode2' in context.global && context.global.holiday_light_mode2==light ? true : false)\n });\n}\n\nmsg.payload.holiday_light_bulbs3=[];\nfor (var l in context.global.winkState.light_bulbs){\n var light=context.global.winkState.light_bulbs[l];\n if ('name' in light && 'hue' in light){\n msg.payload.holiday_light_bulbs3.push({\n name:light.name,\n id:light.id,\n selected:('holiday_light_bulbs3' in context.global && context.global.holiday_light_bulbs3.indexOf(light.name)!=-1 ? true : false)\n });\n }\n}\nmsg.payload.holiday_light_mode3=[];\nfor (var l in color_modes){\n var light=color_modes[l];\n msg.payload.holiday_light_mode3.push({\n name:light,\n id:l,\n selected:('holiday_light_mode3' in context.global && context.global.holiday_light_mode3==light ? true : false)\n });\n}\n\n\n msg.payload.holiday_settings.push({\n type:\"checkbox\", \n item:\"holiday_mode_on\",\n label:\"Mode Active\",\n isCheck:true, \n value: context.global.holiday_mode_on || false\n });\n\ntxt_area_fields=[];\n\ntxt_area_fields.push({FosCam : JSON.stringify(context.global.foscam || \"\")});\ntxt_area_fields.push({SamsungCam : JSON.stringify(context.global.SamsungCam || \"\")});\ntxt_area_fields.push({DlinkCam : JSON.stringify(context.global.DlinkCam || \"\")});\ntxt_area_fields.push({camera_motion : JSON.stringify(context.global.camera_motion || \"\")});\n//txt_area_fields.push({tab_ui_shortcuts : JSON.stringify(context.global.tab_ui_shortcuts || \"\")});\nmsg.payload.txt_area_fields=txt_area_fields;\n\nmsg.statusCode=\"200\";\nreturn msg;\n}\nelse\n{\n //msg.payload=\"Not Authorized\";\n msg.statusCode=\"403\";\n return msg;\n// msg.res.send(\"403\",\"Forbidden\");\n// return;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 377.4999694824219,
"y": 1052,
"wires": [
[
"871398d1.127e68"
]
]
},
{
"id": "77f849d.b2795b8",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/save_cfg",
"method": "post",
"swaggerDoc": "",
"x": 125,
"y": 1108,
"wires": [
[
"640aa911.c10748",
"f0372d08.72d52"
]
]
},
{
"id": "640aa911.c10748",
"type": "function",
"z": "1b96200.289cfe",
"name": "",
"func": "if (msg.payload.token ==context.global.FREEBOARD_TOKEN || context.global.getCookie('exchange_token',msg.req.headers.cookie)==context.global.FREEBOARD_TOKEN){\n msg.statusCode=200;\n context.global.tab_ui_shortcuts=[];\n for (var v in msg.payload){\n if (v=='tab_ui_shortcuts' && !Array.isArray(msg.payload.tab_ui_shortcuts)) {\n context.global.tab_ui_shortcuts[0]=msg.payload.tab_ui_shortcuts; \n }\n else context.global.tab_ui_shortcuts=msg.payload.tab_ui_shortcuts;\n \n if (v=='FREEBOARD_TOKEN' && msg.payload.FREEBOARD_TOKEN==='') msg.payload.FREEBOARD_TOKEN=context.global.generate_token('FREEBOARD_TOKEN');\n if (v=='lat'){\n if (typeof (context.global.HomeLocation) === 'undefined') context.global.HomeLocation={};\n context.global.HomeLocation.lat=msg.payload['lat'];\n } else if (v=='lon'){\n if (typeof (context.global.HomeLocation) === 'undefined') context.global.HomeLocation={};\n context.global.HomeLocation.lon=msg.payload['lon'];\n }\n else context.global[v]=msg.payload[v];\n }\n if (!('motionAdjustTstat' in msg.payload)) context.global.motionAdjustTstat=false;\n else context.global.motionAdjustTstat=true;\n if (!('HoursFormat24' in msg.payload)) context.global.HoursFormat24=false;\n else context.global.HoursFormat24=true;\n \n if (!('LightsNotification' in msg.payload)) context.global.LightsNotification=false;\n else context.global.LightsNotification=true;\n \n if (!('LightsNotificationM' in msg.payload)) context.global.LightsNotificationM=false;\n else context.global.LightsNotificationM=true;\n \n if (!('useRobots' in msg.payload)) context.global.useRobots=false;\n else context.global.useRobots=true;\n \n if (!('SensorsNotificationM' in msg.payload)) context.global.SensorsNotificationM=false;\n else context.global.SensorsNotificationM=true;\n \n if (!('vaca_usePresence' in msg.payload)) context.global.vaca_usePresence=false;\n else context.global.vaca_usePresence=true; \n \n if (!('vaca_wnr_schedules_off' in msg.payload)) context.global.vaca_wnr_schedules_off=false;\n else context.global.vaca_wnr_schedules_off=true;\n\n if (!('vaca_locks_vac' in msg.payload)) context.global.vaca_locks_vac=false;\n else context.global.vaca_locks_vac=true;\n \n if (!('OwnTracksIgnorePing' in msg.payload)) context.global.OwnTracksIgnorePing=false;\n else context.global.OwnTracksIgnorePing=true;\n \n if (!('PresenceShortcuts' in msg.payload)) context.global.PresenceShortcuts=false;\n else context.global.PresenceShortcuts=true;\n \n if (!('WinkLocalCtrl' in msg.payload)) context.global.use_wink_local_ctrl=false;\n else context.global.use_wink_local_ctrl=true;\n \n if('CleanNonWink' in msg.payload){\n context.global.cleanNonWinkState();\n context.global.CleanNonWink=false;\n }\n if('CleanPresence' in msg.payload){\n context.global.Presence={};\n context.global.CleanPresence=false;\n }\n if (!('holiday_mode_on' in msg.payload)) context.global.holiday_mode_on=false;\n else context.global.holiday_mode_on=true; \n if (!('holiday_mode_group' in msg.payload)) context.global.holiday_mode_group=false;\n else context.global.holiday_mode_group=true;\n if (!('holiday_mode_group2' in msg.payload)) context.global.holiday_mode_group2=false;\n else context.global.holiday_mode_group2=true;\n if (!('holiday_mode_group3' in msg.payload)) context.global.holiday_mode_group3=false;\n else context.global.holiday_mode_group3=true; \n\n if (!('vaca_light_bulbs' in msg.payload)) context.global.vaca_light_bulbs=[]; \n if (!('holiday_light_bulbs' in msg.payload)) context.global.holiday_light_bulbs=[];\n if (!('holiday_light_bulbs2' in msg.payload)) context.global.holiday_light_bulbs2=[];\n if (!('holiday_light_bulbs3' in msg.payload)) context.global.holiday_light_bulbs3=[];\n}\nmsg.url=context.global.BlueMixUrlBase+'/red/update_app_cfg';\nmsg.method=\"POST\";\nmsg.headers= {\n \"Authorization\":\"Bearer \"+context.global.FREEBOARD_TOKEN\n};\nmsg.payload={\n db_mode:\"update\"\n}\nnode.send(msg)\n\n\n",
"outputs": "1",
"noerr": 0,
"x": 344,
"y": 1109,
"wires": [
[
"358c52ac.4bedfe",
"2eb17f38.5d2a1"
]
]
},
{
"id": "358c52ac.4bedfe",
"type": "http response",
"z": "1b96200.289cfe",
"name": "",
"x": 524,
"y": 1144,
"wires": []
},
{
"id": "2eb17f38.5d2a1",
"type": "http request",
"z": "1b96200.289cfe",
"name": "",
"method": "use",
"ret": "txt",
"url": "",
"x": 551,
"y": 1097,
"wires": [
[]
]
},
{
"id": "46c5a495.b6a0ac",
"type": "http in",
"z": "1b96200.289cfe",
"name": "",
"url": "/freeboard/MySummaryJson",
"method": "get",
"swaggerDoc": "",
"x": 159,
"y": 270,
"wires": [
[
"ff712132.3aad6"
]