Lambda to Aws twin maker

0

Hello guys, I am new to AWS. I was trying to take data from my Aws IOT core to AWS twin maker via Lambda function. I have been using this python code :

import json
import boto3

iot_twin_maker_client = boto3.client('iottwinmaker')

def lambda_handler(event, context):
    # Extract event data
    event_data = json.loads(event[1])
    print("temp"+event)

    # Send event data to IoT Twin Maker
    iot_twin_maker_client.update_property_value(
        workspaceId='robot',
        entityId='Hand',
        propertyId='Rotation',
        value=json.dumps(event_data)
    )

    return {
        'statusCode': 200,
        'body': json.dumps('Event data sent to IoT Twin Maker.')
  }

This particular code shows error in the update_property_value part.

That is: [ERROR] AttributeError: 'IoTTwinMaker' object has no attribute 'update_property_value' Traceback (most recent call last): File "/var/task/lambda_function.py", line 12, in lambda_handler iot_twin_maker_client.updatepropertyvalue( File "/var/lang/lib/python3.11/site-packages/botocore/client.py", line 887, in getattr raise AttributeError(

Is there any solve to this? Also what will be the Json code to receive these data in AWS Iot Twin Maker?

  • What error does it give?

  • Attribute error. I am pasting the whole message here: [ERROR] AttributeError: 'IoTTwinMaker' object has no attribute 'update_property_value' Traceback (most recent call last): File "/var/task/lambda_function.py", line 12, in lambda_handler iot_twin_maker_client.updatepropertyvalue( File "/var/lang/lib/python3.11/site-packages/botocore/client.py", line 887, in getattr raise AttributeError(

preguntada hace 5 meses172 visualizaciones
1 Respuesta
0
Respuesta aceptada

You are calling update_property_value, that according to the boto3 documentation does not exist. There is a method called batch_put_property_values. Maybe this is the one you should be using.

profile pictureAWS
EXPERTO
Uri
respondido hace 5 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas