Open pasquy73 opened 6 years ago
Did grunt test
goes ok after the proposed change?
I'm using the doc: I start the IoT Agent (node bin/lwm2mAgent.js) with my configuration and I run my JS Client to create/update object and connect to the server ... the same steps that the doc provides (LWM2M-Client> ...)
Maybe I'm not making my point clearly... :)
Apart from the test you describe, note this repository includes a set of unit tests that act as regression for any new change. The command grunt test
runs this regressions and reports any potencial error.
(Note however this is a necessary but not sufficient condition. Unit tests are not perfect and doesn't cover all the possible cases so grunt test
could be ok and the modification of the code introduce some bug/issue. However, let's have at least that minimal check).
If the grunt test
goes ok, I'd suggest as next step you create a pull request with the proposed change. Eventually that PR will be reviewed and merged.
Thanks!
Dear @pasquy73,
I think that the problem is that https://github.com/Fiware/iot.IoTagent-LWM2M/blob/1cdf6abc96654aca2f912cad01d5fdfcd21d7ec8/docs/configurationProvisioning.md is not updated.
As you can see in the reference documentation for the IoT Agents https://github.com/telefonicaid/iotagent-node-lib#configurationapi, the payload field to define active attributes is now active.
Could you please check if the example works using active instead of attributes? If it does, I will submit a PR to upload the example.
Thanks in advance and BR.
Daniel
Here the installation and execution steps of my test on my Win7 with active attribute in the payload for "Power Control" in configuration provisioning and no change in the commonLwm2m.js (only registeredDevice.active):
git clone https://github.com/Fiware/iot.IoTagent-LWM2M.git
cd iot.IoTagent-LWM2M
npm install
start the server
node bin/lwm2mAgent.js config-blank.js
git clone https://github.com/telefonicaid/lwm2m-node-lib.git
cd lwm2m-node-lib
npm install
start the client
node bin/iotagent-lwm2m-client.js
run the test 1) configuration provisioning (https://github.com/Fiware/iot.IoTagent-LWM2M/blob/1cdf6abc96654aca2f912cad01d5fdfcd21d7ec8/docs/configurationProvisioning.md):
LWM2M-Client> create /6/0
LWM2M-Client> create /3303/0
LWM2M-Client> create /3312/0
LWM2M-Client> set /6/0 0 12
LWM2M-Client> set /6/0 1 -4
LWM2M-Client> set /3303/0 0 23
LWM2M-Client> set /3312/0 0 On
connection
LWM2M-Client> connect localhost 5684 weather1 /weatherBaloon
test in orion
curl -v http://orion:1026/v2/entities/weather1:WeatherBaloon -s -S --header "fiware-service: smartGondor" --header "fiware-servicepath: /gardens"
response (Power Control empty - I expected "On" value)
{"id":"weather1:WeatherBaloon","type":"WeatherBaloon","Power Control":{"type":"Boolean","value":" ","metadata":{}}}
2) device provisioning (https://github.com/Fiware/iot.IoTagent-LWM2M/blob/1cdf6abc96654aca2f912cad01d5fdfcd21d7ec8/docs/deviceProvisioning.md)
bin/iotagent-lwm2m-client.js
LWM2M-Client> create /7392/0
LWM2M-Client> set /7392/0 1 89
LWM2M-Client> set /7392/0 2 "First robot here"
LWM2M-Client> set /7392/0 3 "[0, 0]"
connection
LWM2M-Client> connect localhost 5684 robot1 /
update battery attribute:
LWM2M-Client> set /7392/0 1 67
curl -v http://orion:1026/v2/entities/Robot:robot1/attrs/Battery -s -S --header "fiware-service: smartGondor" --header "fiware-servicepath: /gardens"
response (OK)
{"type":"number","value":"67","metadata":{}}
Please note that both the tests I've this error:
... An error occurred creating COAP Listener: {"code":"EACCES", "errno":"EACCES","syscall":"bind","address":"0.0.0.0","port":53517}
but at the end ...
... COAP Server started successfully
Anyway, if I use the LWM2M 0.3.0, then my test works both device and service provisioning:
git clone https://github.com/Fiware/iot.IoTagent-LWM2M.git iot.IoTagent-LWM2M-0.3.0 --branch 0.3.0 --single-branch
PR #119 has been merged into master and we understand this issue is solved (so the issue is closed). Could you confirm @pasquy73 ?
Hi all,
I repeated the test above and it doesn't still work, but the query to orion provides:
{"error":"NotFound","description":"The requested entity has not been found. Check type and id"}
@pasquy73 thanks for the report. I'm reopening the issue.
@dcalvoalonso , as author of the PR that addressed this issue (PR #119), what do you think on this?
Hi @pasquy73 , could you please confirm that you are using FIWARE service and subservice with lowercases in all the requests? It would be also good that you delete old MongoDB databases.
Hi Alonso, yes I'm using lowercase for service and subservice; I deleted the data in mongo (/iot/services?apikey=&resource=/weatherBaloon), I tried both config-blank (deviceRegistry = memory) and with mongo.
My provisioning is a POST to /iot/services (you can try my example above using the config-blank):
"services":[
{
"resource":"/weatherBaloon",
"apikey":"",
"type":"WeatherBaloon",
"commands":[],
"lazy":[
{
"name":"Longitude",
"type":"double"
},
{
"name":"Latitude",
"type":"double"
},
{
"name":"Temperature Sensor",
"type":"degrees"
}
],
"active":[
{
"name":"Power Control",
"type":"Boolean"
}
]
}
]
}
@pasquy73 for reference... which exact version of IOTA are you usring? I mean, the githash corresponding to the version you are using for testing.
I'm not sure to understand your request; I used git clone https://github.com/Fiware/iot.IoTagent-LWM2M.git and it's master. I also saw that https://github.com/telefonicaid/lightweightm2m-iotagent.git is a mirror of https://github.com/Fiware/iot.IoTagent-LWM2M.git.
Anyway in my '.git/refs/heads' folder I've a master file with:
f97f62bb872a3e0e94b087eeb1cc3e26dfe75207
@pasquy73 , in order to send the query to the CB are you using the following request?
curl -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' --header 'fiware-service: weather' --header 'fiware-servicepath: /baloons' -d '
{
"entities": [
{
"type": "WeatherBaloon",
"isPattern": "false",
"id": "weather1:WeatherBaloon"
}
],
"attributes" : [
"Latitude"
]
}
' 'http://localhost:1026/v1/queryContext'
Anyway in my '.git/refs/heads' folder I've a master file with: f97f62bb872a3e0e94b087eeb1cc3e26dfe75207
That's the githash I were referring. Thanks!
(Another way of getting it is running git log | head -n 1
in your working copy)
Any update on this issue? I tried with the latest docker image on fiware/lightweightm2m-iotagent repo, using "active" instead of "attributes" in the payload for device provisioning, but when I checked in the database, it was not recorded, there were only lazy and commands attributes.
@letavia is your last comment in this issue related with what you mentions here: https://github.com/telefonicaid/lightweightm2m-iotagent/issues/112#issuecomment-486260958 ?
Yes, and I will continue in issue #112.
Hi all, I'm testing the configuration provisioning at this link https://github.com/Fiware/iot.IoTagent-LWM2M/blob/1cdf6abc96654aca2f912cad01d5fdfcd21d7ec8/docs/configurationProvisioning.md and I'm using the configuration group for devices with type WeatherBaloon. I noticed that there was a change from 'attributes' to 'active' in the payload of REST call (curl localhost:4041/iot/services ...) and my old test doesn't work.
I'm not sure if this is the right solution, but I've added back 'registeredDevice.attributes' in the commonLwm2m.js file as follow:
So with these changes, my tests work for both service and device (https://github.com/Fiware/iot.IoTagent-LWM2M/blob/1cdf6abc96654aca2f912cad01d5fdfcd21d7ec8/docs/deviceProvisioning.md) configuration. Please let me know if I'm right or not.