Changes for page 2 Script

Last modified by Devin Chen on 2025/06/06 14:03

From version 56.1
edited by Theodore Xu
on 2023/08/24 17:12
Change comment: There is no comment for this version
To version 41.1
edited by Hunter
on 2023/03/17 18:05
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.AiXia
1 +XWiki.Hunter
Content
... ... @@ -27,19 +27,25 @@
27 27  
28 28  == **1.4 Short message** ==
29 29  
30 -The following demo shows that when the alarm condition is reached: temp1 > 5 & temp2 >10 & temp3 < 20(lasts more than 5 seconds) , then send an "alarm trigger" sms.
30 +When the alarm condition is reached: temp1 > 5 & temp2 >10 & temp3 < 20(lasts more than 5 seconds) , then send an "alarm trigger" sms.
31 31  
32 -When the alarm condition is released,then send an  "alarm release" sms. Script is as below:
32 +When the alarm condition is released,then send an "alarm release" sms.
33 33  
34 -{{code language="lua"}}
34 +(% style="text-align:center" %)
35 +[[image:1645535936750-316.png||height="385" width="400" class="img-thumbnail"]]
36 +
37 +Script is as below:
38 +
39 +(% class="box infomessage" %)
40 +(((
35 35  function sms.main()
36 -------send condition------
42 +~-~-~-~-~-~-send condition~-~-~-~-~-~-
37 37  local temp1 = addr_getword("@Temperature1")
38 38  local temp2 = addr_getword("@Temperature2")
39 39  local temp3 = addr_getword("@Temperature3")
40 40  local timer = addr_getword("@Timer")
41 41  local tag = addr_getbit("@Tag")
42 -------lasting time------
48 +~-~-~-~-~-~-lasting time~-~-~-~-~-~-
43 43  if temp1 > 5 and temp2 > 10 and temp3 < 20 then
44 44   timer = timer + 1
45 45   addr_setword("@Timer",timer)
... ... @@ -47,7 +47,7 @@
47 47   timer = 0
48 48   addr_setword("@Timer",timer)
49 49  end
50 -------send sms & output Y0------
56 +~-~-~-~-~-~-send sms & output Y0~-~-~-~-~-~-
51 51  if timer > 5 then
52 52   if tag == 0 then
53 53   send_sms_ira("19859254700","alarm trigger")
... ... @@ -58,7 +58,7 @@
58 58  addr_setbit("@Tag",0)
59 59  end
60 60  end
61 -{{/code}}
67 +)))
62 62  
63 63  == **1.5 Telegram notification** ==
64 64  
... ... @@ -139,7 +139,7 @@
139 139  
140 140  This example shows how to use the LINE Notify to send message into LINE group. When monitoring bit "@test" changes, it will trigger and send the message. Please replace with your own Token.
141 141  
142 -{{code language="lua"}}
148 +{{code}}
143 143  local tempBit = 0
144 144  local tempWord = 0
145 145  
... ... @@ -441,37 +441,6 @@
441 441  end
442 442  {{/code}}
443 443  
444 -== **1.9 High-Low Byte Switch** ==
445 -
446 -The following example is converting the floating number from order 1234 to order 3412, and formating output the number with 2 decimal point. About which high-low word order corresponding to which value, please refer to the [[Address Operation Table>>doc:V-BOX.V-Net.Manual.04 Lua Script.01 Lua Functions.WebHome||anchor="H2Addressoperation"]].
447 -
448 -{{code language="lua"}}
449 -function highLowByteSwitch(floatNumber)
450 - addr_setfloat("@W_0#HDW23036",floatNumber,0,2)
451 - local newFloat = addr_getfloat("@W_0#HDW23036")
452 - local formattedFloat = string.format("%.2f",newFloat)
453 - print("The formatted float value is the : "..formattedFloat)
454 - return formattedFloat
455 -end
456 -{{/code}}
457 -
458 -== **1.10 Read 64bits Unsigned Value** ==
459 -
460 -In our built-in function library doesn't have the function for reading 64-bit unsigned format value, so the following function is for solve this. But if the number is greater 2^53, the precision will be lost. So the final result will be a little bit different from the original value.
461 -
462 -{{code language="lua"}}
463 -function addr_getquatra(address)
464 - local highAddress = addr_newnoaddr(address,2)
465 - local low32 = addr_getdword(address)
466 - local high32 = addr_getdword(highAddress)
467 - --print("the low number is "..low32)
468 - --print("the high number is "..high32)
469 - local formatVal = string.format("%64.0f",2^32*high32+low32)
470 - print("the format value is ".. formatVal)
471 - return formatVal
472 -end
473 -{{/code}}
474 -
475 475  = **2 V-Box connect with third part server** =
476 476  
477 477  V-Box have two mode.One is for V-Net,User need to use WECON server to store data.We call this V-NET platform.
... ... @@ -497,7 +497,7 @@
497 497  (% class="wikigeneratedid" %)
498 498  Tool link: **[[MQTT.fx>>http://mqttfx.jensd.de/index.php/download]]**
499 499  
500 -== **2.1 Test server(General Example)** ==
475 +== **2.1 V-Box connect with test server(General Example)** ==
501 501  
502 502  The following example is trying to publish to the topic "testtopic/test/no1/7890", and subscribe the topic "testtopic/test/no1/123456".
503 503  
... ... @@ -521,7 +521,6 @@
521 521  {{code language="lua"}}
522 522  --MQTT configuration table
523 523  local MQTT_CFG={}
524 ---if there is no need the username and password, please put them as ""
525 525  MQTT_CFG.username = "weconsupport"
526 526  MQTT_CFG.password = "123456"
527 527  MQTT_CFG.netway = 0
... ... @@ -561,7 +561,7 @@
561 561  function mqtt_init()
562 562   print(string.format("mqtt init mqtt_url:%s mqtt_clientid:%s", MQTT_URL, MQTT_CLIENT_ID))
563 563   if g_mq then
564 - mqtt.close(g_mq) --Close mqtt object
538 + mqtt.close() --Close mqtt object
565 565   end
566 566   g_mq, err = mqtt.create(MQTT_URL, MQTT_CLIENT_ID) -- create mqtt object,and declare it as a global variable
567 567   if g_mq then
... ... @@ -646,7 +646,7 @@
646 646  end
647 647  {{/code}}
648 648  
649 -== **2.2 Customer server:grouprobotinfo.com** ==
623 +== **2.2 V-Box connect with customer server:grouprobotinfo.com** ==
650 650  
651 651  This demo does not use SSL certification. Script is as below
652 652  
... ... @@ -787,7 +787,7 @@
787 787  end
788 788  {{/code}}
789 789  
790 -== **2.3 Azure platform** ==
764 +== **2.3 V-Box connect with Azure platform** ==
791 791  
792 792  In this demo,V-Box connects with Azure by SSL certification.
793 793  
... ... @@ -918,14 +918,8 @@
918 918  end
919 919  )))
920 920  
921 -== **2.4 Huawei platform** ==
895 +== **2.4 How to configure the Huawei platform?(✎Note: Huawei IOT DA function is only in China area.If you want this function,you need to use chinese mobile to register)** ==
922 922  
923 -
924 -
925 -{{info}}
926 -**✎Note**:**Huawei IOT DA function is only in China area.If you want this function,you need to use chinese mobile to register**
927 -{{/info}}
928 -
929 929  1.Register a account: [[https:~~/~~/www.huaweicloud.com/intl/en-us/s/JUlPVERNJQ>>https://www.huaweicloud.com/intl/en-us/s/JUlPVERNJQ]]
930 930  
931 931  2.log in the Huawei IOTDA
... ... @@ -1194,7 +1194,7 @@
1194 1194  (% style="text-align:center" %)
1195 1195  [[image:1624506666650-161.png||height="547" width="1000" class="img-thumbnail"]]
1196 1196  
1197 -== **2.6 AWS platform** ==
1165 +== **2.6 V-Box connect with AWS platform** ==
1198 1198  
1199 1199  === **Log in AWS** ===
1200 1200  
... ... @@ -1259,7 +1259,7 @@
1259 1259  [[image:image-20220709165402-11.png]]
1260 1260  
1261 1261  
1262 -=== **MQTT.fx tool** ===
1230 +=== **Test with MQTT.fx tool** ===
1263 1263  
1264 1264  Click “View Setting” to get the “Broker Adress”
1265 1265  
... ... @@ -1287,7 +1287,7 @@
1287 1287  
1288 1288  [[image:image-20220709165402-18.png]]
1289 1289  
1290 -=== **CloudTool** ===
1258 +=== **Configurate in CloudTool** ===
1291 1291  
1292 1292  Copy the same setting in MQTT.fx to MQTT configuration
1293 1293