Reputation: 1
We have been following the tutorial here: https://cloud.google.com/community/tutorials/cloud-iot-gateways-rpi
We set up the registry, gateway and devices, and we validated that the gateway (laptop) is connected. Google Cloud console showing gateways
We get the message below on the gateway:
Creating JWT using RS256 from private key file rsa_private.pem connect status False on_connect Connection Accepted. on_subscribe: mid 1, qos (1,) Unable to find key 1 Received message '' on topic '/devices/test-gateway/config' with Qos 1 Nobody subscribes to topic /devices/test-gateway/config Received message '' on topic '/devices/test-gateway/config' with Qos 1 Nobody subscribes to topic /devices/test-gateway/config
However, in the Raspberry Pi, it says "Waiting for Response" and the device was waiting for response and does not get to the "received" step. Please see attached screenshots of the raspberry pi output as well as the google cloud Iot Core that shows that the gateway is connected.Raspberry Pi console output
Upvotes: 0
Views: 143
Reputation: 8681
As Gabe and Kolban mentioned, there's a lot of complexity in the examples from the community tutorials that can make it difficult to understand where things are breaking for you. I recommend starting from the samples available here for getting started.
In the example you're running, the gateway server must be running before the thermostat or led-light code is run.
Also, in the Raspberry Pi code, without a DHT-22 sensor connected to the Raspberry Pi, you will not reach the code where the readings are taken. If you're looking for a version that doesn't require hardware, the python-docs-samples version of ledlight and thermostat simulate the hardware. I have verified that the instructions work at a minimum for the led-light portion of the demo (I was able to turn on / off the LED light).
Finally, there might be an error in the tabulation for the source code on line 51 of thermostat.py
that causes some issues in the UDP protocol. I'll update the article if I can verify that is causing hiccups for me but if you want to patch your copy before that's republished, set the code to look like:
# Receive response
if log:
print('waiting for response', file=sys.stderr)
response, _ = sock.recvfrom(4096)
if log:
print('received: "{}"'.format(response), file=sys.stderr)
Upvotes: 2