Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Pentenrieder ThomasPe

View GitHub Profile
@ThomasPe
ThomasPe / Dockerfile.amd64
Created Sep 16, 2020
Docker configuration for using noble / BLE in Azure IoT Edge
View Dockerfile.amd64
FROM node:10-slim
RUN apt-get update || : && apt-get -y install bluetooth bluez libbluetooth-dev libudev-dev build-essential make python
WORKDIR /app/
COPY package*.json ./
RUN npm install --production
@ThomasPe
ThomasPe / app.js
Created Sep 16, 2020
Reading Ruuvi Tag messages in IoT Edge
View app.js
Client.fromEnvironment(Transport, function (err, client) {
if (err) {
throw err;
} else {
client.on('error', function (err) {
throw err;
});
// connect to the Edge instance
client.open(function (err) {
@ThomasPe
ThomasPe / deployment.template.json
Created Sep 16, 2020
Module Deployment Configuration for using Bluetooth / BLE in Docker Container
View deployment.template.json
"modules": {
"BLEModule": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.BLEModule}",
"createOptions": {
"NetworkingConfig": {
@ThomasPe
ThomasPe / deployment.template.json
Created Sep 8, 2020
deployment.template.json Full
View deployment.template.json
{
"$schema-template": "2.0.0",
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"schemaVersion": "1.0",
"runtime": {
"type": "docker",
"settings": {
"minDockerVersion": "v1.25",
@ThomasPe
ThomasPe / deployment.template.json
Created Sep 8, 2020
deployment.template.json $edgeHub
View deployment.template.json
"$edgeHub": {
"properties.desired": {
"schemaVersion": "1.0",
"routes": {
"IdentityTranslationModuleToIoTHub": "FROM /messages/modules/IdentityTranslationModule/outputs/* INTO $upstream",
"sensorToIdentityTranslationModule": "FROM /messages/modules/SimulatedTemperatureSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\"/modules/IdentityTranslationModule/inputs/input1\")"
},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
@ThomasPe
ThomasPe / deployment.template.json
Created Sep 8, 2020
deployment.template.json Modules
View deployment.template.json
"modules": {
"IdentityTranslationModule": {
"version": "1.0",
"type": "docker",
"status": "running",
"restartPolicy": "always",
"settings": {
"image": "${MODULES.IdentityTranslationModule}",
"createOptions": {}
},
@ThomasPe
ThomasPe / app.js
Created Sep 7, 2020
IoT Edge Identity Translation Module Sample
View app.js
'use strict';
const Transport = require('azure-iot-device-mqtt').Mqtt;
const ModuleClient = require('azure-iot-device').ModuleClient;
const Message = require('azure-iot-device').Message;
const DeviceClient = require('azure-iot-device').Client;
let simulatedTemperatureClient;
ModuleClient.fromEnvironment(Transport, function (err, moduleClient) {
@ThomasPe
ThomasPe / index.js
Created Oct 3, 2018
Delete | Azure Functions + NodeJs + Table Storage
View index.js
const azure = require('azure-storage');
const tableService = azure.createTableService();
const tableName = "mytable";
module.exports = function (context, req) {
context.log('Start ItemDelete');
const id = req.query.id;
if (id) {
@ThomasPe
ThomasPe / index.js
Created Oct 3, 2018
Update | Azure Functions + NodeJs + Table Storage
View index.js
const azure = require('azure-storage');
const tableService = azure.createTableService();
const tableName = "mytable";
module.exports = function (context, req) {
context.log('Start ItemUpdate');
if (req.body) {
@ThomasPe
ThomasPe / index.js
Last active Oct 3, 2018
Create | Azure Functions + NodeJs + Table Storage
View index.js
// Reference to the Azure Storage SDK
const azure = require('azure-storage');
// Reference to the uuid package which helps us to create
// unique identifiers for our PartitionKey
const uuid = require('uuid/v1');
// The TableService is used to send requests to the database
const tableService = azure.createTableService();
//
const tableName = "mytable";
You can’t perform that action at this time.