This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modify a small sms script
#1
Hi.

I use this small script on a 1bit group address:

require('user.sms')
sendsms('12345678', 'test sms')

I then get a text message every time the group address value changes between 1 and 0.

What do i have to change in this script to only get a sms when the value is either 1 or 0?

if value = 0, then:
require('user.sms')
sendsms('12345678', 'test sms')

BR
Kai-Roger
Reply
#2
Value can be either true or false for booleans. You can write it like this:
Code:
if event.getvalue() == false then
Reply
#3
Thanks.

Then i will write it like this:

if event.getvalue() == false then

require('user.sms')
sendsms('12345678', 'test sms')

Do i need to have a closure to the script in Lua, or is this not a normal practice? like:
if not then: exit

Okay. I just found out how it works. I need an "end" at the end Smile

if event.getvalue() == false then
require('user.sms')
sendsms('12345678', 'test sms')
end

When i run the script, i get a popup on my ipad with Visu.

It says

http://192.168.1.99
sending sms: 12345678 test sms

And i then have to press a OK button.

How to remove this message on visu?
Reply
#4
Hi,

There must be a alert() somewhere, probably in the user lib that you need to disable/remove.

Another option is to disable the popup in the vis config settings but then the alerts are still added to the alert tab.

BR,

Erwin
Reply
#5
Thanks. Now i understand why this shows up on the Visu.

I could not find it in the script for deactivation. This is a script by admin 28.08.2015 09:20 in the below link.

https://forum.logicmachine.net/showthrea...hlight=sms

Maybe someone can point me in the right direction?  Smile
Reply
#6
Hi,

Its in the resident script..

Add — before the line to disable the alert.

alert('incoming sms: [%s] %s', tostring(sms.sender), tostring(sms.data))

BR,

Erwin
Reply
#7
Hi.

That did not work, but thanks for pointing me in the right direction. I added -- in front of the first line of the following, and it works great  :)


    --alert('sending sms: ' .. msg)
    modem:sendsms(msg:sub(1, sep - 1), msg:sub(sep + 1))
  end
end
Reply


Forum Jump: