Skip to content

Instantly share code, notes, and snippets.

View PatrickStoklasa's full-sized avatar

Patrick Stoklasa PatrickStoklasa

View GitHub Profile
var AWS = require('aws-sdk');
const ddb = new AWS.DynamoDB();
const http = require('https');
exports.handler = (event, context, callback) => {
// Retrieve all events of the last 11 minutes
getLatestEvents((err, events) => {
if(err) console.log(err);
else {
console.log(events);
var AWS = require('aws-sdk');
var iotdata = new AWS.IotData({endpoint: 'xxxxxxx.iot.eu-central-1.amazonaws.com'});
const ddb = new AWS.DynamoDB();
exports.handler = function(event, context) {
// 'Detected100Sn' is the property reported by the inductive sensor
if(event["Detected100Sn"]) {
logEvent("Closed", (err) => {
if(err) console.log(err);
var AWS = require('aws-sdk');
var iotdata = new AWS.IotData({endpoint: 'xxxxxxx.iot.eu-central-1.amazonaws.com'});
const ddb = new AWS.DynamoDB();
exports.handler = function(event, context) {
let body = {
"Buzzer": "On",
"Segment Blink": "On",
"Color": "Yellow"
};