Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions scenarios/command/python/command_invoker.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ def main():

# CONNECT
print("{}: Starting connection".format(client_id))
hostname = connection_settings['MQTT_HOST_NAME']
port = connection_settings['MQTT_TCP_PORT']
keepalive = connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"]
mqtt_client.connect(hostname, port, keepalive, clean_start=connection_settings['MQTT_CLEAN_SESSION'])
mqtt_client.connect(
host=connection_settings['MQTT_HOST_NAME'],
port=connection_settings['MQTT_TCP_PORT'],
keepalive=connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"],
clean_start=connection_settings['MQTT_CLEAN_SESSION'],
)
print("Starting network loop")
mqtt_client.loop_start()

Expand Down
10 changes: 6 additions & 4 deletions scenarios/command/python/command_receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ def main():

# CONNECT
print("{}: Starting connection".format(client_id))
hostname = connection_settings['MQTT_HOST_NAME']
port = connection_settings['MQTT_TCP_PORT']
keepalive = connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"]
mqtt_client.connect(hostname, port, keepalive, clean_start=connection_settings['MQTT_CLEAN_SESSION'])
mqtt_client.connect(
host=connection_settings['MQTT_HOST_NAME'],
port=connection_settings['MQTT_TCP_PORT'],
keepalive=connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"],
clean_start=connection_settings['MQTT_CLEAN_SESSION'],
)
print("Starting network loop")
mqtt_client.loop_start()

Expand Down
15 changes: 8 additions & 7 deletions scenarios/getting_started/python/getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def on_connect(client, _userdata, _flags, rc):
connection_error = Exception(mqtt.connack_string(rc))
connected_cond.notify_all()

def on_subscribe(client, _userdata, mid, _granted_qos):
def on_subscribe(client, _userdata, mid, _reason_codes, _properties):
global subscribed_prop
print(f"Subscribe for message id {mid} acknowledged by MQTT broker")
# # In Paho CB thread.
Expand Down Expand Up @@ -104,8 +104,7 @@ def wait_for_disconnected(timeout: float = None):
def create_mqtt_client(client_id, connection_settings):
mqtt_client = mqtt.Client(
client_id=client_id,
clean_session=connection_settings['MQTT_CLEAN_SESSION'],
protocol=mqtt.MQTTv311,
protocol=mqtt.MQTTv5,
transport="tcp",
)
if 'MQTT_USERNAME' in connection_settings:
Expand Down Expand Up @@ -154,10 +153,12 @@ def create_mqtt_client(client_id, connection_settings):

# CONNECT
print("{}: Starting connection".format(client_id))
hostname = connection_settings['MQTT_HOST_NAME']
port = connection_settings['MQTT_TCP_PORT']
keepalive = connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"]
mqtt_client.connect(hostname, port, keepalive)
mqtt_client.connect(
host=connection_settings['MQTT_HOST_NAME'],
port=connection_settings['MQTT_TCP_PORT'],
keepalive=connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"],
clean_start=connection_settings['MQTT_CLEAN_SESSION'],
)
print("Starting network loop")
mqtt_client.loop_start()

Expand Down
15 changes: 8 additions & 7 deletions scenarios/telemetry/python/telemetry_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def on_connect(client, _userdata, _flags, rc):
connection_error = Exception(mqtt.connack_string(rc))
connected_cond.notify_all()

def on_subscribe(client, _userdata, mid, _granted_qos):
def on_subscribe(client, _userdata, mid, _reason_codes, _properties):
global subscribed_prop
print(f"Subscribe for message id {mid} acknowledged by MQTT broker")
# # In Paho CB thread.
Expand Down Expand Up @@ -79,8 +79,7 @@ def wait_for_disconnected(timeout: float = None):
def create_mqtt_client(client_id, connection_settings):
mqtt_client = mqtt.Client(
client_id=client_id,
clean_session=connection_settings['MQTT_CLEAN_SESSION'],
protocol=mqtt.MQTTv311,
protocol=mqtt.MQTTv5,
transport="tcp",
)
if 'MQTT_USERNAME' in connection_settings:
Expand Down Expand Up @@ -128,10 +127,12 @@ def main():

try:
print("{}: Starting connection".format(client_id))
hostname = connection_settings['MQTT_HOST_NAME']
port = connection_settings['MQTT_TCP_PORT']
keepalive = connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"]
mqtt_client.connect(hostname, port, keepalive)
mqtt_client.connect(
host=connection_settings['MQTT_HOST_NAME'],
port=connection_settings['MQTT_TCP_PORT'],
keepalive=connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"],
clean_start=connection_settings['MQTT_CLEAN_SESSION']
)
print("Starting network loop")
mqtt_client.loop_start()

Expand Down
13 changes: 7 additions & 6 deletions scenarios/telemetry/python/telemetry_producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def wait_for_disconnected(timeout: float = None):
def create_mqtt_client(client_id, connection_settings):
mqtt_client = mqtt.Client(
client_id=client_id,
clean_session=connection_settings['MQTT_CLEAN_SESSION'],
protocol=mqtt.MQTTv311,
protocol=mqtt.MQTTv5,
transport="tcp",
)
if 'MQTT_USERNAME' in connection_settings:
Expand Down Expand Up @@ -115,10 +114,12 @@ def main():
try:
# CONNECT
print("{}: Starting connection".format(client_id))
hostname = connection_settings['MQTT_HOST_NAME']
port = connection_settings['MQTT_TCP_PORT']
keepalive = connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"]
mqtt_client.connect(hostname, port, keepalive)
mqtt_client.connect(
host=connection_settings['MQTT_HOST_NAME'],
port=connection_settings['MQTT_TCP_PORT'],
keepalive=connection_settings["MQTT_KEEP_ALIVE_IN_SECONDS"],
clean_start=connection_settings["MQTT_CLEAN_SESSION"],
)
print("Starting network loop")
mqtt_client.loop_start()

Expand Down