forked from Orange-OpenSource/fiware-cepheus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
62 lines (48 loc) · 1.28 KB
/
run.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
# Windows Shutters commands example
IOT=localhost:8083
ORION=localhost:8082
. ../common.sh
# Send an queryContext request
function sendQuery() #(url, name, type, isPattern of entityId)
{
payload='{
"name": "'$2'",
"type": "'$3'",
"isPattern": "'$4'"
}'
send $1 "v1/admin/query" "$payload"
}
function sendUpdate() #(url, name, type, isPattern of entityId and name, type, value of attributs)
{
payload='{
"name": "'$2'",
"type": "'$3'",
"isPattern": "'$4'",
"attributName": "'$5'",
"attributType": "'$6'",
"attributValue": "'$7'"
}'
send $1 "v1/admin/update" "$payload"
}
echo " - Send registerContext for Shutter$floor$room"
out=$(send $IOT "v1/admin/registerShutter" "")
echo " $out"
echo " - Send registerContext for Room$floor$room"
out=$(send $IOT "v1/admin/registerRoom" "")
echo " $out"
echo ""
echo "# Wait between shutter update and query temperature..."
echo ""
sleep 5
echo " - Send queryContext for all Room"
out=$(sendQuery $ORION "Room*" "Room" "true")
echo " $out"
sleep 1
echo " - Send queryContext for Shutter21"
out=$(sendQuery $ORION "Shutter21" "Shutter" "false")
echo " $out"
sleep 1
echo " - Send updateContext for Shutter21"
out=$(sendUpdate $ORION "Shutter21" "Shutter" "false" "status" "string" "opened")
echo " $out"