This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//index.js | |
var iothub = require('azure-iothub'); | |
var config = require("./config"); | |
var registry = iothub.Registry.fromConnectionString(config.connectionString); | |
module.exports = function (context, req) { | |
// get devices registered in your iot hub | |
const query = registry.createQuery("SELECT * FROM devices", 100); | |
query.nextAsTwin(function (error, result) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
deviceId, | |
eventEnqueuedUtcTime, | |
temperature, | |
humidity | |
INTO | |
[CosmosDBOutput] | |
FROM | |
[IoTHubInput] TIMESTAMP BY eventEnqueuedUtcTime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GraphClient: HttpClient, IGraphClient { | |
private const string GraphBaseUrl = "https://graph.microsoft.com/v1.0/"; | |
public GraphClient(string appAccessToken) { | |
BaseAddress = new Uri(GraphBaseUrl); | |
DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", appAccessToken); | |
} | |
public async Task <bool> CreateCalendarEvent(string userId, string calendarId, CreateCalendarEventModel eventModel) { | |
var result = await PostAsync( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bot.dialog('absence-request-dialog', [function (session, args, next) { | |
// store request id in session | |
session.userData.session.id = args.requestId; | |
builder.Prompts.choice(session, args.message, ["Accept", "Reject"], { | |
listStyle: builder.ListStyle.button | |
}); | |
},(session, result, next) => {; | |
// retrieve request id from session | |
const requestId = session.userData.session.id; | |
if (result.response) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Endpoint to be triggered by Timeout API | |
server.post('/absence-request', (req, res) => { | |
bot.beginDialog(req.body.address, "*:absence-request-dialog", { | |
message: req.body.message, | |
requestId: req.body.requestId | |
}); | |
res.send(200) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <WiFiClientSecure.h> | |
#include <WiFiUdp.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <time.h> | |
#include <sys/time.h> |