Changes for page 2 Script
Last modified by Devin Chen on 2025/06/06 14:03
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -27,25 +27,19 @@ 27 27 28 28 == **1.4 Short message** == 29 29 30 - When the alarm condition is reached: temp1 > 5 & temp2 >10 & temp3 < 20(lasts more than 5 seconds) , then send an "alarm trigger" sms.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. 31 31 32 -When the alarm condition is released,then send an "alarm release" sms. 32 +When the alarm condition is released,then send an "alarm release" sms. Script is as below: 33 33 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 -((( 34 +{{code language="lua"}} 41 41 function sms.main() 42 - ~-~-~-~-~-~-send condition~-~-~-~-~-~-36 +------send condition------ 43 43 local temp1 = addr_getword("@Temperature1") 44 44 local temp2 = addr_getword("@Temperature2") 45 45 local temp3 = addr_getword("@Temperature3") 46 46 local timer = addr_getword("@Timer") 47 47 local tag = addr_getbit("@Tag") 48 - ~-~-~-~-~-~-lasting time~-~-~-~-~-~-42 +------lasting time------ 49 49 if temp1 > 5 and temp2 > 10 and temp3 < 20 then 50 50 timer = timer + 1 51 51 addr_setword("@Timer",timer) ... ... @@ -53,7 +53,7 @@ 53 53 timer = 0 54 54 addr_setword("@Timer",timer) 55 55 end 56 - ~-~-~-~-~-~-send sms & output Y0~-~-~-~-~-~-50 +------send sms & output Y0------ 57 57 if timer > 5 then 58 58 if tag == 0 then 59 59 send_sms_ira("19859254700","alarm trigger") ... ... @@ -64,7 +64,7 @@ 64 64 addr_setbit("@Tag",0) 65 65 end 66 66 end 67 - )))61 +{{/code}} 68 68 69 69 == **1.5 Telegram notification** == 70 70