Closed ArvinSpace closed 1 year ago
Hi, From the logs, it looks like the IoT data endpoint is not configured properly.
2023-05-15T01:59:15.979Z [INFO] (pool-2-thread-18) com.aws.greengrass.shadowmanager.sync.IotDataPlaneClientFactory: initialize-iot-data-client. {service-region=us-east-1, service-endpoint=<endpoint>-ats.iot.us-east-1.amazonaws.com}
Could you check the iotDataEndpoint
set in the configuration ofaws.greengrass.Nucleus
component?
Hi, From the logs, it looks like the IoT data endpoint is not configured properly.
2023-05-15T01:59:15.979Z [INFO] (pool-2-thread-18) com.aws.greengrass.shadowmanager.sync.IotDataPlaneClientFactory: initialize-iot-data-client. {service-region=us-east-1, service-endpoint=<endpoint>-ats.iot.us-east-1.amazonaws.com}
Could you check the
iotDataEndpoint
set in the configuration ofaws.greengrass.Nucleus
component?
endpoint没有问题,完整的日志中打印的是正确的,我只是使用<endpoint>
替换以隐藏了
Ok, that makes sense. Does the IoT thing policy for Arvin-INDICar-One-Basic-9
have enough permissions to do shadow operations? Also, could you enable DEBUG level logs and share them as well?
Ok, that makes sense. Does the IoT thing policy for
Arvin-INDICar-One-Basic-9
have enough permissions to do shadow operations? Also, could you enable DEBUG level logs and share them as well?
是的,有足够的权限。 相关的权限如下:
{
"Effect": "Allow",
"Action": [
"iot:Publish",
"iot:Receive",
"iot:Subscribe"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "greengrass:*",
"Resource": "*"
}
The thing policy must specify the permissions as shown below (taken from this doc) to perform shadow operations as needed.
Device Shadow Policy Actions
From the logs, it looks like the cloud shadow was updated twice which triggered two local update requests (bi-directional sync). Hence, the CarControl
component was also seeing two updates on the cloud shadow update subscription topic.
2023-05-15T01:58:41.442Z [INFO] (pool-2-thread-18) xxxx.BaseSyncStrategy: sync. Executing sync request. {Type=LocalUpdateSyncRequest, thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control}
...
2023-05-15T01:58:41.455Z [INFO] (pool-2-thread-18) xxxx.ShadowManagerDAOImpl: Updating sync info. {thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control, cloud-version=22, local-version=148}
...
...
2023-05-15T01:59:15.864Z [INFO] (pool-2-thread-18) xxxx.BaseSyncStrategy: sync. Executing sync request. {Type=LocalUpdateSyncRequest, thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control}
...
2023-05-15T01:59:15.874Z [INFO] (pool-2-thread-18) xxxx.ShadowManagerDAOImpl: Updating sync info. {thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control, cloud-version=23, local-version=149}
...
The thing policy must specify the permissions as shown below (taken from this doc) to perform shadow operations as needed.
Device Shadow Policy Actions
- iot:DeleteThingShadow
- iot:GetThingShadow
- iot:ListNamedShadowsForThing
- iot:UpdateThingShadow
设备证书对应策略加上这些权限之后就可以同步影子数据到云端了,非常感谢
From the logs, it looks like the cloud shadow was updated twice which triggered two local update requests (bi-directional sync). Hence, the
CarControl
component was also seeing two updates on the cloud shadow update subscription topic.2023-05-15T01:58:41.442Z [INFO] (pool-2-thread-18) xxxx.BaseSyncStrategy: sync. Executing sync request. {Type=LocalUpdateSyncRequest, thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control} ... 2023-05-15T01:58:41.455Z [INFO] (pool-2-thread-18) xxxx.ShadowManagerDAOImpl: Updating sync info. {thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control, cloud-version=22, local-version=148} ... ... 2023-05-15T01:59:15.864Z [INFO] (pool-2-thread-18) xxxx.BaseSyncStrategy: sync. Executing sync request. {Type=LocalUpdateSyncRequest, thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control} ... 2023-05-15T01:59:15.874Z [INFO] (pool-2-thread-18) xxxx.ShadowManagerDAOImpl: Updating sync info. {thing name=Arvin-INDICar-One-Basic-9, shadow name=car_control, cloud-version=23, local-version=149} ...
我是在AWS IoT控制台进入物品>Arvin-INDICar-One-Basic-9>car_control影子页面,点击设备影子文档右边的编辑按钮,然后修改影子的desired数据,最后点击更新按钮。
Closing the issue. Please reopen if needed. Thanks!
发现三个问题:
[INFO] (Copier) com.iot.aws.arvin.sample.CarControl: stdout. Received new message on topic $aws/things/Arvin-INDICar-One-Basic-9/shadow/name/car_control/update/delta: {"version":149,"timestamp":1684115955,"state":{"vehicle_body":{"lock":{"state":"0","value":"0"}}},"metadata":{"vehicle_body":{"lock":{"state":{"timestamp":1684115955},"value":{"timestamp":1684115955}}}}}. {scriptName=services.com.iot.aws.arvin.sample.CarControl.lifecycle.Run, serviceName=com.iot.aws.arvin.sample.CarControl, currentState=RUNNING}