def customShadowCallback_Delta()

in traffic-light-example-python/trafficLight.py [0:0]


def customShadowCallback_Delta(payload, responseStatus, token):
	# payload is a JSON string ready to be parsed using json.loads(...)
	# in both Py2.x and Py3.x
	payloadDict = json.loads(payload)
	print("++++++++ Received Shadow Delta ++++++++++")
	print(payloadDict)
	print("property: " + str(payloadDict["state"]["property"]))
	print("version: " + str(payloadDict["version"]))
	print("+++++++++++++++++++++++\n\n")
	
	light = payloadDict["state"]["property"]
	
	print("Light changed to: " + light)
	JSONPayload = '{"state":{"reported":{"property":' + '"' + light + '"}}}'
	print(JSONPayload)
	deviceShadowHandler.shadowUpdate(JSONPayload, customShadowCallback_Update, 5)