![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
ttn-azure-iothub
Advanced tools
This is an example integration of The Things Network with Azure IoT Hub. This integration features creating devices in the Azure IoT Hub device registry as well as sending events from uplink messages.
This integration requires an shared access policy key name with Registry write and Device connect permissions. In this example, we use the iothubowner policy which has these permissions enabled by default.
'use strict';
const ttnazureiot = require('ttn-azure-iothub');
// Replace with your AppEUI and App Access Key
const appEUI = '<insert AppEUI>';
const appAccessKey = '<insert App Access Key>';
// Replace with your Azure IoT Hub name and key
const hubName = '<insert hub name>';
const keyName = 'iothubowner';
const key = '<insert key>';
const bridge = new ttnazureiot.Bridge(appEUI, appAccessKey, hubName, keyName, key);
bridge.on('ttn-connect', () => {
console.log('TTN connected');
});
bridge.on('error', err => {
console.warn('Error', err);
});
bridge.on('uplink', data => {
console.log('Uplink', data);
});
When creating and initializing the Bridge
, you can specify options:
const options = {};
const bridge = new ttnazureiot.Bridge(appEUI, appAccessKey, hubName, keyName, key, options);
ttnBroker
The MQTT broker to connect to. Default:
options.ttnBroker = 'staging.thethingsnetwork.org'
createMessage
The function to create a message. By default, the message is a combination of the result of the payload functions fields
, the unique device ID and the server time:
options.createMessage = function(uplink) {
const metadata = {
deviceId: uplink.devEUI,
time: uplink.metadata.server_time
};
return Object.assign({}, uplink.fields, metadata);
}
Note: if there are no payload functions specified for the concerning application, the fields
object contains a raw
property with the bytes received.
Note: if the result of your payload functions contain the fields deviceId
or time
, these fields will be overwritten by the metadata. Use a custom createMessage
function to use custom field names.
Follow these steps to deploy an Azure WebJob using Node.js that runs the integration between The Things Network and Azure IoT Hub.
npm init
to initialize a new WebJob using Node.js. Use server.js
as entry pointnpm install --save ttn-azure-iothub
to install this packageserver.js
, copy the example from above and insert your keysnpm run start
to verify that the bridge works. This is example output:TTN connected
0004A30B001B442B: Handling uplink
Uplink { devEUI: '0004A30B001B442B',
message: '{"lux":1000,"temperature":19.82,"deviceId":"0004A30B001B442B","time":"2016-06-14T16:19:15.402956092Z"}' }
0004A30B001B442B: Handling uplink
Uplink { devEUI: '0004A30B001B442B',
message: '{"lux":1000,"temperature":19.82,"deviceId":"0004A30B001B442B","time":"2016-06-14T16:19:37.546601639Z"}' }
...
node_modules
folder) as ZIP file[06/14/2016 16:27:47 > 996af8: INFO] TTN connected
[06/14/2016 16:28:07 > 996af8: INFO] 0004A30B001B442B: Handling uplink
[06/14/2016 16:28:10 > 996af8: INFO] Uplink { devEUI: '0004A30B001B442B',
[06/14/2016 16:28:10 > 996af8: INFO] message: '{"lux":1000,"temperature":19.82,"deviceId":"0004A30B001B442B","time":"2016-06-14T16:28:06.766772461Z"}' }
[06/14/2016 16:28:29 > 996af8: INFO] 0004A30B001B442B: Handling uplink
[06/14/2016 16:28:29 > 996af8: INFO] Uplink { devEUI: '0004A30B001B442B',
[06/14/2016 16:28:29 > 996af8: INFO] message: '{"lux":1000,"temperature":19.82,"deviceId":"0004A30B001B442B","time":"2016-06-14T16:28:28.908965124Z"}' }
You are now ready to process your data in an Azure Stream Analytics job.
FAQs
The Things Network integration with Azure IoT Hub
The npm package ttn-azure-iothub receives a total of 1 weekly downloads. As such, ttn-azure-iothub popularity was classified as not popular.
We found that ttn-azure-iothub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.