如何在Web控制台上检查AWS IoT设备连接状态?

问题描述 投票:0回答:2

我刚开始玩AWS IoT。我创建了一个东西并使用mqtt-spy连接到AWS服务器。一切都好。

现在我想检查Web控制台中每个东西的状态,但是我在设备附近找不到这样有用的信息。

amazon-web-services iot aws-iot
2个回答
0
投票

您需要在AWS IoT核心右上角的aws iot控制台,测试部分订阅主题。例如,您订阅此主题替换您的客户端。 $aws/events/presence/connected/<Your_clientId>如果您有多个东西,那么您必须使用您的ClientID订阅以供参考检查此链接https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html


0
投票

通过启用AWS IoT Fleet Indexing Service,您可以获得事物的连接状态。此外,您还可以查询当前连接/断开的设备。

首先,您必须通过aws-cli或通过控制台启用索引(thingConnectivityIndexingMode)。

aws iot update-indexing-configuration --thing-indexing-configuration thingIndexingMode=REGISTRY_AND_SHADOW,thingConnectivityIndexingMode=STATUS

然后,您可以查询事物的连接状态,如下所示

aws iot search-index --index-name "AWS_Things" --query-string "thingName:mything1"
{  
    "things":[{  
         "thingName":"mything1",
         "thingGroupNames":[  
            "mygroup1"
         ],
         "thingId":"a4b9f759-b0f2-4857-8a4b-967745ed9f4e",
         "attributes":{  
            "attribute1":"abc"
         },
         "connectivity": { 
            "connected":false,
            "timestamp":1641508937
         }         
    }
}

注意:Fleet Indexing Service索引连接数据与设备生命周期事件($ aws / events / presence / connected /)。在某些情况下,服务可能需要一分钟左右才能在发生连接或断开连接事件后更新索引。

© www.soinside.com 2019 - 2024. All rights reserved.