GoogleCloudPlatform / iot-core-micropython

Apache License 2.0
52 stars 14 forks source link

Can't run main #14

Open Tayaah opened 3 years ago

Tayaah commented 3 years ago

Well, I've done everything, and now is just run the code (wish it was)

It stops here, and can't conclude de connection, any suggestion of what can be my mistake?

Creating JWT... Sending message with password eyJ0eXAiOiAiSl [...] JWId1Qjmb4BjjKHPLITppMbzo1FDBigdmqmw_CwUQXjB2mUyRX8QcUw6ApvZTP98yfrc7gP0lc5eQmVZR0xsSmBlJM_iGJp1vJhkwirpIeXgnILO9w== Traceback (most recent call last): File "main.py", line 190, in File "main.py", line 170, in get_mqtt_client File "umqtt/simple.py", line 97, in connect IndexError: bytes index out of range MicroPython v1.12 on 2019-12-20; ESP32 module with ESP32

follow line 190 in main.py:

client = get_mqtt_client(config.google_cloud_config['project_id'], config.google_cloud_config['cloud_region'], config.google_cloud_config['registry_id'], config.google_cloud_config['device_id'], jwt)

I suppose that is something easy, similar to #12 (?)

sweeneyb commented 3 years ago

I got this too:

Traceback (most recent call last): File "main.py", line 112, in File "main.py", line 102, in get_mqtt_client File "umqtt/simple.py", line 97, in connect IndexError: bytes index out of range MicroPython v1.13 on 2020-09-02; ESP32 module with ESP32

Hitting the reset button was enough for me -- the connection went through the second time. My board seems to flake a fair bit. I've added some retry logic around setting the time. This also seems like a good place to add some error handling/retry logic.