Example: KNX/EIB bus control and event notifications via SMS over 3G modem

Installing USB GSM adapter in the LogicMachine

5V_usb_powering

Source code    
  1. os.execute('echo 1 > /sys/bus/platform/devices/ci_hdrc.0/force_full_speed')
  2. os.execute('echo 1 > /sys/bus/platform/devices/ci_hdrc.1/force_full_speed')
  3. os.execute('usbreset /dev/bus/usb/001/001')

Integration scripts and example

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
3. Edit script the resident and set the PIN and allowed numbers for SMS handler
4. To send SMS from a script:

Source code    
  1. require('user.sms')
  2. sendsms('12345678', 'test sms')

5. 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 using 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