-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.sh
26 lines (19 loc) · 768 Bytes
/
example.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
api_key="your api key here"
deviceID="your deviceID here"
value=10 #post this value
#obtain a token
my_token=`/usr/lib/lua/ubidots.lua -token $api_key)`
echo "Token: "$my_token
#post data to Ubidots
/usr/lib/lua/ubidots.lua "-post" $api_key $deviceID $value
#retrieve last value from Ubidots
my_data=`/usr/lib/lua/ubidots.lua "-get" $api_key $deviceID`
echo $my_data
#retrieve all value from Ubidots
my_data=`/usr/lib/lua/ubidots.lua "-get" $api_key $deviceID "all"`
echo $my_data
#retrive last value from Ubidots & save to \tmp\data1.txt
/usr/lib/lua/ubidots.lua "-get" $api_key $deviceID "" "data1.txt"
#retrieve all data from Ubidots & save to \tmp\data2.txt
/usr/lib/lua/ubidots.lua "-get" $api_key $deviceID "all" "data2.txt"