Sending data from LAMBDA FUNCTION to AWS IOT TWIN MAKER

32 Views Asked by At

So I wanted to send data from Lambda to aws iot twin maker however I have getting some errors. Here, is my code:

import json
import boto3

iot_twin_maker_client = boto3.client('iottwinmaker')

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

    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.')
    }

and here is the error that I am getting:

[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.update_property_value( File "/var/lang/lib/python3.11/site-packages/botocore/client.py", line 887, in getattr raise AttributeError()

Is there any solve to this?

I tried updatepropertyvalue as well same error occurs. The thing is I have an entity named hand and I want to send data to change the rotation value of hand. This is the json code of the receiving end is there anything wrong there?:

[
  {
    "name": "Rotation",
    "value": {
      "doubleValue": 4
    },
    "definition": {
      "dataType": {
        "type": "DOUBLE"
      },
      "isTimeSeries": false,
      "isRequiredInEntity": false,
      "isExternalId": false,
      "isStoredExternally": false,
      "isImported": false,
      "isFinal": false,
      "isInherited": false,
      "displayName": "x"
    }
  }
]
0

There are 0 best solutions below