Page 1 of 1

No strings on SMS

Posted: Fri Jun 01, 2018 1:41 am
by nemke
Hello people

I use some script for MT for temperature controle, which I was modify litle.
MT send me SMS message ovet Textmagic api, over my account, if Temperature on MT board is over some value (in my case 65C)

All work great BUT in SMS i don't receve real value of system indentity and temerature,

/system health
:if ([get temperature]>65) do={/tool fetch url="https://www.textmagic.com/app/api?usern ... send&text=[/system indentity get name]+Temperature+is+[/system health get temperature]&phone=+38xxxxxxx&unicode=0"} else {:log info ("Temperature is ok.".[/system health get temperature])}

I receve SMS like on picture. Script work, MT send SMS message when Temp is over 65 but just with no strings
On Log i see good string. Temperature is ok.58C
Where I was wrong ?

Tested on RB450G ver 6.42.3
Image

Re: No strings on SMS

Posted: Fri Jun 01, 2018 2:26 am
by Sob
Instead of:
"text1[/system identity get name]text2"
Use:
"text1$[/system identity get name]text2"

Re: No strings on SMS

Posted: Fri Jun 01, 2018 11:38 pm
by nemke
Instead of:
"text1[/system identity get name]text2"
Use:
"text1$[/system identity get name]text2"
Thanks man. That solved problem. Now work like charm :-)

Re: No strings on SMS

Posted: Tue Jun 05, 2018 12:32 am
by nemke
Hello again
how to combine 2 command in do= and 2 commands in else=

/system health
:if ([get temperature]>70) do={/tool fetch url="https://www.textmagic.com/app/api?usern ... send&text=$[/system identity get name]+Temperature+is+$[/system health get temperature]&phone=+38xxxxxxx&unicode=0"}
/tool fetch mode=http http-method=put http-content-type="application/xml" http-data="<IOPortData> <outputState>high</outputState> </IOPortData>" url=http://test:Test1234@192.168.88.84/ISAP ... /1/trigger

else
{:log info ("Temperature is ok.".[/system health get temperature])}
/tool fetch mode=http http-method=put http-content-type="application/xml" http-data="<IOPortData> <outputState>kow</outputState> </IOPortData>" url=http://test:Test1234@192.168.88.84/ISAP ... /1/trigger

I want for example
if Temp goes over 70C, send SMS over texmagic AND send command over ISAPI to devices....
When Temp is below 70C, log Tem is OK AND send ISAPI to devices

I want all this in same script

Re: No strings on SMS

Posted: Tue Jun 05, 2018 12:23 pm
by dasiu
Use new lines.
OR - use ";" in the end of command (then - no need for new line).
Or - use both for clarity :)
AND use indents - for your script to be "nice". Like:
/system health
:if ([get temperature]>70) do={
  /tool fetch url="https://www.textmagic.com/app/api?usern ... send&text=$[/system identity get name]+Temperature+is+$[/system health get temperature]&phone=+38xxxxxxx&unicode=0";
  /tool fetch mode=http http-method=put http-content-type="application/xml" http-data="<IOPortData> <outputState>high</outputState> </IOPortData>" url="http://test:Test1234@192.168.88.84/ISAP ... /1/trigger";
} else={ 
  :log info ("Temperature is ok.".[/system health get temperature]);
  /tool fetch mode=http http-method=put http-content-type="application/xml" http-data="<IOPortData> <outputState>kow</outputState> </IOPortData>" url="http://test:Test1234@192.168.88.84/ISAP ... /1/trigger";
}

Re: No strings on SMS

Posted: Tue Jun 05, 2018 6:33 pm
by nemke
Thanks....it WORK :-)