Skip to content

Instantly share code, notes, and snippets.

@alexcasalboni
Last active March 22, 2019 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcasalboni/634f198546761d106947b8d179a6feec to your computer and use it in GitHub Desktop.
Save alexcasalboni/634f198546761d106947b8d179a6feec to your computer and use it in GitHub Desktop.
AWS Iot 1-Click Event - Lambda handler (Python)
from click_handler import DailyClickHandler
def handler(event, context):
if 'deviceEvent' in event:
if 'deviceHealthMonitor' in event['deviceEvent']:
# just a health check
print("HEALTHCHECK")
print(event)
return "OK"
elif 'buttonClicked' in event['deviceEvent']:
# a real click
click_handler = DailyClickHandler(event['deviceEvent']['buttonClicked'])
click_handler.run()
return "OK"
raise Exception("Invalid event %s " % event)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment