-
Notifications
You must be signed in to change notification settings - Fork 0
/
initialize-config.sh
executable file
·75 lines (70 loc) · 2.34 KB
/
initialize-config.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env fish
# Take the broker domain as an input from the command line
if set -q argv[1]
set broker_domain $argv[1]
else
echo "Please provide the broker domain as an argument."
exit 1
end
set broker_url "coap://$broker_domain"
# Array of topic configurations
set topic_configurations "{
\"topic-name\": \"All Sensors\",
\"topic-data\": \"ps/data/all\",
\"resource-type\": \"core.ps.conf\",
\"media-type\": \"application/json\",
\"topic-type\": \"opaque\",
\"expiration-date\": \"2024-04-05T23:59:59Z\",
\"max-subscribers\": 200,
\"observer-check\": 86400
}" "{
\"topic-name\": \"Temperature Sensor\",
\"topic-data\": \"ps/data/0000001\",
\"resource-type\": \"core.ps.conf\",
\"media-type\": \"application/json\",
\"topic-type\": \"temperature\",
\"expiration-date\": \"2024-04-05T23:59:59Z\",
\"max-subscribers\": 300,
\"observer-check\": 86400
}" "{
\"topic-name\": \"Humidity Sensor\",
\"topic-data\": \"ps/data/0000002\",
\"resource-type\": \"core.ps.conf\",
\"media-type\": \"application/json\",
\"topic-type\": \"temperature\",
\"expiration-date\": \"2024-04-05T23:59:59Z\",
\"max-subscribers\": 200,
\"observer-check\": 86400
}" "{
\"topic-name\": \"Humidity Sensor\",
\"topic-data\": \"ps/data/0000003\",
\"resource-type\": \"core.ps.conf\",
\"media-type\": \"application/json\",
\"topic-type\": \"humidity\",
\"expiration-date\": \"2024-04-05T23:59:59Z\",
\"max-subscribers\": 400,
\"observer-check\": 86400
}" "{
\"topic-name\": \"Light Sensor\",
\"topic-data\": \"ps/data/0000004\",
\"resource-type\": \"core.ps.conf\",
\"media-type\": \"application/json\",
\"topic-type\": \"light\",
\"expiration-date\": \"2024-04-05T23:59:59Z\",
\"max-subscribers\": 200,
\"observer-check\": 86400
}" "{
\"topic-name\": \"Air Quality Sensor\",
\"topic-data\": \"ps/data/0000005\",
\"resource-type\": \"core.ps.conf\",
\"media-type\": \"application/json\",
\"topic-type\": \"air-quality\",
\"expiration-date\": \"2024-04-05T23:59:59Z\",
\"max-subscribers\": 60,
\"observer-check\": 86400
}"
# Loop over the topic configurations
for config in $topic_configurations
# Send a POST request for each topic configuration
./client.py -m POST $broker_url/ps --payload $config
end