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(

asked 5 months ago161 views
1 Answer
0
Accepted Answer

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
EXPERT
Uri
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions