KNX/EIB bus control and event notifications via SMS over 3G modem
Example: KNX/EIB bus control and event notifications via SMS over 3G modem
Installing USB GSM adapter in the LogicMachine
-
- We use Huawei E173 modem in our tests. Other supported 3G modems list can be found here
- The modem has to be plugged into any of USB ports of LM2 and it starts operating immediately. We suggest to use external 5V powering for the modem because by USB2.0 standard the output current on USB is 0.75A, but some modems requires up to 2A which is out of standard so the modem can lack the power and get diconnected.
-
- Specific functions should be added into user script library with PIN code setting and telephone number white-list which will be able to receive and send in SMS messages. This function can be found in LogicMachine user manual. Also it is recommended to lower the speed of the modem by adding the following code in Startup/init script
- os.execute('echo 1 > /sys/bus/platform/devices/ci_hdrc.0/force_full_speed')
- os.execute('echo 1 > /sys/bus/platform/devices/ci_hdrc.1/force_full_speed')
- 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:
- require('user.sms')
- 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