Skip to content

Commit e16f1a5

Browse files
committed
Cleanup whitespace
1 parent 10d374a commit e16f1a5

6 files changed

+16
-6
lines changed

adafruit_io/adafruit_io.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ def _on_message_mqtt(self, client, topic: str, payload: str):
204204
self.on_message(self, topic_name, message)
205205

206206
# pylint: disable=not-callable, unused-argument
207-
def _on_publish_mqtt(self, client, user_data, pid):
207+
def _on_publish_mqtt(self, client, user_data, topic, pid):
208208
"""Runs when the client calls on_publish."""
209209
if self.on_publish is not None:
210-
self.on_publish(self, user_data, pid)
210+
self.on_publish(self, user_data, topic, pid)
211211

212212
# pylint: disable=not-callable
213213
def _on_subscribe_mqtt(self, client, user_data, topic, qos):

examples/adafruit_io_mqtt/adafruit_io_feed_callback.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def publish(client, userdata, topic, pid):
8181
# This method is called when the client publishes data to a feed.
8282
print("Published to {0} with PID {1}".format(topic, pid))
8383
if userdata is not None:
84-
print("Published User data: ",end="")
84+
print("Published User data: ", end="")
8585
print(userdata)
8686

8787

examples/adafruit_io_mqtt/adafruit_io_pubsub_rp2040.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def publish(client, userdata, topic, pid):
5454
# This method is called when the client publishes data to a feed.
5555
print("Published to {0} with PID {1}".format(topic, pid))
5656
if userdata is not None:
57-
print("Published User data: ",end="")
57+
print("Published User data: ", end="")
5858
print(userdata)
5959

6060

examples/adafruit_io_mqtt/adafruit_io_simpletest_cellular.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def publish(client, userdata, topic, pid):
8282
# This method is called when the client publishes data to a feed.
8383
print("Published to {0} with PID {1}".format(topic, pid))
8484
if userdata is not None:
85-
print("Published User data: ",end="")
85+
print("Published User data: ", end="")
8686
print(userdata)
8787

8888

examples/adafruit_io_mqtt/adafruit_io_simpletest_esp32s2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def publish(client, userdata, topic, pid):
7979
# This method is called when the client publishes data to a feed.
8080
print("Published to {0} with PID {1}".format(topic, pid))
8181
if userdata is not None:
82-
print("Published User data: ",end="")
82+
print("Published User data: ", end="")
8383
print(userdata)
8484

8585

examples/adafruit_io_simpletest.py

+10
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ def disconnected(client):
8484
print("Disconnected from Adafruit IO!")
8585

8686

87+
# pylint: disable=unused-argument
88+
def publish(client, userdata, topic, pid):
89+
"""This method is called when the client publishes data to a feed."""
90+
print(f"Published to {topic} with PID {pid}")
91+
if userdata is not None:
92+
print("Published User data: ", end="")
93+
print(userdata)
94+
95+
8796
# pylint: disable=unused-argument
8897
def message(client, feed_id, payload):
8998
# Message function will be called when a subscribed feed has a new value.
@@ -120,6 +129,7 @@ def message(client, feed_id, payload):
120129
io.on_subscribe = subscribe
121130
io.on_unsubscribe = unsubscribe
122131
io.on_message = message
132+
io.on_publish = publish
123133

124134
# Connect to Adafruit IO
125135
print("Connecting to Adafruit IO...")

0 commit comments

Comments
 (0)