Commit ed3bd1e3 authored by Federico Sismondi's avatar Federico Sismondi

Update on scripts for creating entities and subscriptions for braila. Update...

Update on scripts for creating entities and subscriptions for braila. Update on data models used for Carouge
parent b5502224
...@@ -131,7 +131,19 @@ attrs = { ...@@ -131,7 +131,19 @@ attrs = {
'conductivityPrediction': 0.0, 'conductivityPrediction': 0.0,
'chloratePrediction': 0.0, 'chloratePrediction': 0.0,
}, },
"Device":{
"batteryLevel": 0.0,
"controlledProperty": [],
"dateLastValueReported": datetime.fromtimestamp(0), # mandatory
"description": "",
"location": Point([0, 0]), # mandatory
"name": "",
"owner": "",
"rssi": 0,
"serialNumber": "",
"source": "",
"value": [],
},
} }
# entities ids per pilot tuples # entities ids per pilot tuples
...@@ -181,7 +193,16 @@ entities = [ ...@@ -181,7 +193,16 @@ entities = [
# weather use case wtp_lab # weather use case wtp_lab
('urn:ngsi-ld:WeatherObserved:WeatherObserved', ['carouge', 'braila']), ('urn:ngsi-ld:WeatherObserved:WeatherObserved', ['carouge', 'braila']),
] # pressure and noise sensors (braila)
('urn:ngsi-ld:Device:Device-5770', ['braila']),
('urn:ngsi-ld:Device:Device-5771', ['braila']),
('urn:ngsi-ld:Device:Device-5772', ['braila']),
('urn:ngsi-ld:Device:Device-5773', ['braila']),
('urn:ngsi-ld:Device:Device-5979', ['braila']),
('urn:ngsi-ld:Device:Device-5980', ['braila']),
('urn:ngsi-ld:Device:Device-5981', ['braila']),
('urn:ngsi-ld:Device:Device-5982', ['braila']),
]
# http headers # http headers
headers = { headers = {
......
...@@ -21,14 +21,14 @@ curl --location --request POST \ ...@@ -21,14 +21,14 @@ curl --location --request POST \
} }
], ],
"condition": { "condition": {
"attrs": ["value","serialNumber","name","location","rssi"] "attrs": ["controlledProperty","value","serialNumber","name","rssi","batteryLevel"]
} }
}, },
"notification": { "notification": {
"http": { "http": {
"url": "http://172.18.1.7:8668/v2/notify" "url": "http://172.18.1.7:8668/v2/notify"
}, },
"attrs": ["value","serialNumber","name","location","rssi"], "attrs": ["controlledProperty", "value","serialNumber","name","rssi","batteryLevel"],
"metadata": ["dateCreated", "dateModified"] "metadata": ["dateCreated", "dateModified"]
} }
}' }'
...@@ -6,6 +6,32 @@ echo "Querying context broker at: ${ORION_HOST}" ...@@ -6,6 +6,32 @@ echo "Querying context broker at: ${ORION_HOST}"
# API NOTES: # API NOTES:
# "condition": { "attrs": [] } -> means monitor all the attributes in the entity # "condition": { "attrs": [] } -> means monitor all the attributes in the entity
# example of a FlowerBed (keyValues)
# "id": "urn:ngsi-ld:FlowerBed:FlowerBed-3",
# "type": "FlowerBed",
# "category": [],
# "dateLastWatering": "1970-01-01T01:00:00.00Z",
# "depth": 0,
# "flowerType": null,
# "height": 0,
# "location": [
# "46.18777345077501, 6.141221902014418",
# "46.18776394428967,6.1412558085139075",
# "46.187460562531,6.141082986525166",
# "46.18747273747444,6.141046425800975",
# "46.18777345077501,6.141221902014418"
# ],
# "nextWateringAmountRecommendation": "1970-01-01T01:00:00.00Z",
# "nextWateringDeadline": "1970-01-01T01:00:00.00Z",
# "refDevice": "0018b20000020a7d",
# "soilMoisture": 0,
# "sunExposure": null,
# "taxon": null,
# "width": 0
curl --location --request POST \ curl --location --request POST \
"http://$ORION_HOST:1026/v2/subscriptions/" \ "http://$ORION_HOST:1026/v2/subscriptions/" \
--header "Fiware-Service: carouge" \ --header "Fiware-Service: carouge" \
...@@ -21,16 +47,16 @@ curl --location --request POST \ ...@@ -21,16 +47,16 @@ curl --location --request POST \
} }
], ],
"condition": { "condition": {
"attrs": [] "attrs": ["category","dateLastWatering","nextWateringAmountRecommendation","nextWateringDeadline","refDevice","soilMoisture","taxon"]
} }
}, },
"notification": { "notification": {
"http": { "http": {
"url": "http://172.18.1.7:8668/v2/notify" "url": "http://172.18.1.7:8668/v2/notify"
}, },
"attrs": [], "attrs": ["category","dateLastWatering","nextWateringAmountRecommendation","nextWateringDeadline","refDevice","soilMoisture","taxon"],
"attrsFormat" : "keyValues", "attrsFormat": "normalized",
"metadata": ["dateCreated", "dateModified"] "metadata": ["dateModified"]
} }
}' }'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment