[Fiware-lab-help] sth comet fiware error

sofia klein sofiakleinpalermo at gmail.com
Sat Sep 29 01:07:59 CEST 2018


Hi, I have a problem making STM Comet work, I hope you could give me a hand
cause I don’t know anyone with experience in Fiware to help me and I can’t
find more information about it.



I followed the guide:
https://github.com/Fiware/tutorials.Short-Term-History/tree/b47f51e807465642a790ee1c4607d4d6769f7acc#start-up


I only used the parts of the tutorial which were of my interest, so I did
the following:



1) In a brand new CentOS virtual machine I installed Docker and
Docker-Compose

2) Pulled the images I needed:

sudo docker pull mongo:3.6

sudo docker pull fiware/orion

sudo docker pull fiware/sth-comet

3) Created a sth-comet.yml file (see file attached) based on the tutorial

4) Used the following docker-compose command to start the containers:

sudo docker-compose -f sth-comet.yml -p fiware up -d --remove-orphans

5) Inserted in the orion container a couple of test data, which is attached
in case you wanna give a look to the structure (data.txt)

6) Made the subscription so the STH-Comet received and save the historic
information as it is send by Orion in each data update (you can see the
subscription attached named subscription.txt)

7) Made several updated on the entity Room1 (this is the entity subscribed)

8) The query to get the historical information was made as the following:

*curl -X GET \*

* 'http://localhost:8666/STH/v1/contextEntities/type/Room/id/Room1/attributes/temperature?hLimit=7&hOffset=0
<http://localhost:8666/STH/v1/contextEntities/type/Room/id/Room1/attributes/temperature?hLimit=7&hOffset=0>**'
\*



And it returned the error:

{"statusCode":400,"error":"Bad Request","message":"error=child
\"fiware-service\"
fails because [fiware-service is required]","
validation":{"source":"headers","keys":[]}}



The error mentioned these 2 headers fiware-service and fiware-service were
required, so I modified the subscription (subscriptionWithHeaders.txt) and
the get query to include these 2 headers

Get query:

*curl -X GET \*

*'http://localhost:8666/STH/v1/contextEntities/type/Room/id/Room1/attributes/temperature?hLimit=7&hOffset=0
<http://localhost:8666/STH/v1/contextEntities/type/Room/id/Room1/attributes/temperature?hLimit=7&hOffset=0>'
\*

*-H 'fiware-service: default' \*

*  -H 'fiware-servicepath: /'*



and the response were the following:



*{"contextResponses":[{"contextElement":{"attributes":[{"name":"temperature","values":[]}],"id":"Room1","isPattern":false,"type":"Room"},"statusCode":{"code":"200","reasonPhrase":"OK"}}]}*

So no value were returned.



So I don’t understand what I’m doing wrong, I swear I read everything
regarding to this subject in the internet, I don’t know what else to do and
I’m desperate. I really hope you can help me, thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/fiware-lab-help/attachments/20180928/c838eacf/attachment-0001.html>
-------------- next part --------------
curl -v localhost:1026/v2/subscriptions -s -S \
-H 'Content-Type: application/json' \
-H 'fiware-service: default' \
-H 'fiware-servicepath: /' \
-d '{
  "description": "A subscription to get info about Room1",
  "subject": {
    "entities": [
      {
        "id": "Room1",
        "type": "Room"
      }
    ],
    "condition": {
      "attrs": [
        "pressure"
      ]
    }
  },
  "notification": {
    "http": {
      "url": "http://sth-comet:8666/notify"
    },
    "attrs": [
      "temperature"
    ]
  },
  "attrsFormat": "legacy",
  "expires": "2040-01-01T14:00:00.00Z"
}'
-------------- next part --------------
curl localhost:1026/v2/entities -s -S -H 'Content-Type: application/json' -d @- <<EOF
{
  "id": "Room1",
  "type": "Room",
  "temperature": {
    "value": 23,
    "type": "Float"
  },
  "pressure": {
    "value": 720,
    "type": "Integer"
  }
}
EOF

curl localhost:1026/v2/entities -s -S -H 'Content-Type: application/json' -d @- <<EOF
{
  "id": "Room2",
  "type": "Room",
  "temperature": {
    "value": 21,
    "type": "Float"
  },
  "pressure": {
    "value": 711,
    "type": "Integer"
  }
}
EOF
-------------- next part --------------
curl -v localhost:1026/v2/subscriptions -s -S -H 'Content-Type: application/json' -d @- <<EOF
{
  "description": "A subscription to get info about Room1",
  "subject": {
    "entities": [
      {
        "id": "Room1",
        "type": "Room"
      }
    ],
    "condition": {
      "attrs": [
        "pressure"
      ]
    }
  },
  "notification": {
    "http": {
      "url": "http://sth-comet:8666/notify"
    },
    "attrs": [
      "temperature"
    ]
  },
  "attrsFormat": "legacy",
  "expires": "2040-01-01T14:00:00.00Z"
}
EOF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sth.comet.yml
Type: application/octet-stream
Size: 983 bytes
Desc: not available
URL: <https://lists.fiware.org/private/fiware-lab-help/attachments/20180928/c838eacf/attachment-0001.obj>


More information about the Fiware-lab-help mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy