Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
See: | Any Lambda function -> this function
`event` is;
"transition_wating_sec": <sec:Integer>,
"thing_name": <thingName:String>
import json
import logging
logger = logging.getLogger()
import time
import boto3
def lambda_handler(event, context):'Received event: ' + json.dumps(event))
s = event.get('transition_to', 'idle')
shadowDoc = {'state':{'reported':{'status':s}}}
iot = boto3.client('iot-data')
iot.update_thing_shadow(thingName=event['thing_name'], payload=json.dumps(shadowDoc))
return {"statusCode": 204}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment