问题
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