【问题标题】:Aws IOT Jobs in PythonPython 中的 Aws IOT 作业
【发布时间】:2018-10-13 18:38:22
【问题描述】:

我使用 boto3 创建了一个工作

import boto3 

client = boto3.client('iot')
response = client.create_job(
    jobId='job_id',
    targets=[
        'thing_arn',
    ],
    document="{\"operation\":\"restart\"}",
    description='job created using boto',
    targetSelection='SNAPSHOT'
)

我已经创建了一个 python 程序来订阅监听响应

end_point = 'ur end point'
rootCAPath = 'rootCA Path'
certificatePath = 'certificate Path'
privateKeyPath = 'private Key Path'
clientId = 'myClientID'

#$aws/things/thingname/jobs/notify (or 
#$aws/things/thingname/jobs/notify-next)
#$aws/things/thingname/jobs/get/accepted
#$aws/things/thingname/jobs/get/rejected
#$aws/things/thingname/jobs/jobId/get/accepted
#$aws/things/thingname/jobs/jobId/get/rejected

topic = 'try with above all topics'
myAWSIoTMQTTClient = None
myAWSIoTMQTTClient = AWSIoTMQTTClient(clientId)
myAWSIoTMQTTClient.configureEndpoint(end_point, 8883)
myAWSIoTMQTTClient.configureCredentials(rootCAPath, privateKeyPath, certificatePath)
# Connect and Subscribe
while True:
    myAWSIoTMQTTClient.connect(1000)
    #subscribe multiple topic
    myAWSIoTMQTTClient.subscribe(topic, 1, customCallback)
    time.sleep(2)

当我收听上述主题时,没有任何回应。我还使用 aws iot 控制台 (TEST) 进行了检查,并订阅了上面给定的主题,也没有任何回应。作业如何发送到注册的 iot 设备和作业详细信息发送到该设备的主题是什么

【问题讨论】:

    标签: python aws-sdk boto3 aws-iot


    【解决方案1】:

    迟到总比不到好。

    确保$ 包含在主题中。这就是我的问题所在。

    响应返回到 /accepted/rejected/# 用于它们的组合)。

    另外,您可能想订阅主题$aws/events/# 以检查您的设备在测试时是否订阅了该主题。

    This 示例可能会对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-28
      • 1970-01-01
      • 2019-01-28
      • 1970-01-01
      • 2018-05-04
      • 2019-02-21
      相关资源
      最近更新 更多