Last modified by Hera Guo on 2024/11/11 17:08

From version 31.1
edited by Hera Guo
on 2024/11/06 13:59
Change comment: There is no comment for this version
To version 15.1
edited by Hera Guo
on 2024/11/04 15:11
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -57,7 +57,7 @@
57 57  
58 58  **device:**This section displays the specific information collected by the device, and different types of sensors have different display interfaces
59 59  
60 -[[image:屏幕截图 2024-11-04 134645.png]]
60 +[[image:1730699212334-960.png]]
61 61  
62 62  First floor:
63 63  
... ... @@ -82,9 +82,8 @@
82 82  
83 83  High Temperature、Low Temperature、High humidity、Low humidity、Low voltage、Device Disconnected
84 84  
85 -[[image:1730854677036-426.png]]
85 +[[image:1730699566023-958.png]]
86 86  
87 -
88 88  = 4.configuration details =
89 89  
90 90  After understanding the architecture and layering of the complete project, we can start configuring it
... ... @@ -91,988 +91,17 @@
91 91  
92 92  == 4.1 Dashboard configuration details ==
93 93  
94 -=== 4.1.1.Data source (Entity aliases) ===
93 +1、Configure the interface of the third layer Davies.
95 95  
96 -detail:Obtain data based on dashboard status
97 97  
98 -[[image:1730709424998-915.png||height="729" width="1436"]]
96 +2、Configure the interface of the second layer asset
99 99  
100 -Alarm:Obtain alarm information
101 101  
102 -[[image:1730709479828-595.png||height="696" width="1435"]]
99 +3、Configure the first layer menu interface
103 103  
104 -Dragino&GXHL,Ltd:Obtain data through asset types
105 105  
106 -[[image:1730709511861-439.png||height="714" width="1435"]]
107 -
108 -Selected Supermarket:Retrieve devices by device type
109 -
110 -[[image:1730709527720-418.png||height="751" width="1433"]]
111 -
112 -Supermarket Devices:Obtain data through device type
113 -
114 -[[image:1730709555797-383.png||height="726" width="1434"]]
115 -
116 -LHT65N Device:Obtain data based on device type
117 -
118 -[[image:1730857191863-514.png||height="725" width="1433"]]
119 -
120 -=== 4.1.2.Page Configuration ===
121 -
122 -==== 4.1.2.1、Configure the interface of the third layer Davies. ====
123 -
124 -==== 4.1.2.2、Configure the interface of the second layer asset ====
125 -
126 -===== 4.1.2.2.1 Equipment distribution diagram: =====
127 -
128 -**Data:**
129 -
130 -[[image:1730770392454-317.png||height="745" width="1439"]]
131 -
132 -**Appearannce:**In this module, we need to arrange our devices in the corresponding positions and use icons to display our devices. Therefore, in the Appearance interface, we need to configure them
133 -
134 -**Tooltip function:**This module displays the current information of the device
135 -
136 -[[image:1730857537965-184.png]]
137 -
138 -{{code language="none"}}
139 -var msg = data
140 -if(msg.Label=="gateway" && msg.type == "gateway"){
141 - var stauts
142 - if (msg.gatewaystauts=="true"){
143 - stauts = "Connect"
144 - }
145 - else{
146 - stauts = "Disconnected"
147 - }
148 - var str = "<b>"+msg.entityName+"</b><br/><b>"+stauts+"</b><br/>"
149 - return str
150 -}
151 -else if(msg.type=="gxhl01" && msg.Label!="gateway"){
152 - var str = "<b>"+msg.entityName+"</b><br/><b>"+msg.Label+"</b><br/><b>Bat:</b>"+msg.BatV+"V<br/><b>Temperature:</b>"+ msg.TempC_SHT+ "°C<br/><b>Humidity:</b>"+msg.Hum_SHT+"%"
153 - return str
154 -}
155 -else{
156 - var str = "<b>"+msg.entityName+"</b><br/><b>"+msg.Label+"</b><br/><b>Bat:</b>"+msg.BatV+"V<br/><b>Temperature:</b>"+ msg.temperature+ "°C<br/><b>Humidity:"+msg.humidity+"%"+"</b><br/>"+
157 - "<b>Co2:"+msg.co2+"</b></br><b>Air_Pressure:"+msg.air_pressure
158 -
159 - return str
160 -}
161 -{{/code}}
162 -
163 -(% class="wikigeneratedid" id="HMarkerimagefunctionFF1A" %)
164 -**Marker image function:**This module can display different icons based on different types of sensors and their status to achieve its functionality
165 -
166 -(% class="wikigeneratedid" %)
167 -[[image:1730857750749-240.png]]
168 -
169 -{{code language="none"}}
170 -var res
171 -var msg = data
172 -if(msg.Label=="gateway" && msg.type=="gateway"){
173 - if (msg.gatewaystauts == "true"){
174 - res = {
175 - url: images[3],
176 - size: 40
177 -}
178 -}
179 -else{
180 - res = {
181 - url: images[2],
182 - size: 40
183 -}
184 -}}
185 -else if(msg.Label!="gateway" && msg.type=="gxhl01" ){
186 - if (msg.active=="false"){
187 - res = {
188 - url: images[1],
189 - size: 40
190 -}}
191 -else{
192 - res = {
193 - url: images[0],
194 - size: 40
195 -}
196 -}
197 -}
198 -else if(msg.type=="LWL02"){
199 - if (msg.WATER_LEAK_STATUS=="0"){
200 - res = {
201 - url: images[6],
202 - size: 40
203 -}}
204 -else{
205 - res = {
206 - url: images[7],
207 - size: 40
208 -}
209 -}
210 -}
211 -else if(msg.type=="LDS02"){
212 - if (msg.DOOR_OPEN_STATUS=="0"){
213 - res = {
214 - url: images[5],
215 - size: 40
216 -}}
217 -else{
218 - res = {
219 - url: images[8],
220 - size: 40
221 -}
222 -}
223 -}
224 -else if(msg.type=="LDS12"){
225 - res = {
226 - url: images[10],
227 - size: 40
228 -}}
229 -else if(msg.type=="SE01"){
230 - res = {
231 - url: images[9],
232 - size: 40
233 -}}
234 -else if(msg.type=="PB01"){
235 - res = {
236 - url: images[11],
237 - size: 40
238 -}}
239 -else if(msg.type=="S31b"){
240 - res = {
241 - url: images[12],
242 - size: 40
243 -}}
244 -else if(msg.type=="LHT65N"){
245 - res = {
246 - url: images[13],
247 - size: 40
248 -}}
249 -else{
250 - res = {
251 - url: images[4],
252 - size: 40
253 -}
254 -}
255 -return res;
256 -{{/code}}
257 -
258 -(% class="wikigeneratedid" id="H" %)
259 -[[image:1730770875793-351.png]]
260 -
261 -(% class="wikigeneratedid" id="HActions" %)
262 -**Actions:**We need to implement the function of entering the details interface through the corresponding device icon, so in this module, we need to add actions to achieve redirection
263 -
264 -{{code language="none"}}
265 -var entitySubType;
266 -var $injector = widgetContext.$scope.$injector;
267 -$injector.get(widgetContext.servicesMap.get('entityService')).getEntity(entityId.entityType, entityId.id)
268 - .subscribe(function(data) {
269 - entitySubType = data.type;
270 - console.log(entitySubType)
271 - if (entitySubType == 'gateway') {
272 - openDashboardStates('gateway_detail');
273 - } else if (entitySubType == 'gxhl01') {
274 - openDashboardStates('detail');
275 - }
276 - else if(entitySubType == 'AQS01-dragino-office'){
277 - openDashboardStates("aqs01_detail")
278 - }
279 - else if (entitySubType == 'LDS12') {
280 - openDashboardStates('lds12_detail');
281 - }
282 - else if (entitySubType == 'LDS02') {
283 - openDashboardStates('lds02_detail');
284 - }
285 - else if (entitySubType == 'SE01') {
286 - openDashboardStates('se01_detail');
287 - }
288 - else if (entitySubType == 'PB01') {
289 - openDashboardStates('pb01_detail');
290 - }
291 - else if (entitySubType == 'LWL02') {
292 - openDashboardStates('lwl02_detail');
293 - }
294 - else if (entitySubType == 'LPS8N') {
295 - openDashboardStates('lps8n_detail');
296 - }
297 - else if (entitySubType == 'LHT65N') {
298 - openDashboardStates('lht65n_detail');
299 - }
300 - else if (entitySubType == 'S31b') {
301 - openDashboardStates('s31b_detail');
302 - }
303 - });
304 -
305 -function openDashboardStates(statedId) {
306 - var stateParams = widgetContext.stateController.getStateParams();
307 - var params = {
308 - entityId: entityId,
309 - entityName: entityName
310 - };
311 -
312 - if (stateParams.city) {
313 - params.city = stateParams.city;
314 - }
315 -
316 - widgetContext.stateController.openState(statedId, params, false);
317 -}
318 -
319 -{{/code}}
320 -
321 -[[image:1730771103096-522.png]]
322 -
323 -===== 4.1.2.2.2 Device List =====
324 -
325 -(% class="wikigeneratedid" id="HDataFF1A" %)
326 -**Data:**
327 -
328 -[[image:1730771199343-553.png]]
329 -
330 -**Actions:**Equipment distribution diagram: In this module, functions need to be implemented such as adding devices, editing devices, deleting devices, and jumping to the device details page. Therefore, the following actions need to be added:
331 -
332 -[[image:1730771228766-212.png]]
333 -
334 -(% class="wikigeneratedid" id="HEditdeviceFF1A" %)
335 -Edit device:Implementation function: Device editing
336 -
337 -[[image:1730771256045-238.png]]
338 -
339 -{{code language="none"}}
340 -let $injector = widgetContext.$scope.$injector;
341 -let customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));
342 -let deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));
343 -let attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));
344 -
345 -openEditDeviceDialog();
346 -
347 -function openEditDeviceDialog() {
348 - customDialog.customDialog(htmlTemplate, EditDeviceDialogController).subscribe();
349 -}
350 -
351 -function EditDeviceDialogController(instance) {
352 - let vm = instance;
353 -
354 - vm.device = null;
355 - vm.attributes = {};
356 -
357 - vm.editDeviceFormGroup = vm.fb.group({
358 - deviceName: ['', [vm.validators.required]],
359 - deviceType: ['', [vm.validators.required]],
360 - deviceLabel: [''],
361 - attributes: vm.fb.group({
362 - latitude: [null],
363 - longitude: [null]
364 - })
365 - });
366 -
367 - vm.cancel = function() {
368 - vm.dialogRef.close(null);
369 - };
370 -
371 - vm.save = function() {
372 - vm.editDeviceFormGroup.markAsPristine();
373 - if (vm.editDeviceFormGroup.get('deviceType').value !== vm.device.type) {
374 - delete vm.device.deviceProfileId;
375 - }
376 - vm.device.name = vm.editDeviceFormGroup.get('deviceName').value,
377 - vm.device.type = vm.editDeviceFormGroup.get('deviceType').value,
378 - vm.device.label = vm.editDeviceFormGroup.get('deviceLabel').value
379 - deviceService.saveDevice(vm.device).subscribe(
380 - function () {
381 - saveAttributes().subscribe(
382 - function () {
383 - widgetContext.updateAliases();
384 - vm.dialogRef.close(null);
385 - }
386 - );
387 - }
388 - );
389 - };
390 -
391 - getEntityInfo();
392 -
393 - function getEntityInfo() {
394 - deviceService.getDevice(entityId.id).subscribe(
395 - function (device) {
396 - attributeService.getEntityAttributes(entityId, 'SERVER_SCOPE',
397 - ['latitude', 'longitude']).subscribe(
398 - function (attributes) {
399 - for (let i = 0; i < attributes.length; i++) {
400 - vm.attributes[attributes[i].key] = attributes[i].value;
401 - }
402 - vm.device = device;
403 - vm.editDeviceFormGroup.patchValue(
404 - {
405 - deviceName: vm.device.name,
406 - deviceType: vm.device.type,
407 - deviceLabel: vm.device.label,
408 - attributes: {
409 - latitude: vm.attributes.latitude,
410 - longitude: vm.attributes.longitude
411 - }
412 - }, {emitEvent: false}
413 - );
414 - }
415 - );
416 - }
417 - );
418 - }
419 -
420 - function saveAttributes() {
421 - let attributes = vm.editDeviceFormGroup.get('attributes').value;
422 - let attributesArray = [];
423 - for (let key in attributes) {
424 - attributesArray.push({key: key, value: attributes[key]});
425 - }
426 - if (attributesArray.length > 0) {
427 - return attributeService.saveEntityAttributes(entityId, 'SERVER_SCOPE', attributesArray);
428 - } else {
429 - return widgetContext.rxjs.of([]);
430 - }
431 - }
432 -}
433 -{{/code}}
434 -
435 -(% class="wikigeneratedid" id="H" %)
436 -Delete device:Implementation function: Device deletion
437 -
438 -[[image:1730771318657-502.png]]
439 -
440 -{{code language="none"}}
441 -let $injector = widgetContext.$scope.$injector;
442 -let dialogs = $injector.get(widgetContext.servicesMap.get('dialogs'));
443 -let deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));
444 -
445 -openDeleteDeviceDialog();
446 -
447 -function openDeleteDeviceDialog() {
448 - let title = "Are you sure you want to delete the device " + entityName + "?";
449 - let content = "Be careful, after the confirmation, the device and all related data will become unrecoverable!";
450 - dialogs.confirm(title, content, 'Cancel', 'Delete').subscribe(
451 - function (result) {
452 - if (result) {
453 - deleteDevice();
454 - }
455 - }
456 - );
457 -}
458 -
459 -function deleteDevice() {
460 - deviceService.deleteDevice(entityId.id).subscribe(
461 - function () {
462 - widgetContext.updateAliases();
463 - }
464 - );
465 -}
466 -
467 -{{/code}}
468 -
469 -jump:Implementation function: Jump to the device details page
470 -
471 -[[image:1730771386258-676.png]]
472 -
473 -{{code language="none"}}
474 -console.log(entityName)
475 -var entitySubType;
476 -var $injector = widgetContext.$scope.$injector;
477 -//console.log($injector)
478 -$injector.get(widgetContext.servicesMap.get('entityService')).getEntity(entityId.entityType, entityId.id)
479 - .subscribe(function(data) {
480 - console.log(data)
481 - entitySubType = data.type;
482 - console.log(entitySubType)
483 - if (entitySubType == 'AQS01-dragino-office') {
484 - openDashboardStates('aqs01_detail');
485 - }else if (entitySubType == 'gateway') {
486 - openDashboardStates('gateway_detail');
487 - } else if (entitySubType == 'gxhl01') {
488 - openDashboardStates('detail');
489 -
490 - } else if (entitySubType == 'tank-type1') {
491 - openDashboardStates('test1');
492 - }
493 - else if (entitySubType == 'LDS12') {
494 - openDashboardStates('lds12_detail');
495 - }
496 - else if (entitySubType == 'LDS02') {
497 - openDashboardStates('lds02_detail');
498 - }
499 - else if (entitySubType == 'SE01') {
500 - openDashboardStates('se01_detail');
501 - }
502 - else if (entitySubType == 'PB01') {
503 - openDashboardStates('pb01_detail');
504 - }
505 - else if (entitySubType == 'LWL02') {
506 - openDashboardStates('lwl02_detail');
507 - }
508 - else if (entitySubType == 'LPS8N') {
509 - openDashboardStates('lps8n_detail');
510 - }
511 - else if (entitySubType == 'LHT65N') {
512 - openDashboardStates('lht65n_detail');
513 - }
514 - else if (entitySubType == 'S31b') {
515 - openDashboardStates('s31b_detail');
516 - }
517 - });
518 -
519 -function openDashboardStates(statedId) {
520 - var stateParams = widgetContext.stateController.getStateParams();
521 - //console.log(stateParams)
522 - var params = {
523 - entityId: entityId,
524 - entityName: entityName
525 - };
526 - widgetContext.stateController.updateState(statedId, params, false);
527 -}
528 -{{/code}}
529 -
530 -(% class="wikigeneratedid" id="H-1" %)
531 -Add device:Implementation function: Add device
532 -
533 -[[image:1730771441589-122.png]]
534 -
535 -{{code language="none"}}
536 -let $injector = widgetContext.$scope.$injector;
537 -let customDialog = $injector.get(widgetContext.servicesMap.get('customDialog'));
538 -let deviceService = $injector.get(widgetContext.servicesMap.get('deviceService'));
539 -let attributeService = $injector.get(widgetContext.servicesMap.get('attributeService'));
540 -
541 -openAddDeviceDialog();
542 -
543 -function openAddDeviceDialog() {
544 - customDialog.customDialog(htmlTemplate, AddDeviceDialogController).subscribe();
545 -}
546 -
547 -function AddDeviceDialogController(instance) {
548 - let vm = instance;
549 -
550 - vm.addDeviceFormGroup = vm.fb.group({
551 - deviceName: ['', [vm.validators.required]],
552 - deviceType: ['', [vm.validators.required]],
553 - deviceLabel: [''],
554 - attributes: vm.fb.group({
555 - latitude: [null],
556 - longitude: [null]
557 - })
558 - });
559 -
560 - vm.cancel = function() {
561 - vm.dialogRef.close(null);
562 - };
563 -
564 - vm.save = function() {
565 - vm.addDeviceFormGroup.markAsPristine();
566 - let device = {
567 - name: vm.addDeviceFormGroup.get('deviceName').value,
568 - type: vm.addDeviceFormGroup.get('deviceType').value,
569 - label: vm.addDeviceFormGroup.get('deviceLabel').value
570 - };
571 - deviceService.saveDevice(device).subscribe(
572 - function (device) {
573 - saveAttributes(device.id).subscribe(
574 - function () {
575 - widgetContext.updateAliases();
576 - vm.dialogRef.close(null);
577 - }
578 - );
579 - }
580 - );
581 - };
582 -
583 - function saveAttributes(entityId) {
584 - let attributes = vm.addDeviceFormGroup.get('attributes').value;
585 - let attributesArray = [];
586 - for (let key in attributes) {
587 - attributesArray.push({key: key, value: attributes[key]});
588 - }
589 - if (attributesArray.length > 0) {
590 - return attributeService.saveEntityAttributes(entityId, "SERVER_SCOPE", attributesArray);
591 - } else {
592 - return widgetContext.rxjs.of([]);
593 - }
594 - }
595 -}
596 -{{/code}}
597 -
598 -==== ====
599 -
600 -===== **4.1.2.2.3 Asset Alarm:** =====
601 -
602 -**Data:**
603 -
604 -[[image:1730771504586-433.png]]
605 -
606 -==== 4.1.2.3、Configure the first layer menu interface ====
607 -
608 -===== 4.1.2.3.1 **Map:** =====
609 -
610 -**Data:**
611 -
612 -[[image:1730710271230-716.png||height="729" width="1427"]]
613 -
614 -Actions:The map interface has two actions, among which Select supermarket can refresh the device list and related alarms on the right side to enter the location, and Supermarket_detail can jump to the second level physical interface to view the details of the location based on the selected location
615 -
616 -[[image:1730710850458-781.png||height="770" width="1429"]]
617 -
618 -Select supermarket:Implementation function: Refresh the side page
619 -
620 -{{code language="none"}}
621 -var params = widgetContext.stateController.getStateParams();
622 -var selectedSupermarket = params['selectedSupermarket'];
623 -if (selectedSupermarket && selectedSupermarket.entityId.id === entityId.id) {
624 - params['selectedSupermarket'] = null;
625 -} else {
626 - params['selectedSupermarket'] = { entityId: entityId, entityName: entityName, entityLabel: entityLabel };
627 -}
628 -widgetContext.stateController.updateState(null, params);
629 -{{/code}}
630 -
631 -[[image:1730710875401-848.png||height="767" width="1429"]]
632 -
633 -Supermarket_detail:Implementation function: Jump to the asset details page
634 -
635 -{{code language="none"}}
636 -var params = JSON.parse(JSON.stringify(widgetContext.stateController.getStateParams()));
637 -params['selectedSupermarket'] = {
638 - entityId: entityId,
639 - entityName: entityName,
640 - entityLabel: entityLabel,
641 -};
642 -params['targetEntityParamName'] = 'selectedSupermarket';
643 -params['selectedDevice'] = null;
644 -
645 -widgetContext.stateController.openState('svgmap', params);
646 -{{/code}}
647 -
648 -[[image:1730710990334-601.png||height="772" width="1433"]]
649 -
650 -* (((
651 -In this demo, exclusive map icons were set as follows:
652 -)))
653 -
654 -{{code language="none"}}
655 -var res = {
656 - url: images[0],
657 - size: 66
658 -};
659 -return res;
660 -{{/code}}
661 -
662 -[[image:1730710395303-672.png||height="771" width="1438"]]
663 -
664 -===== 4.1.2.3.1 Asset List: =====
665 -
666 -**Data:**
667 -
668 -[[image:1730710693066-349.png||height="772" width="1439"]]
669 -
670 -Actions:The Assets List interface has an action, which is the same as the Supermarket_details in the Map. You can jump to the second level entity interface to view the details of the selected location based on its location
671 -
672 -[[image:1730712335338-750.png||height="751" width="1423"]]
673 -
674 -[[image:1730712473941-913.png||height="781" width="1422"]]
675 -
676 -All Alarms:
677 -
678 -[[image:1730712539209-554.png||height="764" width="1424"]]
679 -
680 680  == 4.2 Alarm configuration details ==
681 681  
682 -=== 4.2.1 High temperature ===
683 -
684 -Creat:
685 -
686 -[[image:1730862483514-101.png||height="750" width="1407"]]
687 -
688 -Clear:
689 -
690 -[[image:1730862584519-902.png||height="758" width="1404"]]
691 -
692 -=== 4.2.2 Low Temperature ===
693 -
694 -Creat:
695 -
696 -[[image:1730863708259-750.png||height="752" width="1403"]]
697 -
698 -Clear:
699 -
700 -[[image:1730863750414-979.png||height="746" width="1403"]]
701 -
702 -=== 4.2.3 High humidity ===
703 -
704 -Creat:
705 -
706 -[[image:1730864045747-876.png||height="752" width="1396"]]
707 -
708 -Clear:
709 -
710 -[[image:1730864077395-395.png||height="735" width="1393"]]
711 -
712 -=== 4.2.4 Low humidity ===
713 -
714 -Creat:
715 -
716 -[[image:1730864117808-484.png||height="741" width="1392"]]
717 -
718 -Clear:
719 -
720 -[[image:1730864159071-895.png||height="745" width="1392"]]
721 -
722 -=== 4.2.5 Low voltage ===
723 -
724 -Creat:
725 -
726 -[[image:1730864207037-477.png||height="740" width="1388"]]
727 -
728 -Clear:
729 -
730 -[[image:1730864250506-111.png||height="735" width="1389"]]
731 -
732 -=== 4.2.6 Device Disconnected ===
733 -
734 -Creat:
735 -
736 -[[image:1730864293216-991.png||height="739" width="1387"]]
737 -
738 -Clear:
739 -
740 -[[image:1730864331859-740.png||height="735" width="1385"]]
741 -
742 742  == 4.3 Rule chain configuration details ==
743 743  
744 -[[image:1730864784118-474.png]]
745 -
746 -**Script:**Email configuration for sending device alarm information
747 -
748 -[[image:1730864676542-406.png||height="732" width="1384"]]
749 -
750 -{{code language="none"}}
751 -function locatime(timenumber){
752 - var date = new Date(timenumber)
753 - return date.toLocaleDateString() + ' ' + date.toLocaleTimeString()
754 -}
755 -var name = msg.name
756 -var devicename = msg.originatorName
757 -var label = msg.originatorLabel
758 -var status = msg.status
759 -var detaildata =JSON.parse(msg.details.data)
760 -var tempswitch
761 -
762 -if (name != "Device Disconnected") {
763 - //detaildata=JSON.parse(msg.details.data)
764 - if (detaildata.Temperature_alarm_switch == true) {
765 - tempswitch = "open"
766 - } else {
767 - tempswitch = "close"
768 - }
769 - var humswitch
770 - if (detaildata.Humidity_alarm_switch == true) {
771 - humswitch = "open"
772 - } else {
773 - humswitch = "close"
774 - }
775 - var batswitch
776 - if (detaildata.Voltage_alarm_switch == true) {
777 - batswitch = "open"
778 - } else {
779 - batswitch = "close"
780 - }
781 - var str2 = "<p>-- Temperature alarm switch status: " +
782 - tempswitch + "</p>" +
783 - "<p>-- Humidity alarm switch status: " + humswitch +
784 - "</p>" +
785 - "<p>-- Voltage alarm switch status: " + batswitch
786 -}
787 -
788 -if (name == "High Temperature" && status ==
789 - "ACTIVE_UNACK") {
790 - var emailstr =
791 - "<div><p><span style='color: black; font-weight: bold'>" +
792 - "Device " + label + " has alarm:</span></p>" +
793 - "<p><span style='color: red; font-weight: bold'>-- High Temperature Alarm</span></p>" +
794 - "<p>-- Current Temperature : " + detaildata
795 - .TempC_SHT + "</p><br>" +
796 - "<p>Device Configure:</p>" +
797 - "<p>-- Temperature Threshold : min: " + detaildata
798 - .Low_temperature_alarm + ", max: " + detaildata
799 - .High_temperature_alarm + "</p>" +
800 - "<p>-- Humidity Threshold: min: " + detaildata
801 - .Low_humidity_alarm + ", max:" + detaildata
802 - .High_humidity_alarm + "</p>" +
803 - "<p>-- Battery threshold: min: " + detaildata
804 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
805 - return {
806 - msg: {
807 - "data": emailstr
808 - },
809 - metadata: metadata,
810 - msgType: msgType
811 - };
812 -} else if (name == "Low Temperature" && status ==
813 - "ACTIVE_UNACK") {
814 - var emailstr =
815 - "<div><p><span style='color: black; font-weight: bold'>" +
816 - "Device " + label + " has alarm:</span></p>" +
817 - "<p><span style='color: red; font-weight: bold'>-- Low Temperature Alarm</span></p>" +
818 - "<p>-- Current Temperature : " + detaildata
819 - .TempC_SHT + "</p><br>" +
820 - "<p>Device Configure:</p>" +
821 - "<p>-- Temperature Threshold : min: " + detaildata
822 - .Low_temperature_alarm + ", max: " + detaildata
823 - .High_temperature_alarm + "</p>" +
824 - "<p>-- Humidity Threshold: min: " + detaildata
825 - .Low_humidity_alarm + ", max:" + detaildata
826 - .High_humidity_alarm + "</p>" +
827 - "<p>-- Battery threshold: min: " + detaildata
828 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
829 -
830 - return {
831 - msg: {
832 - "data": emailstr
833 - },
834 - metadata: metadata,
835 - msgType: msgType
836 - };
837 -
838 -} else if (name == "Device Disconnected" && status ==
839 - "ACTIVE_UNACK") {
840 - var time1 = locatime(Number(detaildata.lastActivityTime))
841 - //var time1 = detaildata.lastActivityTime
842 - // var chazhi = parseInt((detaildata.inactivityAlarmTime-detaildata.lastActivityTime)/1000/60)
843 - // var emailstr =
844 - // "<div><p><span style='color: red; font-weight: bold'>" +
845 - // "Device " + label + " has Alarm</span></p><p>Last activity time: "+time1+"</p><p>Last Uplink: 21"+"minutes ago</p></div>"
846 -
847 - var emailstr ="Device " + label + " has Alarm##Last activity time: "+time1+"##Last Uplink: 21minutes ago"
848 - var newType = "POST_TELEMETRY_REQUEST"
849 - return {
850 - msg:emailstr,
851 - metadata: metadata,
852 - msgType: newType
853 - }
854 -} else if (name == "High humidity" && status ==
855 - "ACTIVE_UNACK") {
856 - var emailstr =
857 - "<div><p><span style='color: black; font-weight: bold'>" +
858 - "Device " + label + " has alarm:</span></p>" +
859 - "<p><span style='color: red; font-weight: bold'>-- High Humidity Alarm</span></p>" +
860 - "<p>-- Current Temperature : " + detaildata
861 - .Hum_SHT + "</p><br>" +
862 - "<p>Device Configure:</p>" +
863 - "<p>-- Temperature Threshold : min: " + detaildata
864 - .Low_temperature_alarm + ", max: " + detaildata
865 - .High_temperature_alarm + "</p>" +
866 - "<p>-- Humidity Threshold: min: " + detaildata
867 - .Low_humidity_alarm + ", max:" + detaildata
868 - .High_humidity_alarm + "</p>" +
869 - "<p>-- Battery threshold: min: " + detaildata
870 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
871 -
872 - return {
873 - msg: {
874 - "data": emailstr
875 - },
876 - metadata: metadata,
877 - msgType: msgType
878 - };
879 -} else if (name == "Low humidity" && status ==
880 - "ACTIVE_UNACK") {
881 - var emailstr =
882 - "<div><p><span style='color: black; font-weight: bold'>" +
883 - "Device " + label + " has alarm:</span></p>" +
884 - "<p><span style='color: red; font-weight: bold'>-- Low Humidity Alarm</span></p>" +
885 - "<p>-- Current Temperature : " + detaildata
886 - .Hum_SHT + "</p><br>" +
887 - "<p>Device Configure:</p>" +
888 - "<p>-- Temperature Threshold : min: " + detaildata
889 - .Low_temperature_alarm + ", max: " + detaildata
890 - .High_temperature_alarm + "</p>" +
891 - "<p>-- Humidity Threshold: min: " + detaildata
892 - .Low_humidity_alarm + ", max:" + detaildata
893 - .High_humidity_alarm + "</p>" +
894 - "<p>-- Battery threshold: min: " + detaildata
895 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
896 -
897 - return {
898 - msg: {
899 - "data": emailstr
900 - },
901 - metadata: metadata,
902 - msgType: msgType
903 - };
904 -} else if (name == "Low voltage" && status ==
905 - "ACTIVE_UNACK") {
906 - var emailstr =
907 - "<div><p><span style='color: black; font-weight: bold'>" +
908 - "Device " + label + " has alarm:</span></p>" +
909 - "<p><span style='color: red; font-weight: bold'>-- Low Voltage Alarm</span></p>" +
910 - "<p>-- Current Temperature : " + detaildata.BatV +
911 - "</p><br>" +
912 - "<p>Device Configure:</p>" +
913 - "<p>-- Temperature Threshold : min: " + detaildata
914 - .Low_temperature_alarm + ", max: " + detaildata
915 - .High_temperature_alarm + "</p>" +
916 - "<p>-- Humidity Threshold: min: " + detaildata
917 - .Low_humidity_alarm + ", max:" + detaildata
918 - .High_humidity_alarm + "</p>" +
919 - "<p>-- Battery threshold: min: " + detaildata
920 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
921 -
922 - return {
923 - msg: {
924 - "data": emailstr
925 - },
926 - metadata: metadata,
927 - msgType: msgType
928 - };
929 -} else if (name == "High Temperature" && status ==
930 - "CLEARED_UNACK") {
931 - var emailstr =
932 - "<div><p><span style='color: green; font-weight: bold'>Device " +
933 - label +
934 - " High Temperature Alarm Cleared</span></p>" +
935 - "<p>-- Current Temperature : " + detaildata
936 - .TempC_SHT + "</p><br>" +
937 - "<p>Device Configure:</p>" +
938 - "<p>-- Temperature Threshold : min: " + detaildata
939 - .Low_temperature_alarm + ", max: " + detaildata
940 - .High_temperature_alarm + "</p>" +
941 - "<p>-- Humidity Threshold: min: " + detaildata
942 - .Low_humidity_alarm + ", max:" + detaildata
943 - .High_humidity_alarm + "</p>" +
944 - "<p>-- Battery threshold: min: " + detaildata
945 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
946 -
947 - return {
948 - msg: {
949 - "data": emailstr
950 - },
951 - metadata: metadata,
952 - msgType: msgType
953 - };
954 -} else if (name == "Low Temperature" && status ==
955 - "CLEARED_UNACK") {
956 - var emailstr =
957 - "<div><p><span style='color: green; font-weight: bold'>Device " +
958 - label +
959 - " Low Temperature Alarm Cleared</span></p>" +
960 - "<p>-- Current Temperature : " + detaildata
961 - .TempC_SHT + "</p><br>" +
962 - "<p>Device Configure:</p>" +
963 - "<p>-- Temperature Threshold : min: " + detaildata
964 - .Low_temperature_alarm + ", max: " + detaildata
965 - .High_temperature_alarm + "</p>" +
966 - "<p>-- Humidity Threshold: min: " + detaildata
967 - .Low_humidity_alarm + ", max:" + detaildata
968 - .High_humidity_alarm + "</p>" +
969 - "<p>-- Battery threshold: min: " + detaildata
970 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
971 -
972 - return {
973 - msg: {
974 - "data": emailstr
975 - },
976 - metadata: metadata,
977 - msgType: msgType
978 - };
979 -} else if (name == "High humidity" && status ==
980 - "CLEARED_UNACK") {
981 - var emailstr =
982 - "<div><p><span style='color: green; font-weight: bold'>Device " +
983 - label + " High Humidity Alarm Cleared</span></p>" +
984 - "<p>-- Current Temperature : " + detaildata
985 - .Hum_SHT + "</p><br>" +
986 - "<p>Device Configure:</p>" +
987 - "<p>-- Temperature Threshold : min: " + detaildata
988 - .Low_temperature_alarm + ", max: " + detaildata
989 - .High_temperature_alarm + "</p>" +
990 - "<p>-- Humidity Threshold: min: " + detaildata
991 - .Low_humidity_alarm + ", max:" + detaildata
992 - .High_humidity_alarm + "</p>" +
993 - "<p>-- Battery threshold: min: " + detaildata
994 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
995 -
996 - return {
997 - msg: {
998 - "data": emailstr
999 - },
1000 - metadata: metadata,
1001 - msgType: msgType
1002 - };
1003 -} else if (name == "Low humidity" && status ==
1004 - "CLEARED_UNACK") {
1005 - var emailstr =
1006 - "<div><p><span style='color: green; font-weight: bold'>Device " +
1007 - label + " Low Humidity Alarm Cleared</span></p>" +
1008 - "<p>-- Current Temperature : " + detaildata
1009 - .Hum_SHT + "</p><br>" +
1010 - "<p>Device Configure:</p>" +
1011 - "<p>-- Temperature Threshold : min: " + detaildata
1012 - .Low_temperature_alarm + ", max: " + detaildata
1013 - .High_temperature_alarm + "</p>" +
1014 - "<p>-- Humidity Threshold: min: " + detaildata
1015 - .Low_humidity_alarm + ", max:" + detaildata
1016 - .High_humidity_alarm + "</p>" +
1017 - "<p>-- Battery threshold: min: " + detaildata
1018 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
1019 - return {
1020 - msg: {
1021 - "data": emailstr
1022 - },
1023 - metadata: metadata,
1024 - msgType: msgType
1025 - };
1026 -} else if (name == "Low voltage" && status ==
1027 - "CLEARED_UNACK") {
1028 -
1029 - var emailstr =
1030 - "<div><p><span style='color: green; font-weight: bold'>Device " +
1031 - label + " Low Voltage Alarm Cleared</span></p>" +
1032 - "<p>-- Current Temperature : " + detaildata.BatV +
1033 - "</p><br><br>" +
1034 - "<p>Device Configure:</p>" +
1035 - "<p>-- Temperature Threshold : min: " + detaildata
1036 - .Low_temperature_alarm + ", max: " + detaildata
1037 - .High_temperature_alarm + "</p>" +
1038 - "<p>-- Humidity Threshold: min: " + detaildata
1039 - .Low_humidity_alarm + ", max:" + detaildata
1040 - .High_humidity_alarm + "</p>" +
1041 - "<p>-- Battery threshold: min: " + detaildata
1042 - .Low_voltage_alarm + "</p>" + str2 + "</div>"
1043 -
1044 - return {
1045 - msg: {
1046 - "data": emailstr
1047 - },
1048 - metadata: metadata,
1049 - msgType: msgType
1050 - };
1051 -} else if (name == "Device Disconnected" && status ==
1052 - "CLEARED_UNACK") {
1053 - var time1 = locatime(Number(detaildata.lastActivityTime))
1054 - //var time1 = detaildata.lastActivityTime
1055 - // var chazhi = parseInt((detaildata.inactivityAlarmTime-detaildata.lastActivityTime)/1000/60)
1056 - // var emailstr =
1057 - // "<div><p><span style='color: green; font-weight: bold'>" +
1058 - // "Device " + label + " has Alarm Cleared</span></p><p>Last activity time: "+time1+"</p></div>"
1059 - var emailstr ="Device " + label + " has Alarm Cleared##Last activity time: "+time1
1060 - var newType = "POST_TELEMETRY_REQUEST"
1061 - return {
1062 - msg: emailstr,
1063 - metadata: metadata,
1064 - msgType: newType
1065 - }
1066 -}
1067 -{{/code}}
1068 -
1069 -(% class="wikigeneratedid" %)
1070 -**Generate Report:**
1071 -
1072 -(% class="wikigeneratedid" %)
1073 -[[image:1730865053380-293.png]]
1074 -
1075 -= 5.other =
1076 -
1077 -* If you want to create a similar dashboard, after understanding the case, you can download and import the dashboard, device profiles, rule chains, etc. of the case on GitHub, and make modifications based on them.
1078 -* GitHub address:[[https:~~/~~/github.com/ThingsEye-io/te-platform/tree/main/case/Dragino%20Office%20%26%20Factory>>https://github.com/ThingsEye-io/te-platform/tree/main/case/Dragino%20Office%20%26%20Factory]]
106 += 5. =
1730709382428-730.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -480.8 KB
Content
1730709409941-536.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -451.5 KB
Content
1730709424998-915.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -443.4 KB
Content
1730709442773-502.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -448.3 KB
Content
1730709461297-207.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -458.2 KB
Content
1730709479828-595.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -450.7 KB
Content
1730709511861-439.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -470.0 KB
Content
1730709527720-418.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -475.8 KB
Content
1730709542597-321.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -474.8 KB
Content
1730709555797-383.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -463.2 KB
Content
1730710271230-716.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -1.5 MB
Content
1730710395303-672.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -1.6 MB
Content
1730710693066-349.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -94.4 KB
Content
1730710850458-781.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -1.5 MB
Content
1730710875401-848.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -1.0 MB
Content
1730710949358-671.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -1.0 MB
Content
1730710990334-601.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -1.0 MB
Content
1730712335338-750.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -77.1 KB
Content
1730712473941-913.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -135.9 KB
Content
1730712539209-554.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -131.0 KB
Content
1730770392454-317.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -195.6 KB
Content
1730770636230-829.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -290.6 KB
Content
1730770875793-351.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -305.2 KB
Content
1730771103096-522.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -197.9 KB
Content
1730771199343-553.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -108.5 KB
Content
1730771228766-212.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -46.8 KB
Content
1730771256045-238.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -69.1 KB
Content
1730771318657-502.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -60.4 KB
Content
1730771386258-676.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -46.4 KB
Content
1730771441589-122.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -57.6 KB
Content
1730771504586-433.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -151.2 KB
Content
1730857191863-514.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -354.7 KB
Content
1730857537965-184.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -455.1 KB
Content
1730857750749-240.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -285.9 KB
Content
1730862483514-101.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -195.8 KB
Content
1730862584519-902.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -191.1 KB
Content
1730863708259-750.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -220.1 KB
Content
1730863750414-979.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -210.6 KB
Content
1730864045747-876.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -208.9 KB
Content
1730864077395-395.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -201.4 KB
Content
1730864117808-484.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -203.0 KB
Content
1730864159071-895.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -226.6 KB
Content
1730864207037-477.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -215.3 KB
Content
1730864250506-111.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -209.5 KB
Content
1730864293216-991.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -138.5 KB
Content
1730864331859-740.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -134.4 KB
Content
1730864460314-611.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -256.7 KB
Content
1730864617480-221.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -260.8 KB
Content
1730864676542-406.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -227.7 KB
Content
1730864784118-474.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -148.8 KB
Content
1730865053380-293.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.hera
Size
... ... @@ -1,1 +1,0 @@
1 -46.7 KB
Content