Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrates Gateway code to MQTT example #1977

Merged
merged 13 commits into from
Jan 28, 2019
Prev Previous commit
Fixes changes for function signature on detach
  • Loading branch information
gguuss committed Jan 28, 2019
commit 9e96fe92c904686c1ca37b3b1af657a9be1fec39
7 changes: 5 additions & 2 deletions iot/api-client/mqtt_example/cloudiot_mqtt_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# [START iot_mqtt_includes]
import argparse
import datetime
import logging
import os
import random
import ssl
Expand All @@ -33,6 +34,8 @@
import paho.mqtt.client as mqtt
# [END iot_mqtt_includes]

logging.getLogger('googleapiclient.discovery_cache').setLevel(logging.CRITICAL)

# The initial backoff time after a disconnection occurs, in seconds.
minimum_backoff_time = 1

Expand Down Expand Up @@ -248,7 +251,7 @@ def listen_for_messages(

time.sleep(1)

detach_device(client, device_id, mqtt_bridge_hostname, mqtt_bridge_port)
detach_device(client, device_id)

print('Finished.')
# [END listen_for_messages]
Expand Down Expand Up @@ -317,7 +320,7 @@ def send_data_from_bound_device(

time.sleep(5)

detach_device(client, device_id, mqtt_bridge_hostname, mqtt_bridge_port)
detach_device(client, device_id)

print('Finished.')
# [END send_data_from_bound_device]
Expand Down