diff --git a/README.md b/README.md index 5b95fbfcc4f982e74d3a5f1957c2f05d17adc21b..e23f90e0f1896e09ba3cf6b7ae3903a92058a5b6 100755 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ We have `IoT sensor for humidity`, and `WMS for watering scheduling`, then we co | | | | | IoT Platform +<---------------+ WMS - Watering | | | SUBSCRIBE | weekly scheduler | -+----------------------+ /FlowerBed/soilMoistureVwc | ++----------------------+ /FlowerBed/soilMoisture | +-------------------+ @@ -86,10 +86,10 @@ We have `IoT sensor for humidity`, and `WMS for watering scheduling`, then we co | | | | | IoT Platform +--------------->+ WMS - Watering | | | POST | weekly scheduler | -+-----+----------------+ /FlowerBed/soilMoistureVwc | ++-----+----------------+ /FlowerBed/soilMoisture | ^ +-------------------+ UPDATE| -/FlowerBed/soilMoistureVwc +/FlowerBed/soilMoisture | +-----+----------------+ | | @@ -107,7 +107,7 @@ UPDATE| | | | | | IoT Platform +<-----------------------------------+ WMS - Watering | | | GET | weekly scheduler | -+----------------------+ /FlowerBed/soilMoistureVwc?limit=100 | ++----------------------+ /FlowerBed/soilMoisture?limit=100 | | +-------------------+ diff --git a/scripts-admin/create_entities.py b/scripts-admin/create_entities.py index 1a1266969e8c1f908b7aaf65c6f69f02b78312f4..8c9201b1aeb0f5c4f9970b92c34126727457f9f8 100755 --- a/scripts-admin/create_entities.py +++ b/scripts-admin/create_entities.py @@ -35,7 +35,7 @@ def get_ngsiv2_typed_description(val): elif isinstance(val, dict): return {'type': 'StructuredValue', 'value': val} elif isinstance(val, type(None)): - return {'type': 'None', 'value': None} + return {'type': 'Text', 'value': None} else: raise NotImplementedError("Couldn't get NGSIv2 type for object {} of type {}".format(val, type(val))) diff --git a/scripts/historic_02_api_query.sh b/scripts/historic_02_api_query.sh index 69c69662457f65a98e57350a2c2912ddc0a932a8..f39077e77c97efe79036943f452090396e1b51b1 100755 --- a/scripts/historic_02_api_query.sh +++ b/scripts/historic_02_api_query.sh @@ -4,7 +4,7 @@ echo "Querying QuantumLeap API at: ${QUANTUM_HOST}" curl --location --request GET \ - "http://$QUANTUM_HOST:8668/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc/value?limit=100" \ + "http://$QUANTUM_HOST:8668/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoisture/value?limit=100" \ --header "Fiware-Service: carouge" \ --header "Fiware-ServicePath: /" \ --header "Accept: application/json" diff --git a/scripts/security_02_request_without_token.sh b/scripts/security_02_request_without_token.sh index 9bc121a8a9e4d696e595e4e86c858eaf1aeb28ae..817b8c02b9b6ef5805a5310c1575d9b3ad88bd93 100755 --- a/scripts/security_02_request_without_token.sh +++ b/scripts/security_02_request_without_token.sh @@ -6,5 +6,5 @@ echo "Querying Fiware entrypoint (PEP_PROXY) at: ${PROXY_HOST}" curl -X GET \ - "http://$PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc/value"\ + "http://$PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoisture/value"\ --header "Fiware-Service: carouge" diff --git a/scripts/security_03_request_with_token.sh b/scripts/security_03_request_with_token.sh index 5d7ec35471be2215ae5f8b3e943c92276302831e..aff961323f892500876902007419e10bd9eb0935 100755 --- a/scripts/security_03_request_with_token.sh +++ b/scripts/security_03_request_with_token.sh @@ -8,7 +8,7 @@ echo "Querying Fiware entrypoint (PEP_PROXY) at: ${PROXY_HOST}" [[ -z "$KEYROCK_TOKEN" ]] && echo "Please set KEYROCK_TOKEN env var. E.g. export KEYROCK_TOKEN=****" && exit curl -X GET \ - "http://$PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc/value"\ + "http://$PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoisture/value"\ --header "Fiware-Service: carouge" \ --header "X-Auth-Token: $KEYROCK_TOKEN" diff --git a/scripts/security_04_update_entity_with_token.sh b/scripts/security_04_update_entity_with_token.sh index 0ac96f9a85066548dacdadc673dab51a024f044a..5261902e819c940861443967d1fb0cbe8c510537 100755 --- a/scripts/security_04_update_entity_with_token.sh +++ b/scripts/security_04_update_entity_with_token.sh @@ -11,7 +11,7 @@ echo echo curl --location --request PUT \ - "http://$PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc/value"\ + "http://$PROXY_HOST:1027/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoisture/value"\ --header "Fiware-Service: carouge" \ --header "X-Auth-Token: $KEYROCK_TOKEN" \ --header "Content-Type: text/plain" \ diff --git a/scripts/security_05_subscribe_to_entity_with_token.sh b/scripts/security_05_subscribe_to_entity_with_token.sh index ac9ba9a58d91e9b980f865568349ee58e40fe08d..f625a1658ca31f36b45c40eedcf9a8f607282f7e 100755 --- a/scripts/security_05_subscribe_to_entity_with_token.sh +++ b/scripts/security_05_subscribe_to_entity_with_token.sh @@ -8,7 +8,7 @@ echo "Querying Fiware entrypoint (PEP_PROXY) at: ${PROXY_HOST}" [[ -z "$KEYROCK_TOKEN" ]] && echo "Please set KEYROCK_TOKEN env var. E.g. export KEYROCK_TOKEN=****" && exit [[ -z "$SUBSCRIPTION_URL" ]] && - echo "Please set SUBSCRIPTION_URL env var. E.g. export SUBSCRIPTION_URL=http://172.18.1.11:5000/on_change_soilMoistureVwc" && + echo "Please set SUBSCRIPTION_URL env var. E.g. export SUBSCRIPTION_URL=http://172.18.1.11:5000/on_change_soilMoisture" && echo "You can check out the wms-example source code for a server implementation example." && exit @@ -21,7 +21,7 @@ curl --location --request POST \ --header "Accept: application/json" \ --header "X-Auth-Token: $KEYROCK_TOKEN" \ --data '{ - "description": "A subscription to subscribe to FlowerBed.soilMoistureVwc", + "description": "A subscription to subscribe to FlowerBed.soilMoisture", "subject": { "entities": [ { @@ -31,7 +31,7 @@ curl --location --request POST \ ], "condition": { "attrs": [ - "soilMoistureVwc" + "soilMoisture" ] } }, @@ -40,7 +40,7 @@ curl --location --request POST \ "url": "'${SUBSCRIPTION_URL}'" }, "attrs": [ - "soilMoistureVwc" + "soilMoisture" ], "attrsFormat": "keyValues" }, diff --git a/scripts/watering_01_create_entity.sh b/scripts/watering_01_create_entity.sh index 5efe381ddb5136ce204a56e0e76ae0f1168f591d..e2e8086a33c699dff5a5d00a2a8ec9041c39ceeb 100755 --- a/scripts/watering_01_create_entity.sh +++ b/scripts/watering_01_create_entity.sh @@ -20,6 +20,6 @@ curl -iX POST \ "addressCountry": "Switzerland" }, "soilTemperature": 17, - "soilMoistureVwc": 0.85 + "soilMoisture": 0.85 } ' diff --git a/scripts/watering_04_retrieve_attribute_value.sh b/scripts/watering_04_retrieve_attribute_value.sh index 5130a4b69d003ed2ade43dac0ecc291bcbf6cc83..85c0c0e6f90b031b3341c346d49b4d7aaef4152b 100755 --- a/scripts/watering_04_retrieve_attribute_value.sh +++ b/scripts/watering_04_retrieve_attribute_value.sh @@ -4,7 +4,7 @@ echo "Querying context broker at: ${ORION_HOST}" curl --location --request GET \ - "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc/value" \ + "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoisture/value" \ --header "Fiware-Service: carouge" \ | python -mjson.tool diff --git a/scripts/watering_05_retrieve_attribute.sh b/scripts/watering_05_retrieve_attribute.sh index 423650dd8b205c356d9d7794b6a9e28eb8ba08d3..fd8cfe548206978fcbc9a313403e82fcb6be5c9f 100755 --- a/scripts/watering_05_retrieve_attribute.sh +++ b/scripts/watering_05_retrieve_attribute.sh @@ -4,7 +4,7 @@ echo "Querying context broker at: ${ORION_HOST}" curl --location --request GET \ - "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc" \ + "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoisture" \ --header "Fiware-Service: carouge" \ | python -mjson.tool diff --git a/scripts/watering_06_update_specific_attrs.sh b/scripts/watering_06_update_specific_attrs.sh index 03d182a3fc1804df6f0831fce8bc5723d5d878b2..5f3afe4e4d8d54a9980d203073ebc6f37a845222 100755 --- a/scripts/watering_06_update_specific_attrs.sh +++ b/scripts/watering_06_update_specific_attrs.sh @@ -4,7 +4,7 @@ echo "Querying context broker at: ${ORION_HOST}" curl --location --request PUT \ - "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoistureVwc/value"\ + "http://$ORION_HOST:1026/v2/entities/urn:ngsi-ld:FlowerBed:FlowerBed-1/attrs/soilMoisture/value"\ --header "Fiware-Service: carouge" \ --header "Content-Type: text/plain" \ -d $(( RANDOM % 10 )) diff --git a/scripts/watering_07_subscribe_to_entity.sh b/scripts/watering_07_subscribe_to_entity.sh index 79535a4f75536c67f439779b3dbac9e6e15251f9..9744c747c611ba27740013aef1c0ffc7df6615b5 100755 --- a/scripts/watering_07_subscribe_to_entity.sh +++ b/scripts/watering_07_subscribe_to_entity.sh @@ -3,7 +3,7 @@ [[ -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 +[[ -z "$SUBSCRIPTION_URL" ]] && echo "Please set SUBSCRIPTION_URL env var. E.g. export SUBSCRIPTION_URL=http://172.18.1.11:5000/on_change_soilMoisture" && exit echo "Callback URL for subscriptions is: ${SUBSCRIPTION_URL}" @@ -13,7 +13,7 @@ curl --location --request POST \ --header "Content-Type: application/json" \ --header "Accept: application/json" \ --data '{ - "description": "A subscription to subscribe to FlowerBed.soilMoistureVwc", + "description": "A subscription to subscribe to FlowerBed.soilMoisture", "subject": { "entities": [ { @@ -23,7 +23,7 @@ curl --location --request POST \ ], "condition": { "attrs": [ - "soilMoistureVwc" + "soilMoisture" ] } }, @@ -32,7 +32,7 @@ curl --location --request POST \ "url": "'${SUBSCRIPTION_URL}'" }, "attrs": [ - "soilMoistureVwc" + "soilMoisture" ], "attrsFormat": "keyValues" }, diff --git a/scripts/watering_08_patch_entity.sh b/scripts/watering_08_patch_entity.sh index 73244f6d658626d616f1d281671d32f82a201d0e..7c85a7a6d32cda49b4a6290e27a2cafb9e30f489 100755 --- a/scripts/watering_08_patch_entity.sh +++ b/scripts/watering_08_patch_entity.sh @@ -8,6 +8,6 @@ curl --location --request PATCH \ --header "Fiware-Service: carouge" \ --header 'Content-Type: application/json' \ --data-raw '{ - "soilMoistureVwc": 899.85, + "soilMoisture": 899.85, "soilTemperature": null }' diff --git a/wms-example/app.py b/wms-example/app.py index 400ee70f83aab3a15126398deeed56ac28c595f2..923ccab28468a979fcff0ce1979e51770d20b17b 100644 --- a/wms-example/app.py +++ b/wms-example/app.py @@ -11,14 +11,14 @@ logger = logging.getLogger(__name__) def healthcheck(): return 'This service is up and running!' -@app.route('/on_change_soilMoistureVwc',methods = ['POST']) -def on_change_soilMoistureVwc(): +@app.route('/on_change_soilMoisture',methods = ['POST']) +def on_change_soilMoisture(): # if request.data: # app.logger.info("Request data: %s" % request.data) if request.json: app.logger.info("Got new soil moisture value from context broker: %s" % request.json['data']) - return 'Got POST for /on_change_soilMoistureVwc, with body %s' % request.form + return 'Got POST for /on_change_soilMoisture, with body %s' % request.form if __name__ == "__main__":