Comments (6)
In last versions of the IoTA Library, a small change was introduced in the provisioning API, that may be wrongly specified in some examples. In the specification of attributes:
"lazy":[
{ "id": "l", "name": "luminosity", "type": "percentage" }
],
the id
field should be named object_id
. We have several tasks pending for updating documentation and examples. Next week I'll try to put the documentation up to date. Sorry for the inconvenience.
from iotagent-json.
@dmoranj yes, indeed I can notice here: https://github.com/telefonicaid/iotagent-mqtt/blob/master/test/deviceProvisioning/provisionDevice2.json#L19
However, I see that "id" field has disappeared from "attributes" and "commands"... Should we also use "object_id" over there?
What is exact role of "object_id" anyway?
I think this part of doc must be updated: https://github.com/telefonicaid/iotagent-node-lib#-device-provisioning-api
Anyway, this command:
(curl localhost:4041/iot/devices -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' --header 'Fiware-Service: mainflux' --header 'Fiware-ServicePath: /mqtt' -d @- | python -mjson.tool) <<EOF
{
"devices": [
{
"device_id": "DevID1",
"entity_name": "TheDevice1",
"entity_type": "DeviceType",
"attributes": [
{ "object_id": "t", "name": "temperature", "type": "float" },
{ "object_id": "h", "name": "humidity", "type": "float" }
],
"lazy":[
{ "object_id": "l", "name": "luminosity", "type": "percentage" }
],
"commands": [
{ "object_id": "t", "name": "turn", "type": "string" }
],
"static_attributes": [
{ "name": "serialID", "type": "02598347" }
]
}
]
}
EOF
passes OK.
Entry in the Oprion's database is following:
> db.entities.find()
{ "_id" : { "id" : "TheDevice1", "type" : "DeviceType", "servicePath" : "/mqtt" }, "attrNames" : [ "temperature", "humidity", "serialID", "turn_status", "turn_result" ], "attrs" : { "temperature" : { "type" : "float", "creDate" : 1454795350, "modDate" : 1454795350, "value" : " " }, "humidity" : { "type" : "float", "creDate" : 1454795350, "modDate" : 1454795350, "value" : " " }, "serialID" : { "type" : "02598347", "creDate" : 1454795350, "modDate" : 1454795804 }, "turn_status" : { "type" : "commandStatus", "creDate" : 1454795350, "modDate" : 1454795350, "value" : "UNKNOWN" }, "turn_result" : { "type" : "commandResult", "creDate" : 1454795350, "modDate" : 1454795350, "value" : " " } }, "creDate" : 1454795350, "modDate" : 1454795804 }
And Orion's log is following:
orion_1 | INFO@21:56:44 logMsg.h[1802]: Starting transaction from 172.17.42.1:56184/NGSI9/registerContext
orion_1 | INFO@21:56:44 connectionOperations.cpp[79]: Database Operation Successful (query: { $or: [ { entities: { $in: [ { id: "TheDevice1", type: "DeviceType", isPattern: "false" } ] }, $or: [ { attrs: { $in: [ "luminosity", "turn" ] } }, { attrs: { $size: 0 } } ], expiration: { $gt: 1454795804 } }, { entities.isPattern: "true", expiration: { $gt: 1454795804 }, $where: function(){enId = [ "TheDevice1" ];enType = [ "DeviceType" ];for (var ... } ] })
orion_1 | INFO@21:56:44 connectionOperations.cpp[400]: Database Operation Successful (update: <{ _id: ObjectId('56b66c1c20bef1003a5da142') }, { _id: ObjectId('56b66c1c20bef1003a5da142'), expiration: 1457387804, servicePath: "/mqtt", format: "JSON", contextRegistration: [ { entities: [ { id: "TheDevice1", type: "DeviceType" } ], attrs: [ { name: "luminosity", type: "percentage", isDomain: "false" }, { name: "turn", type: "string", isDomain: "false" } ], providingApplication: "http://localhost:4041" } ] }>)
orion_1 | INFO@21:56:44 logMsg.h[1886]: Transaction ended
orion_1 | INFO@21:56:44 logMsg.h[1802]: Starting transaction from 172.17.42.1:56186/v1/updateContext
orion_1 | INFO@21:56:44 connectionOperations.cpp[79]: Database Operation Successful (query: { _id.id: "TheDevice1", _id.type: "DeviceType", _id.servicePath: /^\/mqtt$/ })
orion_1 | ERROR@21:56:44 safeMongo.cpp[198]: Runtime Error (field 'value' is missing in BSONObj <{ type: "02598347", creDate: 1454795350, modDate: 1454795771 }>)
orion_1 | ERROR@21:56:44 safeMongo.cpp[198]: Runtime Error (field 'value' is missing in BSONObj <{ type: "02598347", creDate: 1454795350, modDate: 1454795771 }>)
orion_1 | ERROR@21:56:44 MongoCommonUpdate.cpp[555]: Runtime Error (unknown attribute value type in DB: 0)
orion_1 | INFO@21:56:44 connectionOperations.cpp[400]: Database Operation Successful (update: <{ _id.id: "TheDevice1", _id.type: "DeviceType", _id.servicePath: /\/mqtt/ }, { $set: { attrs.serialID: { type: "02598347", creDate: 1454795350, modDate: 1454795804 }, modDate: 1454795804 }, $unset: { location: 1 } }>)
orion_1 | INFO@21:56:44 logMsg.h[1886]: Transaction ended
orion_1 | INFO@21:56:49 connectionOperations.cpp[625]: Database Operation Successful (command: { listDatabases: 1 })
orion_1 | INFO@21:56:49 connectionOperations.cpp[79]: Database Operation Successful (query: { conditions.type: "ONCHANGE" })
orion_1 | INFO@21:56:49 connectionOperations.cpp[79]: Database Operation Successful (query: { conditions.type: "ONCHANGE" })
Looks like it dows not like that we are not passing the value
...
from iotagent-json.
The documentation has to be updated in the IOTA Lib, indeed. BTW, lazy attributes and commands haven't been implemented yet for the MQTT-JSON IoTA. I'll try to create the Step-by-step guide today, to solve your doubts one and for all.
from iotagent-json.
@dmoranj no need - it has been done already ;). Take a look at #84, I have already posted you this link: https://github.com/Mainflux/mainflux-fiware/wiki/IoT-Agent-MQTT
I made an extensive step-by-step guide, all you need is to copy-paste it to the IOTA-MQTT page.
from iotagent-json.
Thanks for the effort :)
I was thinking of something more structured like the guide we created for the LWM2M Agent. I'm working already on that.
from iotagent-json.
Closing issue, as it seems to contain already answered questions and some issues regarding the documentation (fixed in #84 or in another PR in the IOTAgent Library documentation).
from iotagent-json.
Related Issues (20)
- Subscribe to a specific MQTT topic HOT 1
- 400 when use ``` "entity_name": "'David:Prueba'" ``` HOT 2
- No plain text command return option HOT 1
- Payload measures are lost after reconnection with Orion.
- iotagent- json should be used in place of iotagent-ul in commandsPolling-test.js HOT 2
- existing entities are overwritten when creating a device HOT 4
- MongoDB connection, authentication failed HOT 9
- Fiware IoT Agent json is changing the service path of incoming messages if it is high load HOT 14
- Support of Content Type: application/soap+xml HOT 4
- iotaJsonTester.js is missing from the repository HOT 3
- Allow ingest ngsiv2/ngsild as measure for iotagent HOT 2
- Differences between `explicitAttrs` behaviour at lib and at agent level HOT 6
- Support \t in Content-Type header HOT 2
- constants.DEFAULT_ATTRIBUTE_TYPE is string instead of Text HOT 3
- include apikey error log at measure procesing HOT 1
- Keep order from a multimeasure to Orion CB HOT 4
- The agent does not send data to the Orion Context Broker with a request payload of 566 KB HOT 9
- Broken link in README.md HOT 2
- Attributes name & static attributes not mapped in Orion when inserted in the Device provisioning phase HOT 4
- modify apikey in a provisioned device HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iotagent-json.