IoTDataPlane

Table of Contents

Client

class IoTDataPlane.Client

A low-level client to interact locally with the AWS Greengrass Core in order to publish messages and use the local shadow service. This low-level client possesses the same interface as the one used in boto3 to interact with AWS IoT.

import greengrasssdk

client = greengrasssdk.client('iot-data')

These are the available methods:

get_thing_shadow(**kwargs)

Gets the thing shadow for the specified thing.

For more information, see GetThingShadow in the AWS IoT Developer Guide .

Request Syntax

response = client.get_thing_shadow(
    thingName='string'
)
Parameters
thingName (string) --

[REQUIRED]

The name of the thing.

Return type
dict
Returns
Response Syntax
{
    'payload': StreamingBody()
}

Response Structure

  • (dict) --

    The output from the GetThingShadow operation.

    • payload (StreamingBody) --

      The state information, in JSON format.

publish(**kwargs)

Publishes state information.

For more information, see HTTP Protocol in the AWS IoT Developer Guide .

Request Syntax

response = client.publish(
    topic='string',
    payload=b'bytes'|file
)
Parameters
  • topic (string) --

    [REQUIRED]

    The name of the MQTT topic.

  • payload (bytes or seekable file-like object) -- The state information, in JSON or binary format.
Returns

None

update_thing_shadow(**kwargs)

Updates the thing shadow for the specified thing.

For more information, see UpdateThingShadow in the AWS IoT Developer Guide .

Request Syntax

response = client.update_thing_shadow(
    thingName='string',
    payload=b'bytes'|file
)
Parameters
  • thingName (string) --

    [REQUIRED]

    The name of the thing.

  • payload (bytes or seekable file-like object) --

    [REQUIRED]

    The state information, in JSON format.

Return type

dict

Returns

Response Syntax

{
    'payload': StreamingBody()
}

Response Structure

  • (dict) --

    The output from the UpdateThingShadow operation.

    • payload (StreamingBody) --

      The state information, in JSON format.