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(

gefragt vor 5 Monaten172 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
EXPERTE
Uri
beantwortet vor 5 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen