IoTAgent-LoRaWAN is apparently not working as expected - iot

I was trying to provisioning the IoTAgent-LoRaWAN using the TTN credentials, I'm following the official docs and this is my POST request:
{
"devices": [
{
"device_id": "{{node}}",
"entity_name": "LORA-N-0",
"entity_type": "LoraDevice",
"timezone": "Europe/Madrid",
"attributes": [
{
"object_id": "potVal",
"name": "Pot_Value",
"type": "Number"
}
],
"internal_attributes": {
"lorawan": {
"application_server": {
"host": "eu.thethings.network",
"username": "{{TTN_app_id}}",
"password": "{{TTN_app_pw}}",
"provider": "TTN"
},
"dev_eui": "{{TTN_dev_eui}}",
"app_eui": "{{TTN_app_eui}}",
"application_id": "{{TTN_app_id}}",
"application_key": "{{TTN_app_skey}}"
}
}
}
]
}
Obviously I'm using Postman to manage all those HTTP requests in a collection and I've setup a few environment variables that are:
{{node}} -> the device ID node_0
{{TTN_app_id}} -> my app id which I've chosen dendrometer
{{TTN_app_pw}} -> the application access key shown in the picture (It can be found in the same view than the Application Overview; https://console.thethingsnetwork.org/applications/<application_id>)
{{TTN_dev_eui}} and {{TTN_app_eui}} also shown in the following picture (regarding to device; I think these are not sensitive info because TTN is not hiding them, that's because I'm posting the picture)
{{TTN_app_skey}} -> The Application Session Key also shown in the following picture (the last one)
The point is ... once I've provisioned IoTAgent using that request, the docker-compose logs -f iot-agent shows the following errors:
fiware-iot-agent | {"timestamp":"2020-06-23T11:45:53.689Z","level":"info","message":"New message in topic"}
fiware-iot-agent | {"timestamp":"2020-06-23T11:45:53.690Z","level":"info","message":"IOTA provisioned devices:"}
fiware-iot-agent | {"timestamp":"2020-06-23T11:45:53.691Z","level":"info","message":"Decoding CaynneLPP message:+XQ="}
fiware-iot-agent | {"timestamp":"2020-06-23T11:45:53.691Z","level":"error","message":"Error decoding CaynneLPP message:Error: Invalid CayennLpp buffer size"}
fiware-iot-agent | {"timestamp":"2020-06-23T11:45:53.691Z","level":"error","message":"Could not cast message to NGSI"}
So I think there is something not working properly. That's my docker-compose.yml, btw http://ix.io/2pWd
However I don't think the problem is caused by docker, all containers are working as expected apparently because I can request their versions and I don't see error messages in the logs.
Also ... I feel the docs like incomplete, I'd like more info, about how to subscribe those provisioned devices with OrionCB (?) or Delete them (that's not shown in the docs, although is just a DELETE request to the proper URL.)
Anyway ... What I'm doing wrong? Thank you all.
EDIT: I feel like there is something wrong in the IoTAgent itself, there is a typo in the following error messages:
fiware-iot-agent | {"timestamp":"2020-06-23T11:45:53.691Z","level":"info","message":"Decoding CaynneLPP message:+XQ="}
fiware-iot-agent | {"timestamp":"2020-06-23T11:45:53.691Z","level":"error","message":"Error decoding CaynneLPP message:Error: Invalid CayennLpp buffer size"}
Because it isn't CaynneLPP but CayenneLPP. I've also opened an issue in its GitHub repo but I don't expect they answer any time soon. I actually feel like this project has been abandoned.

It's apparently a problem with encoding, I was using the encoding method suggested by arduinio-lmic library but FIWARE does work under CayenneLPP data model. So I'm going to try replace that encoding method.
Thank you all anyway and specially to #arjan

Related

Cumulocity SmartREST GET Template using MQTT

