Files
smart-city-digital-twin-mar…/init/iot-agent-provision.sh

27 lines
966 B
Bash
Executable File

#!/bin/bash
# Wait for IoT Agent to be ready
sleep 10
# Provision Service
curl -s -X POST http://localhost:4041/iot/services \
-H "Content-Type: application/json" \
-H "fiware-service: smartcity" \
-H "fiware-servicepath: /" \
-d '{
"services": [{
"apikey": "smartcity-api-key",
"cbroker": "http://smart-city-orion-ld:1026",
"entity_type": "Thing",
"resource": "/iot/json"
}]
}'
# Provision Devices (Traffic, Parking, Noise, Weather, Light)
for i in 0 1 2; do
curl -s -X POST http://localhost:4041/iot/devices \
-H "Content-Type: application/json" \
-H "fiware-service: smartcity" \
-H "fiware-servicepath: /" \
-d "{\"devices\": [{\"device_id\": \"traffic_00${i}\", \"entity_name\": \"urn:ngsi-ld:TrafficFlowObserved:traffic_00${i}\", \"entity_type\": \"TrafficFlowObserved\", \"protocol\": \"PDI-IoTA-JSON\", \"transport\": \"MQTT\"}]}";
done
# (Add other types similarly)
echo "Provisioning done"