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

Data value for sending update #53

Open
letavia opened this issue May 13, 2019 · 1 comment
Open

Data value for sending update #53

letavia opened this issue May 13, 2019 · 1 comment

Comments

@letavia
Copy link

letavia commented May 13, 2019

I have problem updating the device data. I followed the steps in provisioning page. Below is my configuration:

Group provisioning: http://localhost:4041/iot/services

fiware-service: dumbMordor
fiware-servicepath: /deserts

payload:

{
  "services": [
    {
      "resource": "/sigfoxDev",
      "apikey": "23HJK3Y9090DSFL173209HV8801232",
      "type": "SIGFOX",
      "commands": [],
      "lazy": [],
      "active": [],
      "trust": "cc872bdd38a364f5f188726128a8732492a08176"
    }
  ]
}

Note: I was using trust because my CB is behind pep-proxy.

Device provisioning: http://localhost:4041/iot/devices

fiware-service: dumbMordor
fiware-servicepath: /deserts

payload:

{
  "devices": [
    {
      "device_id": "sigApp2",
      "protocol": "SIGFOX",
      "service" : "dumbMordor",
      "service_path": "/deserts",
      "entity_name": "sigApp2",
      "entity_type": "SIGFOX",
      "timezone": "America/Santiago",
      "attributes": [
              {
          "name": "time",
          "type": "String"
        },
        {
          "name": "statin",
          "type": "String"
        },
        {
          "name": "lng",
          "type": "String"
        },
        {
          "name": "lat",
          "type": "String"
        }
      ],
      "lazy": [],
      "static_attributes": [],
      "commands": [],
      "internal_attributes": [
        {
            "mapping": "time::String:20  statin::String:10 lng::String:4 lat::String:4"
        }
    ]
    }
  ]
}

The entity was correctly created in CB. Then I tested using ./bin/sigfox-test.js

This is the config

{
    "id": "sigApp2",
    "time": "1430908992",
    "statin": "0817",
    "lng": "9",
    "lat": "50"
}

I wanted to sendMeasure but not sure what to put as the data. In the documentation there's info about data format conversion, how should I go about this?

I also tried to update the data through REST API:
http://localhost:17428/update?device_id=sigApp2&time=1430908992&statin=0817&lng=77&lat=41

but I got 400 Bad Request with error message:

{
"name": "MANDATORY_FIELDS_NOT_FOUND",
"message": "Some of the mandatory fields for the request were not found"
}

The log:

time=2019-05-13T12:18:19.525Z | lvl=DEBUG | corr=77a13132-4468-49d6-ad54-9282406ec0ee | trans=77a13132-4468-49d6-ad54-9282406ec0ee | op=IoTAgentSIGFOX.SigfoxServe
r | srv=n/a | subsrv=n/a | msg=Request for path [/update] from [localhost:17428] | comp=IoTAgent
time=2019-05-13T12:18:19.525Z | lvl=DEBUG | corr=77a13132-4468-49d6-ad54-9282406ec0ee | trans=77a13132-4468-49d6-ad54-9282406ec0ee | op=IoTAgentSIGFOX.SigfoxServe
r | srv=n/a | subsrv=n/a | msg=Body:
undefined

| comp=IoTAgent
time=2019-05-13T12:18:19.525Z | lvl=ERROR | corr=77a13132-4468-49d6-ad54-9282406ec0ee | trans=77a13132-4468-49d6-ad54-9282406ec0ee | op=IoTAgentSIGFOX.SigfoxHandl
ers | srv=n/a | subsrv=n/a | msg=Mandatory fields not found in request | comp=IoTAgent
time=2019-05-13T12:18:19.525Z | lvl=DEBUG | corr=77a13132-4468-49d6-ad54-9282406ec0ee | trans=77a13132-4468-49d6-ad54-9282406ec0ee | op=IoTAgentSIGFOX.SigfoxServe
r | srv=n/a | subsrv=n/a | msg=Error [MANDATORY_FIELDS_NOT_FOUND] handling request: Some of the mandatory fields for the request were not found | comp=IoTAgent

What is the text in bold italic referring to? What am I missing here?

Any advice is more than appreciated.

@fgalan
Copy link
Member

fgalan commented Jun 26, 2019

Try adding the apiKey as an additional URI query parameter, i.e. k=23HJK3Y9090DSFL173209HV8801232 and tell us if that worked or not (in the second case, please include the new log you get). Thanks!

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

2 participants