Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sigfox-iotagent - Send Measure - DEVICE_NOT_FOUND #27

Open
ancappa opened this issue May 14, 2018 · 4 comments
Open

sigfox-iotagent - Send Measure - DEVICE_NOT_FOUND #27

ancappa opened this issue May 14, 2018 · 4 comments

Comments

@ancappa
Copy link

ancappa commented May 14, 2018

Hi, here is the

  1. DEVICE PROVISIONING REQUEST
    POST /iot/devices
    Headers:
    fiware-service: malaga_1
    fiware-servicepath: /malaga_1_parking
    Content-Type: application/json
    Payload:
    {
    "devices": [{
    "device_id": "sigApp2",
    "service" : "malaga_1",
    "service_path": "/malaga_1_parking",
    "entity_name": "sigApp2",
    "entity_type": "Device",
    "timezone": "America/Santiago",
    "protocol": "SIGFOX",
    "attributes": [
    {
    "name": "time",
    "type": "String"
    },
    {
    "name": "statin",
    "type": "String"
    },
    {
    "name": "lng",
    "type": "String"
    },
    {
    "name": "lat",
    "type": "String"
    },
    {
    "name": "theCounter",
    "type": "Integer"
    },
    {
    "name": "theParam1",
    "type": "Integer"
    },
    {
    "name": "param2",
    "type": "Integer"
    },
    {
    "name": "tempDegreesCelsius",
    "type": "Integer"
    }, {
    "name": "voltage",
    "type": "Integer"
    }
    ],
    "lazy": [],
    "static_attributes": [],
    "commands": [],
    "internal_attributes": [
    {
    "mapping": "theCounter::uint:32 theParam1::uint:32 param2::uint:8 tempDegreesCelsius::uint:8 voltage::uint:16"
    }
    ]
    }
    ]
    }

  2. SERVICE PROVISIONING REQUEST
    POST /iot/services/
    Headers:
    fiware-service: malaga_1
    fiware-servicepath: /malaga_1_parking
    Content-Type: application/json
    Payload:
    {
    "services": [
    {
    "cbHost": "xxx.xxx.xxx.xxx:1026",
    "trust": "xxxxxx",
    "subservice": "/malaga_1_parking",
    "service": "malaga_1",
    "apikey": "XXXX",
    "resource": "/iot/d",
    "attributes": [],
    "lazy": [],
    "commands": [],
    "entity_type": "Device",
    "internal_attributes": [],
    "static_attributes": []
    }
    ]
    }

  3. SEND MEASURE Request
    GET sigfoxHost:sigfoxPort/update?id='sigApp2'&time='1430908992'&statin='0817'&lng=-4&lat=41&data=000000020000000000230c6f
    Headers:
    fiware-service: malaga_1
    fiware-servicepath: /malaga_1_parking
    RESPONSE:
    {
    "name": "DEVICE_NOT_FOUND",
    "message": "No device was found with id:'sigApp2'",
    "code": 404
    }

IoTAgent LOG:
time=2018-05-14T16:29:05.786Z | lvl=DEBUG | corr=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | trans=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | op=IoTAgentSIGFOX.SigfoxServer | srv=n/a | subsrv=n/a | msg=Request for path [/update] from [sigfoxHost:sigfoxPort] | comp=IoTAgent
time=2018-05-14T16:29:05.786Z | lvl=DEBUG | corr=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | trans=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | op=IoTAgentSIGFOX.SigfoxServer | srv=n/a | subsrv=n/a | msg=service: malaga_1 | comp=IoTAgent
time=2018-05-14T16:29:05.786Z | lvl=DEBUG | corr=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | trans=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | op=IoTAgentSIGFOX.SigfoxServer | srv=n/a | subsrv=n/a | msg=Unrecognized body type | comp=IoTAgent undefined
time=2018-05-14T16:29:05.787Z | lvl=DEBUG | corr=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | trans=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | op=IoTAgentSIGFOX.SigfoxHandlers | srv=n/a | subsrv=n/a | msg=Handling request with query [{"id":"'sigApp2'","time":"'1430908992'","statin":"'0817'","lng":"-4","lat":"41","data":"000000020000000000230c6f"}] | comp=IoTAgent
time=2018-05-14T16:29:05.789Z | lvl=DEBUG | corr=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | trans=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=n/a | subsrv=n/a | msg=Looking for entity with id ['sigApp2']. | comp=IoTAgent
Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
time=2018-05-14T16:29:05.803Z | lvl=DEBUG | corr=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | trans=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=n/a | subsrv=n/a | msg=Entity ['sigApp2'] not found. | comp=IoTAgent
time=2018-05-14T16:29:05.803Z | lvl=ERROR | corr=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | trans=6c0d50c2-f413-41d1-ab60-375a1ad85b01 | op=IoTAgentNGSI.Alarms | srv=n/a | subsrv=n/a | msg=Raising [MONGO-ALARM]: undefined | comp=IoTAgent

