aws-iot-device-sdk-python | SDK for connecting to AWS IoT from a device using Python
kandi X-RAY | aws-iot-device-sdk-python Summary
kandi X-RAY | aws-iot-device-sdk-python Summary
SDK for connecting to AWS IoT from a device using Python.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Publish a message to a topic
- Send a PUBLISH command
- Pack the remaining bytes into the given length
- Generate a new ID
- Subscribe to messages
- Send a subscribe command
- Sends update notification
- Validate dictionary object
- Validate a JSON string
- Sets the shadow subscription
- Handles a handshake
- Unsubscribe from the client
- Connect to server
- Subscribe to a topic
- Configure IAM credentials
- Configure certificate credentials
- Configures auto - reconnect backoff time
- Returns a list containing all the CA CA certificates
- Register a callback for the shadow
- Publish a message
- Configure offline publish queueing
- Configure the Mqtt endpoint
- Get all available cores
- Perform a discovery operation
- Configure endpoint
- Connects to AWSAWQTT client
aws-iot-device-sdk-python Key Features
aws-iot-device-sdk-python Examples and Code Snippets
Community Discussions
Trending Discussions on aws-iot-device-sdk-python
QUESTION
In a python application that uses the aws iot device sdk for python v2 (v1.7.1) I am running into an issue where I cannot update the device shadow.
After starting the program, the DeviceShadowManager
will attempt to get the latest shadow state and set it locally.
If a delta
state is present the DeviceShadowManager
will merge the last reported
state and delta
state and publish it.
That works. However, when the manager subscribes for updates, after the initial setup, I am running into an error,
where when the desired
state changes, the manager cannot update the reported
state. Here is the error:
ANSWER
Answered 2021-Oct-25 at 09:24I am pretty sure the problem lies within
QUESTION
I'm trying to connect to AWS IoT Core via aws-iot-sdk-js-v2 and receiving the following error when I'm running the PubSub example as described below:
...ANSWER
Answered 2021-Jun-23 at 07:48I received an answer in aws-iot-device-sdk-js-v2 repository from jmklix that solved my problem:
Currently, the maintainers of the package don't include the pre-compiled binaries for raspberry pi, but we can do this manually if we want. described in aws-crt-nodejs:
QUESTION
I'm setting up an AWS IoT MQTT connection from a Python environment using Python package awsiotsdk
. I have followed this example https://github.com/aws/aws-iot-device-sdk-python-v2/blob/main/samples/pubsub.py and gotten the demo publish/subscribe to work, so I have all the pieces.
The only difference from the demo is that in my environment the certificates all reside in memory rather than on disk. A hack solution would be to write them to a temp location on disk and follow the example.
I would prefer to simply instantiate the appropriate AWS authentication class which can accept a file-like object rather than a string filename. However following the code only leads me to c-binding dead ends.
How can I create an MQTT client using in-memory certificates?
...ANSWER
Answered 2021-Jan-31 at 01:43As far as I've been able to determine, this is simply not possible. My solution is to use the tempfile
package to create a temporary directory which I write the cert to and then reference when I create my MQTT client. It's not elegant, but it keeps me from needing to manage the certs as an external dependency (which is what I wanted to avoid).
QUESTION
I'm following the pubsub.py
example code for AWS IoT using MQTT here. In particular I'm connecting to MQTT using the awsiotsdk
.
That example works ok, but it connects to MQTT as a generic client, not as a specific device.
I would like to connect to MQTT to publish and subscribe as a specific device. In particular I want to be able to query for connected devices and see this device show up.
In the demo code I see that --client-id
is included. By default it uses a UUID to generate a unique client ID for the demo. I've tried setting the client-id
to the thing ARN arn:aws:iot:us-west-2:123456789012:thing/test
What I want/expect to see is the following search show the connected thing
. The query comes back empty while the pubsub demo is running. The fact that it's empty tells me that the pubsub example is connecting as an MQTT client, not as a device. How do I connect as a device?
ANSWER
Answered 2021-Jan-26 at 00:07The clientId must equal the Thing name of a Thing registered in the Registry.
The connectivity status data is indexed only for connections where the client ID has a matching thing name.
https://docs.aws.amazon.com/iot/latest/developerguide/aggregation-troubleshooting.html
QUESTION
I'm following the example pub/sub in awsiotsdk
.
ANSWER
Answered 2021-Jan-22 at 22:44EXACTLY_ONCE
(MQTT QOS level 2) is not currently supported by the AWS IoT Core server. This is mentioned in the source:
QUESTION
I'm creating an AwsCredentialsProvider
class (api docs) from:
ANSWER
Answered 2021-Jan-22 at 16:19For custom credentials file path set environment variables AWS_CONFIG_FILE
and AWS_CREDENTIAL_FILE
For default profile set environment variable AWS_PROFILE
with AWS profile name you would like to select as default. In order to use at runtime, this AWS profile name must be present in your AWS credentials file with valid configurations.
If you use only one AWS region, then you can also set environment variable AWS_DEFAULT_REGION
. At times it saves few lines of code, where you might need to specify a AWS region.
QUESTION
I am using MOKOSMART_mkgw1 to collect data and send it to AWS IoT Core. for that, I need to set the following configurations,
- endpoint (aws iot endpoint)
- topic (any)
- device certificate and private key
- root ca.
I was able to connect and send data to aws iot core.
now I want to connect it to aws greengrass device instead of iot core directly.i have greengrass running, on ip 192.196.1.12 on port 8883 (windows machine). i download Group CA using basic discovery api. so i used this mqtt settings for device:
- broker endpoint (192.168.1.12:8883)
- topic (same as registered in subscription in aws iot GG)
- device certificate and private key (the device is registered in aws iot GG)
- Group CA (downloaded by basic discovery sample application)
but i am still not able to connect to aws gg?
my understanding is aws GG also has a MQTT broker. so by providing a proper authentication and topic, i should be able to connect to it, whether or not I have aws device SDKs or not. am i wrong? what does "basic discovery example" do extra to be able to connect to aws gg ??
...ANSWER
Answered 2020-Jan-27 at 08:59I am so sorry for wasting your time if you brainstorm on this question. the issue was, I was passing a random clientID in MQTT. instead, I passed "Device Name" as the client ID and it worked.
keep this question here if someone else falls in the same hole.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aws-iot-device-sdk-python
You can use aws-iot-device-sdk-python like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page