Fiware Ultralight 2.0 IoTAgent: How to send measure from a device?

半腔热情 提交于 2019-12-24 02:55:09

问题


I am working on a POC to create Smart City IoT project using Fiware platform. I am trying to run end to end flow. I have following Docker containers running.

CONTAINER ID PORTS NAMES

24f036202f78 0.0.0.0:4041->4041/tcp, 0.0.0.0:7896->7896/tcp fiware_iotagent_1

81e16c78312e 0.0.0.0:1026->1026/tcp fiware_orion_1

bf699e1acdd3 0.0.0.0:1883->1883/tcp fiware_mosquitto_1

bfc256deddd0 0.0.0.0:27017->27017/tcp fiware_mongo_1

I am using following tutorials.

http://fiwaretourguide.readthedocs.io/en/latest/connection-to-the-internet-of-things/how-to-read-measures-captured-from-iot-devices/

I am able to create Service and devices. (data is given below).

Now, when I am sending measurement it is not working.

Please guide me what am I doing wrong? And if possible provide reference having step by step example to run end to end IoT testing.

Request Details (Using POSTMAN) Header

Content-Type:text/plain
fiware-service:{{FiwareService}}
fiware-servicepath:{{FiwareServicePath}}
X-Auth-Token:{{AuthToken}}

POST URL: http://130.206.XXX.XXX:4041/iot/d?k=tourguide-devices&i=restaurant-sensor-0115206c51f60b48b77e4c937835795c33bb953f

Body Contents: 't|25'

Response:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Error</title>
    </head>
    <body>
        <pre>Cannot POST /iot/d</pre>
    </body>
</html>

Service and Device Data with Header using IotAgent URL i.e. http://130.206.XXX.XXX:4041/iot/ Header

Content-Type:application/json
fiware-service:tourguide
fiware-servicepath:/
X-Auth-Token:{{AuthToken}}

Service

{
    "_id": "5a7063e6b8adcc0001c34723",
    "subservice": "/",
    "service": "tourguide",
    "apikey": "tourguide-devices",
    "resource": "/iot/dev-restaurants",
    "attributes": [],
    "lazy": [],
    "commands": [],
    "entity_type": "tourguide-devices",
    "internal_attributes": [],
    "static_attributes": []
}

Device

{
    "device_id": "restaurant-sensor-0115206c51f60b48b77e4c937835795c33bb953f",
    "service": "tourguide",
    "service_path": "/",
    "entity_name": "0115206c51f60b48b77e4c937835795c33bb953f",
    "entity_type": "Restaurant",
    "transport": "HTTP",
    "attributes": [
        {
            "object_id": "t",
            "name": "temperature",
            "type": "number"
        }
    ],
    "lazy": [],
    "commands": [],
    "static_attributes": [],
    "protocol": "UL20"
}

Regards,

Krishan Babbar


回答1:


I just followed "Fiware Tour Guide" from http://fiwaretourguide.readthedocs.io/en/latest/fiware-tour-guide-application-a-tutorial-on-how-to-integrate-the-main-fiware-ges/introduction/ and everything seems working fine.

I was using port 4041 instead of port 7896. Below request is working fine.

http://MyIPHost:7896/iot/d?k=tourguide-devices-Franchise1&i=0115206c51f60b48b77e4c937835795c33bb953f-kitchen-temperature2

Data:

t|39

Regards, Krishan



来源:https://stackoverflow.com/questions/48523040/fiware-ultralight-2-0-iotagent-how-to-send-measure-from-a-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!