Closed martarho closed 3 years ago
@martarho Did you register the device with the public key from the key pair you generated to Google cloud console?
Hi, I'm having the same issue while trying to connect to Google IOT Core.
I (4661) esp_netif_handlers: sta ip: xxx.xxx.xxx.xxx mask: 255.255.255.0, gw: xxx.x.x.x.x.xx I (4661) APP: Initializing SNTP I (4661) APP: Waiting for system time to be set... I (6671) APP: Waiting for system time to be set... I (8671) APP: Waiting for system time to be set... I (10671) APP: Time is set... I (10671) gpio: GPIO[27]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 ERROR! Connection has failed reason 34
I stored the public key in Google Cloud and the private key under /main/certs/
Used the following to create the keys: openssl ecparam -genkey -name prime256v1 -noout -out ec_private.pem openssl ec -in ec_private.pem -pubout -out ec_public.pem
==> Interestingly it worked a week ago for whatever reason.
What could be the problem?
Ok, problem vanished :).
Solution 1: in the menuconfig, the variable Google Cloud location was not set correctly, I copied it from my firebase console. It's the same project but runs on europe-west3, whereas my Google Cloud instance runs on europe-west1 :). I don't know why Google has to do that but anyway.
Problem 2: The device name seems to be important. My first device was called iot-sampel-device ==> Worked My second deive called nodemcu_esp32_1 ==> throws error
I guess it's either the length or the "_".
Hi @hairpin666 ,
Right, checking that the region is correct is a solution. I happened to add nodemcu_esp32_1
as the device name and it worked fine.
I had faced the above issue when I mistakenly had added the project name in place of project ID. Ensuring the apt values for the 4 options helped me connect correctly.
My config when the device connected well: CONFIG_GIOT_PROJECT_ID="iot-core-297205" CONFIG_GIOT_LOCATION="us-central1" CONFIG_GIOT_REGISTRY_ID="First-Registry" CONFIG_GIOT_DEVICE_ID="nodemcu_esp32_1"
Closing this issue as it has been resolved.
I was trying to simulate many possible error conditions after successfully establishing a connection. This error occurs when the communications are disabled . Ensure that the communications are allowed on the device.
I am trying to adapt the example here (minus the GPIO) to send telemetry data to Google Cloud IoT. My code is pretty much the same as yours, and compiles, unfortunately I get an error 34, that according to the Google IoT SDK corresponds to "IOTC_MQTT_NOT_AUTHORIZED".
I set up the device and tested it using Curl and Mosquitto (both successfully) as shown in this post: http://nilhcem.com/iot/cloud-iot-core-with-the-esp32-and-arduino
and I checked all possible parameters, but it all seems correct.