Giter Site home page Giter Site logo

iotbuttoncounter's Introduction

IotButtonCounter

Features

Use AWS IoT Enterprise Button as counter which send current value to Slack.

  • Single click -> count up
  • Double click -> check current value
  • Long press -> reset counter

Setup

First, claim IoT Button device by following Claiming Devices - AWS IoT 1-Click.

Then, setup resouces using CloudFormation:

S3_BUCKET="<BUCKET>"
FUNCTION_NAME="IotButtonCounter"
STACK_NAME="IotButtonCounter"
SLACK_WEBHOOK_URL="https://hooks.slack.com/services/<YOUR_SLACK_SPECIFIC_TOKENS>"
DSN="<IOT_BUTTON_DSN>"

# Build Go source code.
GOOS=linux GOARCH=amd64 go build -o bin/main main.go

# Archive binary to zip file.
zip build/handler.zip bin/main

# Package Lambda binary and upload it to S3 bucket.
aws cloudformation package \
  --template-file cloudformation-template.yml \
  --s3-bucket $S3_BUCKET \
  --s3-prefix "Lambda/$FUNCTION_NAME" \
  --output-template-file packaged-template.yml

# Deploy all resources in AWS. (Also create CloudFormation stack)
aws cloudformation deploy \
  --template-file packaged-template.yml \
  --stack-name $STACK_NAME \
  --capabilities CAPABILITY_IAM \
  --parameter-overrides "SlackWebhookUrl=$SLACK_WEBHOOK_URL" "DeviceDsn=$DSN"

# Destroy all resources in AWS. (Also delete CloudFormation stack)
aws cloudformation delete-stack --stack-name $STACK_NAME

iotbuttoncounter's People

Contributors

tearoom6 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.