#!/usr/bin/env bash [[ -z "$ORION_HOST" ]] && echo "Please set ORION_HOST env var. E.g. export ORION_HOST=127.0.0.1" && exit echo "Querying context broker at: ${ORION_HOST}" [[ -z "$SUBSCRIPTION_URL" ]] && echo "Please set SUBSCRIPTION_URL env var. E.g. export SUBSCRIPTION_URL=http://172.18.1.11:5000/on_change_soilMoistureVwc" && exit echo "Callback URL for subscriptions is: ${SUBSCRIPTION_URL}" curl --location --request POST \ "http://$ORION_HOST:1026/v2/subscriptions/" \ --header "Fiware-Service: carouge" \ --header "Fiware-ServicePath: /Watering" \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --data '{ "description": "A subscription to subscribe to FlowerBed.soilMoistureVwc", "subject": { "entities": [ { "id": "urn:ngsi-ld:FlowerBed:FlowerBed-345", "type": "FlowerBed" } ], "condition": { "attrs": [ "soilMoistureVwc" ] } }, "notification": { "http": { "url": "'${SUBSCRIPTION_URL}'" }, "attrs": [ "soilMoistureVwc" ], "attrsFormat": "keyValues" }, "throttling": 5 }'