Best way to send xml from iot device to azure iot hub? - iot

I have an energy monitor that can only output xml data via http post. I am looking to send this data to an azure-iot hub for processing and storage. What is the best way to send xml data to from several of these devices to the hub? I have looked at various gateways but havent found a simple, scalable, cost effective way to do this. I am open to having some sort of intermediary but they all introduce a layer of complexity to simply sending the data to the hub.

Your energy monitor can publish a telemetry data direct to the Azure IoT Hub using a HTTPs protocol.
The following is an example:
and the body:
and the Device Explorer output:
and the blob Storage:
{
"EnqueuedTimeUtc": "2019-09-25T15:58:25.0900000Z",
"Properties": {
"abcd": "abcd1234"
},
"SystemProperties": {
"connectionDeviceId": "device2",
"connectionAuthMethod": "{\"scope\":\"device\",\"type\":\"sas\",\"issuer\":\"iothub\",\"acceptingIpFilterRule\":null}",
"connectionDeviceGenerationId": "636842109368955167",
"contentType": "application/xml",
"contentEncoding": "",
"enqueuedTime": "2019-09-25T15:58:25.0900000Z"
},
"Body": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4gDQo8UGFyYUluZm8gPg0KICA8TmFtZT5Wb2x0YWdlPC9OYW1lPg0KICA8Q29kZT5VczwvQ29kZT4NCiAgPFVuaXQ+VjwvVW5pdCA+DQogIDxGcmVxPjQwPC9GcmVxID4NCiAgPFN0YXJ0PjA8L1N0YXJ0Pg0KICA8RW5kPjI4OS41PC9FbmQ+DQo8L1BhcmFJbmZvPg0K"
}
Note, that the body is a Base64 encoded xml text:

Related

MQTT - How to change the behaviour of the default parser for JSON on the CE (SenML)?

I have a gateway fromKhomp manufacturer which delivers packages in the following format (SenML):
message: [
{
"bn": "000D6FFFFE642E09",
"bt": 1611339204
},
{
"n": "model",
"vs": "nir21z"
},
{
"n": "Geladeira Temp",
"u": "Cel",
"v": 4.0
}
When I connect to the Thingsboard platform, the internal GW/Parser breaks as an array before the Input in the Root Rule Chain, and threats as individual packets, but since the first position in this array corresponds to the device ID (MAC) I need to have the whole message to be parser in a script. Does anyone know a way to get the information before the GW parses the message?
If you're using Thingsboard CE then I think you will need to first forward the data to a middleware service to restructure the payload. If you are familiar with AWS Lambda you can do it there.
It would just be a simple script that takes an input payload, restructures, and then forwards to your Thingsboard deployment.
If you're using Thingsboard PE then you can use Integration/Data Converters to do this.

Custom key URI support for AES-128 encryption in google cloud transcoder

Not able to create a HLD stream with AES 128 encryption based on the public document
Issue Summary: Customer is looking at using our transcoding API to provide DRM capabilities to one of their learning platform. They require HLS and DASH with AES 128 bit encryption . I have followed the public documentation but not getting the m3u8 or TS files . The job created from 'preset/web-hd' is working correctly.
Please help me by providing exact sample codes for the above scenario. Please provide with complete code required for HLS and DASh with AES 128 bit encryption.
Project Number: project-number
Job ID: job-id
Location:
Job Config elementaryStreams: [ { key: 'video-stream1', videoStream: { codec: 'h264', heightPixels: 720, widthPixels: 1280, bitrateBps: 2500000, frameRate: 60, }, }, ], muxStreams: [ { "key": "360p-my-video-ts", "fileName": "360p-my-video.ts", "container": "ts", "elementaryStreams": [ "video-stream1" ], "encryption": { "key": "aabbccddeeff11223344556677889900", "iv": "00112233445566778899aabbccddeeff", "sampleAes": { "keyUri": "skd://00112233445566778899aabbccddeeff" }
I think you miss the "manifest" section on the bottom of the "configure-drm" link.
Also please refer to https://cloud.google.com/transcoder/docs/how-to/configure-drm (there are some samples)
The Transcoder API is mostly focused on supporting DRM systems, when you use your own key you have to specify full path to the key, unfortunately do to some validation in our API it is not possible right now, we will work on allowing custom URLs.
We have a fix ready (this will allow customers to specify key URIs with HTTP protocol as well), but it will take a few weeks to roll out to Prod. If you want to try it out right now you can generate the manifest with sdk:// URI in it and replace it with the HTTP link to the key in the manifest, but I'd suggest to wait until the fix is available in Prod.
In the meantime here are some issues with your config:
The decryption key should be in binary rather than plain text
In the job config you are using Sample-AES encryption that is supposed to be used with Fairplay, you should use AES-128 instead

Map custom properties when ingesting IoT hub into ADX

I have the following setup: an IoT Hub ih1 routing messages to Azure Data Explorer adx1. Messages on the IoT hub look like the following:
{
"body": {
{ "value": "myValue" }
},
"messageId": "deadbeef-1234-5678-9abc-0123456789ab",
"properties": {
"myCustomProperty": "myCustomValue"
}
}
(There are more root properties and more custom properties, but the above outline should be clear).
I want to map the custom properties of the IoT Hub message onto a table column. So far, I've only been able to map the system properties and the body property content (in above example: "value": "myValue") to a column.
Using the $.propertyName will only refer to properties within the body property, not on properties on the root of the message.
How can I map custom properties to a column?
Currently this is not implemented in ADX.
As a workaround you can route messages to en Event Hub and then to ADX. Then you should be able to access that properties.
Payload enrichment for IoT Hubs and Event Hubs in ADX is currently not fully implemented and is limited to system properties only.
Full support is on the backlog but we have no ETA at the present time.

FIWARE Metadata in IoTAgent

I try to set up a TTN based LoRaWAN Monitoring of my Gateways and devices inside a FIWARE-Environment. Therefore it would be essential to access data not in payload_field of the MQTT-Broker of TTN.
I wonder if it is possible to access field like counter, port, app_id and metadata.
I did not find a possibility yet. Does any of you face the same problem and got a solution to this challenge?
I use the following relevant FIWARE-components in a docker environment:
fiware/orion:2.2.0
fiware/iotagent-lorawan:1.2.3
mongo:3.6.8
If you need to receive metadata directly from LoRaWAN, you will have to customize the code within the LoRaWAN IoT Agent - this just passes measures by default, but the IoT Agent node lib interface is capable of receiving metadata as well.
Alternatively a recent PR Request for the IoT Agent node lib allows for additional static metadata to be added during the provisioning stage and sent as part of the requests to the context broker. You would need to use the latest development code base as the library hasn't been ported to the LoRaWAN IoT Agent yet - amend the iotagent-node-lib dependency in the package.json as shown:
"dependencies": {
...
"iotagent-node-lib": "git://github.com/telefonicaid/iotagent-node-lib.git#master",
...
},
... etc
The documentation can be found here
Attributes with metadata are provisioned with an additional parameter as shown:
"attributes": [
{"object_id": "s", "name": "state", "type":"Text"},
{"object_id": "l", "name": "luminosity", "type":"Integer",
"metadata":{
"unitCode":{"type": "Text", "value" :"CAL"}
}
}

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

Resources