nRFCloud / dfu-device-simulator

AWS IoT Thing simulator for nRF91 DFU
Other
0 stars 0 forks source link

No steps/code for attaching policy to device cert #7

Closed savvyintegrations closed 5 years ago

savvyintegrations commented 5 years ago

@coderbyheart What is the expected behavior for the simulated device? I'm seeing constant disconnect -> reconnect -> connected after the shadow is set:

connecting to a2n7tk1kp18wix-ats.iot.us-east-1.amazonaws.com...
connected
> $aws/things/db8fec99-84d7-4c83-91a8-195d0598dcd5/shadow/update
>
{
  "state": {
    "reported": {
      "nrfcloud__dfu_v1__app_v": 1
    }
  }
}
reported firmware version 1
disconnect
reconnect
connected
disconnect
reconnect
connected
disconnect
...
savvyintegrations commented 5 years ago

I don't see where in the code you are attaching the policy to the device cert.

savvyintegrations commented 5 years ago

For troubleshooting purposes I created a dfu_simulator policy and then ran aws iot attach-policy --policy-name dfu_simulator --target arn:aws:iot:us-east-1:680502709288:cert/49fbb87fe6a087e48110f1b5c7083063e80d4914828e20cdbaa0e230d47cb515 to attach it to the cert for my device and that resolved the issue:

connected
> $aws/things/db8fec99-84d7-4c83-91a8-195d0598dcd5/shadow/update
>
{
  "state": {
    "reported": {
      "nrfcloud__dfu_v1__app_v": 1
    }
  }
}
reported firmware version 1
subscribed to $aws/things/db8fec99-84d7-4c83-91a8-195d0598dcd5/jobs/notify-next

Not sure how you want to handle this in the project.

coderbyheart commented 5 years ago

Make sure the device you use has sufficient permissions to interact with the AWS IoT Jobs topics. This is not set up for you by the simulator.