As you can see in the log, the srv=n/a | subsrv=n/a are not available, they have no value , so that the device is not found in the mongo db because the device search has no headers but the device exists in the mongo db.

Thanks in advance for you help.

@AlvaroVega
Copy link
Member

Did you configure config.iota.service and config.iota.subservice according that fiware-service and fiware-servicepath in config.js ?

@ancappa
Copy link
Author

ancappa commented May 16, 2018

Hi, yes, in config.js I've configured a default service and subservice,
do you mean this configuration? Here the piece of config.js
/**
* Default service, for IOTA installations that won't require preregistration.
/
// service: 'howtoService',
service: 'malaga_1',
/
*
* Default subservice, for IOTA installations that won't require preregistration.
*/
// subservice: '/howto',
subservice: '/malaga_1_parking',

In any case I expect the service and subservice values shall be dynamically read by the request headers fiware-service and fiware-servicepath and not only in the configuration file.
Thanks always

@ancappa
Copy link
Author

ancappa commented May 28, 2018

Hi, now I'm using the bin/sigfox-test.js client in order to send measure:
SIGFOX Test> sendMeasure 000000020000000000230c6f
SIGFOX Test>
Data successfully sent

The IoTAgent log is the following:
time=2018-05-28T16:18:18.573Z | lvl=DEBUG | corr=4f2a482a-cddc-422a-a8d0-f22782fc89dc | trans=4f2a482a-cddc-422a-a8d0-f22782fc89dc | op=IoTAgentSIGFOX.SigfoxServer | srv=n/a | subsrv=n/a | msg=Request for path [/update] from [localhost:8083] | comp=IoTAgent
time=2018-05-28T16:18:18.574Z | lvl=DEBUG | corr=4f2a482a-cddc-422a-a8d0-f22782fc89dc | trans=4f2a482a-cddc-422a-a8d0-f22782fc89dc | op=IoTAgentSIGFOX.SigfoxServer | srv=n/a | subsrv=n/a | msg=Unrecognized body type | comp=IoTAgent undefined
time=2018-05-28T16:18:18.575Z | lvl=DEBUG | corr=4f2a482a-cddc-422a-a8d0-f22782fc89dc | trans=4f2a482a-cddc-422a-a8d0-f22782fc89dc | op=IoTAgentSIGFOX.SigfoxHandlers | srv=n/a | subsrv=n/a | msg=Handling request with query [{"id":"sigfox1","time":"1430908992","statin":"0817","lng":"-4","lat":"41","data":"000000020000000000230c6f"}] | comp=IoTAgent
time=2018-05-28T16:18:18.577Z | lvl=DEBUG | corr=4f2a482a-cddc-422a-a8d0-f22782fc89dc | trans=4f2a482a-cddc-422a-a8d0-f22782fc89dc | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=n/a | subsrv=n/a | msg=Looking for entity with id [sigfox1]. | comp=IoTAgent
Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
time=2018-05-28T16:18:18.593Z | lvl=DEBUG | corr=4f2a482a-cddc-422a-a8d0-f22782fc89dc | trans=4f2a482a-cddc-422a-a8d0-f22782fc89dc | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=n/a | subsrv=n/a | msg=Entity [sigfox1] not found. | comp=IoTAgent

Can you help me sending measure to the IoTAgent Sigfox?
Thanks

@fgalan
Copy link
Member

fgalan commented Jun 26, 2019

@ancappa not sure if it helps, but I'd suggest to try without the single quotes. I mean instead of:

GET sigfoxHost:sigfoxPort/update?id='sigApp2'&time='1430908992'&statin='0817'&lng=-4&lat=41&data=000000020000000000230c6f

try:

GET sigfoxHost:sigfoxPort/update?id=sigApp2&time=1430908992&statin=0817&lng=-4&lat=41&data=000000020000000000230c6f

Looking to the log it seems the query includes the quotes so it doesn't find the device in the DB:

Handling request with query [{"id":"'sigApp2'","time":"'1430908992'","statin":"'0817'","lng":"-4","lat":"41","data":"000000020000000000230c6f"}

@telefonicaid telefonicaid deleted a comment from arilwan Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants