Open SerMih opened 3 years ago
Hello Serge,
Check if QoS is the same in your project and your code.
Also, double-check if you entered the parameters of your project correctly to the code. I'm quite sure the problem is here. _# GCP parameters project_id = 'thinking-land' # Your project ID. registry_id = 'my-registry' # Your registry name. device_id = 'led-light' # Your device name. private_key_file = 'rsa_private.pem' # Path to private key. algorithm = 'RS256' # Authentication key format. cloud_region = 'europe-west1' # Project region. ca_certs = 'roots.pem' # CA root certificate path. mqtt_bridge_hostname = 'mqtt.googleapis.com' # GC bridge hostname. mqtt_bridge_port = 8883 # Bridge port. messagetype = 'event' # Message type (event or state)
Every one of these parameters must be the same as you set up in your GC project.
Best, Ivan
Hello Ivan, I have followed your tutorial from this link: https://lembergsolutions.com/blog/rapid-hardware-prototyping-connect-your-raspberry-pi-google-cloud-iot I have setup my Google Cloud account and also my Raspberry Pi as per your instructions. However, I keep getting the following errors: "Connection Result: 5: The connection was refused. Disconnected: 5: The connection was refused. Traceback (most recent call last): File "example.py", line 194, in
main()
File "example.py", line 154, in main
device.wait_for_connection(5)
File "example.py", line 78, in wait_forconnection
raise RuntimeError('Could not connect to MQTT bridge.')
RuntimeError: Could not connect to MQTT bridge.
Any idea what could cause this error? Have you tried with other types of key pairs? Any feedback or suggestions would be highly appreciated. Regards, Serge