Last active
March 22, 2019 12:39
-
-
Save alexcasalboni/634f198546761d106947b8d179a6feec to your computer and use it in GitHub Desktop.
AWS Iot 1-Click Event - Lambda handler (Python)
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
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