This file contains hidden or 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
| { | |
| "things": [ | |
| { | |
| "thingName": "esp32_AAAAAA", | |
| "thingArn": "arn:aws:iot:eu-west-1:XXXXXX:thing/esp32_AAAAAA", | |
| "attributes": {}, | |
| "version": 1 | |
| } | |
| ] | |
| } |
This file contains hidden or 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
| { | |
| "state": { | |
| "reported": { | |
| "humidity": 81, | |
| "temp": 21.1 | |
| } | |
| }, | |
| "metadata": { | |
| "reported": { | |
| "humidity": { |
This file contains hidden or 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
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": "iot:GetThingShadow", | |
| "Resource": [ | |
| "arn:aws:iot:eu-west-1:XXXXXX:thing/esp32_AAAAAA", | |
| "arn:aws:iot:eu-west-1:XXXXXX:thing/esp32_BBBBBB", | |
| "arn:aws:iot:eu-west-1:XXXXXX:thing/esp32_CCCCCC" |
This file contains hidden or 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
| async function getSensorData(sensorName) { | |
| const credentials = await getCredentials(); | |
| const iotData = new AWS.IotData({ | |
| endpoint: config.IOT_BROKER_ENDPOINT, | |
| accessKeyId: credentials.Credentials.AccessKeyId, | |
| secretAccessKey: credentials.Credentials.SecretAccessKey, | |
| sessionToken: credentials.Credentials.SessionToken | |
| }); | |
| const data = await iotData.getThingShadow({ thingName: sensorName }).promise(); | |
| return JSON.parse(data.payload); |
This file contains hidden or 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
| async handle(handlerInput) { | |
| const room = getSlotValue(handlerInput.requestEnvelope, 'room'); | |
| const roomSensor = config.ROOMS[room]; | |
| const sensorData = await getSensorData(roomSensor); | |
| const measurement = getSlotValue(handlerInput.requestEnvelope, 'measurement'); | |
| var speech = new Speech(); | |
| if (measurement === 'temperatur') { | |
| speech.say('Es ist im') | |
| speech.say(room) |
This file contains hidden or 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
| canHandle(handlerInput) { | |
| return getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' | |
| && getIntentName(handlerInput.requestEnvelope) === 'GetMeasurementForRoom'; | |
| } |
This file contains hidden or 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
| { | |
| "requestEnvelope": { | |
| "version": "1.0", | |
| "request": { | |
| "type": "IntentRequest", | |
| "requestId": "1234", | |
| "locale": "de-DE", | |
| "timestamp": "2020-08-25T12:51:52Z", | |
| "intent": { | |
| "name": "GetMeasurementForRoom", |
This file contains hidden or 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
| load('api_timer.js'); | |
| load('api_aws.js'); // aws support | |
| load('api_dht.js'); // helper for the dht22 sensor | |
| let dht = DHT.create(32, DHT.DHT22); | |
| // get a new value every 5mins | |
| Timer.set(300000, true, function() { | |
| let currentTemp = dht.getTemp(); | |
| let currentHumidity = dht.getHumidity(); |
This file contains hidden or 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
| manifest_version: 2017-09-29 | |
| libs_version: ${mos.version} | |
| modules_version: ${mos.version} | |
| mongoose_os_version: ${mos.version} | |
| # List of files/folders copied to the device filesystem | |
| filesystem: | |
| - fs |