28.08.2015, 07:20
1. Place the contents of user.sms.lua into a new user library called "sms"
2. Create a Resident script for SMS handler. Set sleep interval to 0 and place the contents of resident.lua into the script.
You might have to edit this line:
And try ttyUSB0 or ttyUSB2, different modems have different ports that can work with SMS. You must disable / enable resident script after changing port name.
3. Add the contents of init.lua to the Start-up script, you have to reboot LM via Systems config afterwards. Do not reboot via power cycle or you might lose your newly created scripts.
4. Edit script the resident and set the PIN and allowed numbers for SMS handler
5. To send SMS from a script:
6. Command syntax:
a. Write to bus:
W ALIAS VALUE
b. Read from bus:
R ALIAS
On read request, script will reply with SMS message containing current value of selected object.
ALIAS can be:
a. Group address (e.g. 1/1/1)
b. Name (e.g. Obj1). If name contains spaces then it must be escaped usign double quotes (e.g. "Room Temperature")
NOTE:
a. Object data type and name must be set in Objects tab. Otherwise script won't be able to read and write to object.
b. Only ASCII symbols are accepted in the message.
Examples:
a. Binary write:
W 1/1/1 true
b. Scaling write:
W LED1Red 67
c. Temperature (floating point) write:
W "Room Setpoint" 22.5
d. Read:
R 2/1/1
2. Create a Resident script for SMS handler. Set sleep interval to 0 and place the contents of resident.lua into the script.
You might have to edit this line:
Code:
comport = 'ttyUSB1'
3. Add the contents of init.lua to the Start-up script, you have to reboot LM via Systems config afterwards. Do not reboot via power cycle or you might lose your newly created scripts.
4. Edit script the resident and set the PIN and allowed numbers for SMS handler
5. To send SMS from a script:
Code:
require('user.sms')
sendsms('12345678', 'test sms')
6. Command syntax:
a. Write to bus:
W ALIAS VALUE
b. Read from bus:
R ALIAS
On read request, script will reply with SMS message containing current value of selected object.
ALIAS can be:
a. Group address (e.g. 1/1/1)
b. Name (e.g. Obj1). If name contains spaces then it must be escaped usign double quotes (e.g. "Room Temperature")
NOTE:
a. Object data type and name must be set in Objects tab. Otherwise script won't be able to read and write to object.
b. Only ASCII symbols are accepted in the message.
Examples:
a. Binary write:
W 1/1/1 true
b. Scaling write:
W LED1Red 67
c. Temperature (floating point) write:
W "Room Setpoint" 22.5
d. Read:
R 2/1/1