I am trying to receive a response using a custom GET template implemented on the Cumulocity UI however I'm having some trouble. I have defined my message template like so:Message Template and my response template like so: Response template.
At the moment when I publish to topic 's/uc/template1' (where template1 is my X-ID) with the payload of '999, 12345'(where 12345 is my External ID), no response is received and no error is found. The speeds are known to exist in the object because when I request a GET command to {{url}}/inventory/managedObjects this responds with:
"speed": {
"1": {
"unit": "m/min",
"value": 1
},
"2": {
"unit": "m/min",
"value": 1
}
I've also followed this post where #TyrManuZ suggests to add c8y_Global: {} to the application. I have done this through a PUT request to {{url}}/inventory/managedObjects/{{deviceId}} on Postman and can verify that c8y_Global: {} exists there.
Is there something I am doing wrong, and if so what is the correct way? Any help would be greatly appreciated!

Making a simple authorized request to eBay

I'm planning to integrate a website with eBay using PHP, but first I'm using Postman to test everything.
Authorization took me an entire day, but I think I've got it working now. (I had to update to the latest version of Postman, then I got it to create a token for me.)
I say I think because I haven't managed to get a single request to work. I deliberately chose bulkGetInventoryItem (documentation) as it seemed like one of the easier authorized requests to get working. I just know that when the authentication settings are wrong, I get a different error message to when they are right.
For troubleshooting reasons, I made a token with all the scopes:
https://api.ebay.com/oauth/api_scope
https://api.ebay.com/oauth/api_scope/sell.marketing
https://api.ebay.com/oauth/api_scope/sell.inventory
https://api.ebay.com/oauth/api_scope/sell.account
https://api.ebay.com/oauth/api_scope/sell.fulfillment
https://api.ebay.com/oauth/api_scope/sell.finances
https://api.ebay.com/oauth/api_scope/sell.payment.dispute
https://api.ebay.com/oauth/api_scope/commerce.identity.readonly
(added as space-separated list of links)
I have changed one of the eBay listings to have an SKU of "123456" just for this test, however the error I get is exactly the same as if I change "sku": "123456" to "sku": "anObviouslyFakeSKU", but anything else I change creates a new error, so I'm suspecting the issue to be SKU related, but maybe it isn't. (I've found the eBay API to be very poor at sending relevant error messages.)
I'm quite new to Postman, so it's likely a rookie mistake.
Earlier errors have shown to be minor punctuation issues or wrong radio buttons ticked, so hopefully whatever the error is this time, it should appear in this screenshot.
What did I do wrong this time? (Let me know if there are any other screenshots I can send that might help.)
To help, both with the post's SEO, and ease of copy/pasting, I am transcribing the important text in the screenshot above:
url
POST https://api.ebay.com/sell/inventory/v1/bulk_get_inventory_item
body, raw
{
"requests": [
{
"sku": "123456"
}
]
}
output
{
"errors": [
{
"errorId": 2003,
"domain": "ACCESS",
"category": "APPLICATION",
"message": "Internal error",
"longMessage": "There was a problem with an eBay internal system or process. Contact eBay developer support for assistance",
"parameters": [
{
"name": "reason",
"value": "Failed to transform underlying error response, see logs."
}
]
}
]
}
Update:
One more screenshot
Update 2:
Another screenshot
A few things you need to check for in Postman.
When you authenticate and receive a token are you posting that token with your api calls like this one POST https://api.ebay.com/sell/inventory/v1/bulk_get_inventory_item?
Have you set the Authorization HTTP header for authentication authorization?
Have you set the Content-Type header for the call to application/json?
More info here: https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkGetInventoryItem
Update
Authorization with environment variable in Postman:
Postman environment variables documentation:
https://learning.postman.com/docs/postman/variables-and-environments/variables/
I figured out the issue. My biggest mistake was choosing bulkGetInventoryItem as the "simplest" call. I should have chosen getInventoryItem, as the error reporting on that function is far more user friendly.
So the error I got, for exactly the same request was "We didn't find the entity you are requesting. Please verify the request"
A quick google of the error found me this page https://forums.developer.ebay.com/questions/17883/cannot-get-my-listed-product-by-get-inventory-api.html which led me to the correct answer!
The inventory item I was trying to access was unreachable because it was not created through the developer API.
I hope this answer helps others, as it wasted a full day of my life trying getInventoryItem before tackling bulkGetInventoryItem.

Schema issue with Kafka schema registry

I know I come to you with any news, but I'm stuck solving an issue that probably is my fault, indeed I can't realize what's the solution.
I'm using a standalone installation of the Confluent platform (4.0.0 open source version) in order to demonstrate how to adopt the platform for a specific use case.
Trying to demonstrate the value of using the schema registry I'm facing the following issue posting a new schema with Postman.
The request is:
http://host:8081/subjects/test/versions
, method POST
, Header: Accept:application/vnd.schemaregistry.v1+json, application/vnd.schemaregistry+json, application/json
Content-Type:application/json
, Body:
{"schema":"{{\"namespace\":\"com.testlab\",\"name\":\"test\",\"type\":\"record\",\"fields\":[{\"name\":\"resourcepath\",\"type\":\"string\"},{\"name\":\"resource\",\"type\":\"string\"}]}}" }
The response is: {"error_code":42201,"message":"Input schema is an invalid Avro schema"}
Looking at docs and after googling a lot I'm without options.
Any suggestion ?
Thanks for your time
R.
You have extra {} around the schema field.
One way to test this is with jq
Before
$ echo '{"schema":"{{\"namespace\":\"com.testlab\",\"name\":\"test\",\"type\":\"record\",\"fields\":[{\"name\":\"resourcepath\",\"type\":\"string\"},{\"name\":\"resource\",\"type\":\"string\"}]}}" }' | jq '.schema|fromjson'
jq: error (at <stdin>:1): Objects must consist of key:value pairs at line 1, column 146 (while parsing '{{"namespace":"com.testlab","name":"test","type":"record","fields":[{"name":"resourcepath","type":"string"},{"name":"resource","type":"string"}]}}')
After
$ echo '{"schema":"{\"namespace\":\"com.testlab\",\"name\":\"test\",\"type\":\"record\",\"fields\":[{\"name\":\"resourcepath\",\"type\":\"string\"},{\"name\":\"resource\",\"type\":\"string\"}]}" }' | jq '.schema|fromjson'
{
"namespace": "com.testlab",
"name": "test",
"type": "record",
"fields": [
{
"name": "resourcepath",
"type": "string"
},
{
"name": "resource",
"type": "string"
}
]
}
See my comment here about importing AVSC files so that you don't need to type out the JSON on the CLI

How to send a device management request using NodeRed or any REST client

I am trying to sent a DM firmware update command from a NodeRed Flow.
Function node:
msg.payload = {"MgmtInitiationRequest": {
"action":"firmware/update",
"devices": [{
"typeId": "myType",
"deviceId": "myDevice"
}]
}}
msg.headers={"Content-Type":"application/json"}
return msg;
I send it to a http request node with a POST to
https://orgid.internetofthings.ibmcloud.com/api/v0002/mgmt/requests
Basic Authentication with api keys. I based it of Initiate a device management request
I get back a 403 which the docs have as:
One or more of the devices does not support the requested action
Anyone see what I'm missing? It works fine from the IoT Platform UI to the same devicetype/deviceid.
EDIT: Same 403 if I use a Rest client like Postman.
The swagger API documentation is a little bit misleading in that the 'body' parameter is given a name.
But, like the other POST APIs, that name isn't actually included anywhere as part of the payload.
The payload should just look like this:
{
"action": "firmware/update",
"devices": [
{
"typeId": "string",
"deviceId": "string"
}
]
}
This page in the documentation provides more detail:
https://console.ng.bluemix.net/docs/services/IoT/devices/device_mgmt/requests.html#firmware-actions-update
Has your appliance published the set of supported commands it supports when it announced itself as a managed device?
A device connects to the Watson IoT Platform and uses the managed devices operation to become a managed device.
Which looks something like this
Topic: iotdevice-1/mgmt/manage
{
...
"supports": {
"deviceActions": true,
"firmwareActions": boolean
},
...
},
...
}
https://console.ng.bluemix.net/docs/services/IoT/devices/device_mgmt/index.html

Get Recommendation from LinkedIn API returns empty map [:] as response

I have created a web application from which I am trying to get recommendations of a user from his/her LinkedIn Profile using URL
String url="https://api.linkedin.com/v1/people/~:(recommendations-received:(id,recommendation-type,recommendation-text,recommender))?format=json"
When I am using this URL in the
Api Explorer it works fine. And gives output:-
{ "recommendationsReceived": {
"_total": 2,
"values": [
{
"id": 558598601,
"recommendationText": "xxx is among the best team players I ever worked with. He has handled client effectively with smooth operations. I had always seen him as person with solution mindset and always look for solution rather than thinking about the problem. ",
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXX"
}
},
{
"id": ZZZZ,
"recommendationText": "XXX is one of the most dedicated person at work.I always him with a flexible attitude and ready to adapt himself in all situation.I have seen him work all night to catch up all the deadlines and deliver on time ."
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXXX"
}
}
] } }
The problem comes, when I am using this URL in my Developer app.It doesn't give any error just simple return an empty map [:] as output in response
Irrespective of these recommendation fields, I successfully get the user basic profile data such as email, id, image,firstName,lastName.Means my code is working for other fields well but not for these recommendation fields*
To find the solution, I did some internet surfing and find a link of Linked API docs
Linked API Docs
As per Docs following selection of profile fields are only available
to applications that have applied and been approved for the Apply with
LinkedIn program:
Recommendation Fields
I already created a LinkedIn Developer account to get key & Secret
So how do I apply and get approval for Apply with LinkedIn Recommendation Fields.
I already have seen the LinkedIn support but can't find the way to ask question to the Linked Developer help support
Please suggest me the right way.
After a long internet surfing,I have found something fruitful that, I have to fill up a form to get these fields.Here is the form
along with its procedural details
You can use just recommendations-received keyword. Try the following link. I am getting all recommendations details with this link.
https://api.linkedin.com/v1/people/~:(recommendations-received)?format=json

Resources