First i register service using this script
curl -H "Content-type: application/json" -H "Fiware-Service: cairoUniversity" -H "Fiware-ServicePath: /FCI/ICDL" \ http://X.X.X.X:4041/iot/services -d '{ "services": [ { "apikey": "api1", "cbroker": "http://0.0.0.0:1026", "entity_type": "Camps", "resource": "/iot/d" } ] }'
then i register device using this
curl http://X.X.X.X:4041/iot/devices \ -H "Content-type: application/json" -H "Fiware-Service:cairoUniversity" -H "Fiware-ServicePath: /FCI/ICDL" \ -d '{ "devices": [ { "device_id": "smartmeter2", "entity_name": "ICDL2", "entity_type": "Camps", "protocol": "PDI-IoTA-UltraLight", "timezone": "Europe/Madrid", "attributes": [ { "object_id": "c", "name": "Conscemption", "type": "int" } ] } ] }'
then i make subscription to orion
curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Fiware-Service: cairoUniversity" \ -H "Fiware-ServicePath: /FCI/ICDL" -H "Cache-Control: no-cache" -d '{ "entities": [ { "type": "Camps", "isPattern": "false", "id": "ICDL2" } ], > "attributes": [ "Conscemption" ], "reference": "http://X.X.X.X:8666/notify", "duration": "P1M", "notifyConditions": [ { "type": "ONCHANGE", "condValues": [ "Conscemption" ] } ] }' "http://X.X.X.X:1026/v1/subscribeContext" }
after that i send observation
curl "http://X.X.X.X:7896/iot/d?k=api1&i=smartmeter2" -d 'c|47' -H "Content-type: text/plain"
and finally retrieve data from sth
curl -X GET \
'http://X.X.X.X:8666/STH/v1/contextEntities/type/Camps/id/ICDL/attributes/Conscemption?aggrMethod=min&aggrPeriod=day&dateFrom=2015-01-28T00%3A00%3A00&dateTo=2018-01-01T23%3A59%3A59' \ -H 'accept: application/json' \ -H 'cache-control: no-cache' \
-H 'content-type: application/json' \ -H 'fiware-service: cairoUniversity' \ -H 'fiware-servicepath: /FCI/ICDL' | python -mjson.tool }
i got this respones
"contextResponses": [ { "contextElement": { "attributes": [ { "name": "Conscemption", "values": [] } ], "id": "ICDL", "isPattern": false, "type": "Camps" }, "statusCode": { "code": "200", "reasonPhrase": "OK" } } ]
and this the logs
sth-comet | time=2017-09-04T14:26:44.782Z | lvl=INFO | corr=n/a | trans=n/a | op=OPER_STH_SERVER_LOG | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=Everything OK, 0 requests attended in the last 60s interval sth-comet | time=2017-09-04T14:27:44.787Z | lvl=INFO | corr=n/a | trans=n/a | op=OPER_STH_SERVER_LOG | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=Everything OK, 0 requests attended in the last 60s interval
sth-comet | time=2017-09-04T14:27:52.834Z | lvl=WARN | corr=99577e81-bbd4-4130-95f6-a9d029f84db0 | trans=99577e81-bbd4-4130-95f6-a9d029f84db0 | op=OPER_STH_GET | from=n/a | srv=cairoUniversity | subsrv=/FCI/ICDL | comp=STH |
> msg=Error when getting the aggregated data collection for retrieval (the collection may not exist)
sth-comet | time=2017-09-04T14:28:44.792Z | lvl=INFO | corr=n/a | trans=n/a | op=OPER_STH_SERVER_LOG | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=Everything OK, 0 requests attended in the last 60s interval sth-comet | time=2017-09-04T14:29:44.797Z | lvl=INFO | corr=n/a | trans=n/a | op=OPER_STH_SERVER_LOG | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=Everything OK, 0 requests attended in the last 60s interval sth-comet | time=2017-09-04T14:30:44.805Z | lvl=INFO | corr=n/a | trans=n/a | op=OPER_STH_SERVER_LOG | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=Everything OK, 0 requests attended in the last 60s interval sth-comet | time=2017-09-04T14:31:44.811Z | lvl=INFO | corr=n/a | trans=n/a | op=OPER_STH_SERVER_LOG | from=n/a | srv=n/a | subsrv=n/a | comp=STH | msg=Everything OK, 0 requests attended in the last 60s interval
What may case this problem and how solve it
According to the logs that you posted, the notification never reaches the SHT service that is why you receive msg=Error when getting the aggregated data collection for retrieval (the collection may not exist) so the problem looks that is related to how you create the entities in Orion.
I notice that you have been created an entity named ICDL2 an in this entity you include the attribute "name": "Conscemption", "type": "int" but never include the "value" attribute, so when you send data it never is updated in that entity.
Second, you send data to your device in this way "curl "http://X.X.X.X:7896/iot/d?k=api1&i=smartmeter2" -d 'c|47' -H "Content-type: text/plain" but as I told you before the value '47' will never be written in the entity because it is not created, you put the trigger associate to the value "name": "Conscemption" but it is never changed because doesn't have the attribute value.
So it seems to be a problem managing your entities and subscriptions to ORION, you can find more information about how to create and update entities in ORION and how to make some test in: https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv1/index.html#introduction . After you are sure that Orion sends to you the notifications you can look your data in STH comet. Also, if you have questions related to the fiware products you can post the questions in https://jira.fiware.org and receive a direct answer of the team of each component of fiware.