aws-iot-button | Simple example of sending AWS IoT Button events | Cloud Functions library
kandi X-RAY | aws-iot-button Summary
kandi X-RAY | aws-iot-button Summary
Simple example of sending AWS IoT Button events through AWS Lambda then on to Firebase.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of aws-iot-button
aws-iot-button Key Features
aws-iot-button Examples and Code Snippets
Community Discussions
Trending Discussions on aws-iot-button
QUESTION
I am new to Lambda and am trying to write a function that will send an email with a fluid volume through SNS every 24 hours. This Lambda function is triggered by an IoT rule, and without the 24 hour limitation, the inbox will be flooded with emails. In CloudWatch, it looks like the email is being sent even if the email_sent flag is equal to 1. So it makes me think I have not structured my parentheses and brackets correctly? Does anyone see anything wrong with this code?
...ANSWER
Answered 2019-May-11 at 14:59So there's a two things I see that should be done differently.
First, you have this:
createTopic('aws-iot-button-sns-topic', (err, topicArn) => {
Right now your function is creating needless topics without ever deleting them, this is a problem. You should instead create the SNS topic externally and reference it here by either using Lambda environment variables or hard-coding the SNS topic arn. Or, first check if a topic with that name is already existing, and don't create it if it does.
Second, Lambdas don't run for longer than 900 seconds (15 minutes), so checking whether or not the script has been running for >24 hours is impossible.
What you should do instead is create a CloudWatch event trigger that runs every 24 hours using cron. This way, your lambda will run exactly one time every 24 hours (or whatever event you configure), and in the code you simply have to send the message once. There will then be no need to check what time it is or how many you already sent, since you know the event trigger happens only once, therefore your message gets sent once and your Lambda ends its execution right after.
The essence of Lambdas is they are short-lived and stateless, so design your service accordingly :)
Edit: After the comment, I understand the use case more...in this scenario, where the Lambda gets executed by IoT, I would personally store the previous execution time in SSM parameter store or DynamoDB, and then whenever the Lambda gets executed, I would get the value, check if 24 hours passed, and send the SNS if it did. You will have to do this because Lambda won't know otherwise when the last execution time was (and make sure to only update the last execution time on a successful SNS publish call, that eay you're sure that you sent a message that day)
QUESTION
Dear all AWS IoT developers I realized that I can only get three parameters as illustrated from the code below:
...ANSWER
Answered 2018-Apr-01 at 22:57According to this post by Stackoverflow link, json can only specify these parameters. Other parameters such as ""lat/log"" would be hard define.
A suggested solution for finding lat/long would probably by writing nodeJS code utilizing from npm googlemaps
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aws-iot-button
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page