114
114
"y" : 500 ,
115
115
"wires" : [
116
116
[
117
- " c45a10208faeea88" ,
118
- " 3b4b32fc0ebfe72e"
117
+ " c45a10208faeea88"
119
118
]
120
119
]
121
120
},
143
142
"type" : " function" ,
144
143
"z" : " 09012e75c72a4968" ,
145
144
"name" : " UpdateActuatorState" ,
146
- "func" : " " ,
145
+ "func" : " let jsonData = JSON.parse(msg.payload); \n\n msg.payload = [ \n { \n \" op \" : \" add \" , \n \" path \" : \" /intensity_percentage \" , \n \" value \" : msg.intensity_percentage \n }, \n { \n \" op \" : \" add \" , \n \" path \" : \" /power_state \" , \n \" value \" : msg.state \n }, \n { \n \" op \" : \" add \" , \n \" path \" : \" /type \" , \n \" value \" : jsonData[msg.actuator_id][ \" type \" ] \n } \n ] \n\n msg.url = \" https://digital-twin-layer.api.neu.digitaltwins.azure.net/digitaltwins/ \" + msg.actuator_id + \" ?api-version=2020-10-31 \"\n msg.method = \" patch \"\n\n return msg; \n " ,
147
146
"outputs" : 1 ,
148
147
"noerr" : 0 ,
149
148
"initialize" : " " ,
153
152
"y" : 740 ,
154
153
"wires" : [
155
154
[
156
- " c45a10208faeea88"
155
+ " c45a10208faeea88" ,
156
+ " b19dbb8d1bfea2fc"
157
157
]
158
158
]
159
159
},
464
464
]
465
465
]
466
466
},
467
- {
468
- "id" : " 6a5968a77bdcb8ec" ,
469
- "type" : " https-node" ,
470
- "z" : " 09012e75c72a4968" ,
471
- "name" : " " ,
472
- "method" : " use" ,
473
- "ret" : " txt" ,
474
- "paytoqs" : " ignore" ,
475
- "url" : " " ,
476
- "tls" : " " ,
477
- "persist" : true ,
478
- "proxy" : " " ,
479
- "authType" : " " ,
480
- "senderr" : false ,
481
- "x" : 2050 ,
482
- "y" : 720 ,
483
- "wires" : [
484
- [
485
- " 3e879afc64077b51"
486
- ]
487
- ]
488
- },
489
467
{
490
468
"id" : " 3a01a886905e5fed" ,
491
469
"type" : " http in" ,
697
675
]
698
676
]
699
677
},
700
- {
701
- "id" : " dd96318fc1b5b6c4" ,
702
- "type" : " https-node" ,
703
- "z" : " 09012e75c72a4968" ,
704
- "name" : " getToken" ,
705
- "method" : " GET" ,
706
- "ret" : " obj" ,
707
- "paytoqs" : " body" ,
708
- "url" : " " ,
709
- "tls" : " " ,
710
- "persist" : true ,
711
- "proxy" : " " ,
712
- "authType" : " " ,
713
- "senderr" : false ,
714
- "x" : 1620 ,
715
- "y" : 180 ,
716
- "wires" : [
717
- [
718
- " 1453612b8d0a384b"
719
- ]
720
- ]
721
- },
722
678
{
723
679
"id" : " 1453612b8d0a384b" ,
724
680
"type" : " function" ,
1116
1072
"type" : " file in" ,
1117
1073
"z" : " 09012e75c72a4968" ,
1118
1074
"name" : " read file" ,
1119
- "filename" : " /data/configFiles/type0 .json" ,
1075
+ "filename" : " /data/configFiles/actuator_room_mapping .json" ,
1120
1076
"filenameType" : " str" ,
1121
1077
"format" : " utf8" ,
1122
1078
"chunk" : false ,
1231
1187
]
1232
1188
]
1233
1189
},
1234
- {
1235
- "id" : " 6b1290a059fc78a2" ,
1236
- "type" : " serial in" ,
1237
- "z" : " 09012e75c72a4968" ,
1238
- "name" : " " ,
1239
- "serial" : " 94b8abb47e4cb1f2" ,
1240
- "x" : 110 ,
1241
- "y" : 180 ,
1242
- "wires" : [
1243
- [
1244
- " ead8458e27835fd5"
1245
- ]
1246
- ]
1247
- },
1248
1190
{
1249
1191
"id" : " ead8458e27835fd5" ,
1250
1192
"type" : " function" ,
1264
1206
]
1265
1207
]
1266
1208
},
1267
- {
1268
- "id" : " ea1d80c07843fb89" ,
1269
- "type" : " serial out" ,
1270
- "z" : " 09012e75c72a4968" ,
1271
- "name" : " " ,
1272
- "serial" : " 94b8abb47e4cb1f2" ,
1273
- "x" : 2070 ,
1274
- "y" : 1280 ,
1275
- "wires" : []
1276
- },
1277
1209
{
1278
1210
"id" : " 6c9f6e80226a5597" ,
1279
1211
"type" : " inject" ,
1303
1235
]
1304
1236
]
1305
1237
},
1306
- {
1307
- "id" : " 3b4b32fc0ebfe72e" ,
1308
- "type" : " debug" ,
1309
- "z" : " 09012e75c72a4968" ,
1310
- "name" : " debug 1" ,
1311
- "active" : true ,
1312
- "tosidebar" : true ,
1313
- "console" : false ,
1314
- "tostatus" : false ,
1315
- "complete" : " true" ,
1316
- "targetType" : " full" ,
1317
- "statusVal" : " " ,
1318
- "statusType" : " auto" ,
1319
- "x" : 1660 ,
1320
- "y" : 440 ,
1321
- "wires" : []
1322
- },
1323
1238
{
1324
1239
"id" : " 781486d011dadee8" ,
1325
1240
"type" : " inject" ,
1406
1321
" ead8458e27835fd5"
1407
1322
]
1408
1323
]
1324
+ },
1325
+ {
1326
+ "id" : " 6b1290a059fc78a2" ,
1327
+ "type" : " serial in" ,
1328
+ "z" : " 09012e75c72a4968" ,
1329
+ "name" : " " ,
1330
+ "serial" : " 94b8abb47e4cb1f2" ,
1331
+ "x" : 130 ,
1332
+ "y" : 180 ,
1333
+ "wires" : [
1334
+ [
1335
+ " ead8458e27835fd5"
1336
+ ]
1337
+ ]
1338
+ },
1339
+ {
1340
+ "id" : " ea1d80c07843fb89" ,
1341
+ "type" : " serial out" ,
1342
+ "z" : " 09012e75c72a4968" ,
1343
+ "name" : " " ,
1344
+ "serial" : " 94b8abb47e4cb1f2" ,
1345
+ "x" : 2090 ,
1346
+ "y" : 1280 ,
1347
+ "wires" : []
1348
+ },
1349
+ {
1350
+ "id" : " 6a5968a77bdcb8ec" ,
1351
+ "type" : " https-node" ,
1352
+ "z" : " 09012e75c72a4968" ,
1353
+ "name" : " " ,
1354
+ "method" : " use" ,
1355
+ "ret" : " txt" ,
1356
+ "paytoqs" : " ignore" ,
1357
+ "url" : " " ,
1358
+ "tls" : " " ,
1359
+ "persist" : true ,
1360
+ "proxy" : " " ,
1361
+ "authType" : " " ,
1362
+ "senderr" : false ,
1363
+ "x" : 2050 ,
1364
+ "y" : 720 ,
1365
+ "wires" : [
1366
+ [
1367
+ " 3e879afc64077b51"
1368
+ ]
1369
+ ]
1370
+ },
1371
+ {
1372
+ "id" : " dd96318fc1b5b6c4" ,
1373
+ "type" : " https-node" ,
1374
+ "z" : " 09012e75c72a4968" ,
1375
+ "name" : " getToken" ,
1376
+ "method" : " GET" ,
1377
+ "ret" : " obj" ,
1378
+ "paytoqs" : " body" ,
1379
+ "url" : " " ,
1380
+ "tls" : " " ,
1381
+ "persist" : true ,
1382
+ "proxy" : " " ,
1383
+ "authType" : " " ,
1384
+ "senderr" : false ,
1385
+ "x" : 1620 ,
1386
+ "y" : 180 ,
1387
+ "wires" : [
1388
+ [
1389
+ " 1453612b8d0a384b"
1390
+ ]
1391
+ ]
1392
+ },
1393
+ {
1394
+ "id" : " 105b0c2203081bf6" ,
1395
+ "type" : " inject" ,
1396
+ "z" : " 09012e75c72a4968" ,
1397
+ "name" : " type4" ,
1398
+ "props" : [
1399
+ {
1400
+ "p" : " payload"
1401
+ },
1402
+ {
1403
+ "p" : " topic" ,
1404
+ "vt" : " str"
1405
+ }
1406
+ ],
1407
+ "repeat" : " " ,
1408
+ "crontab" : " " ,
1409
+ "once" : false ,
1410
+ "onceDelay" : 0.1 ,
1411
+ "topic" : " " ,
1412
+ "payload" : " {\" type\" : 4, \" actuator_id\" : \" act1\" , \" state\" : \" on\" , \" intensity_percentage\" : 40}" ,
1413
+ "payloadType" : " str" ,
1414
+ "x" : 110 ,
1415
+ "y" : 420 ,
1416
+ "wires" : [
1417
+ [
1418
+ " ead8458e27835fd5"
1419
+ ]
1420
+ ]
1421
+ },
1422
+ {
1423
+ "id" : " b19dbb8d1bfea2fc" ,
1424
+ "type" : " debug" ,
1425
+ "z" : " 09012e75c72a4968" ,
1426
+ "name" : " debug 1" ,
1427
+ "active" : true ,
1428
+ "tosidebar" : true ,
1429
+ "console" : false ,
1430
+ "tostatus" : false ,
1431
+ "complete" : " false" ,
1432
+ "statusVal" : " " ,
1433
+ "statusType" : " auto" ,
1434
+ "x" : 1900 ,
1435
+ "y" : 860 ,
1436
+ "wires" : []
1409
1437
}
1410
1438
]
0 commit comments