Community discussions

MikroTik App
 
nemke
Member Candidate
Member Candidate
Topic Author
Posts: 160
Joined: Thu Jul 31, 2014 2:52 am

No strings on SMS

Fri Jun 01, 2018 1:41 am

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
You do not have the required permissions to view the files attached to this post.
 
Sob
Forum Guru
Forum Guru
Posts: 9121
Joined: Mon Apr 20, 2009 9:11 pm

Re: No strings on SMS

Fri Jun 01, 2018 2:26 am

Instead of:
"text1[/system identity get name]text2"
Use:
"text1$[/system identity get name]text2"
 
nemke
Member Candidate
Member Candidate
Topic Author
Posts: 160
Joined: Thu Jul 31, 2014 2:52 am

Re: No strings on SMS

Fri Jun 01, 2018 11:38 pm

Instead of:
"text1[/system identity get name]text2"
Use:
"text1$[/system identity get name]text2"
Thanks man. That solved problem. Now work like charm :-)
 
nemke
Member Candidate
Member Candidate
Topic Author
Posts: 160
Joined: Thu Jul 31, 2014 2:52 am

Re: No strings on SMS

Tue Jun 05, 2018 12:32 am

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
 
User avatar
dasiu
Trainer
Trainer
Posts: 231
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: No strings on SMS

Tue Jun 05, 2018 12:23 pm

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";
}
 
nemke
Member Candidate
Member Candidate
Topic Author
Posts: 160
Joined: Thu Jul 31, 2014 2:52 am

Re: No strings on SMS

Tue Jun 05, 2018 6:33 pm

Thanks....it WORK :-)

Who is online

Users browsing this forum: No registered users and 36 guests