@@ -84,6 +84,8 @@ def __init__(self, mqtt_client):
84
84
self ._client .on_connect = self ._on_connect_mqtt
85
85
self ._client .on_disconnect = self ._on_disconnect_mqtt
86
86
self ._client .on_message = self ._on_message_mqtt
87
+ self ._client .on_subscribe = self ._on_subscribe_mqtt
88
+ self ._client .on_unsubscribe = self ._on_unsubscribe_mqtt
87
89
self ._logger = False
88
90
# Write to the MiniMQTT logger, if avaliable.
89
91
if self ._client .logger is not None :
@@ -182,6 +184,24 @@ def _on_message_mqtt(self, client, topic, payload):
182
184
)
183
185
self .on_message (self , topic_name , message )
184
186
187
+ # pylint: disable=not-callable
188
+ def _on_subscribe_mqtt (self , client , user_data , topic , qos ):
189
+ """Runs when the client calls on_subscribe.
190
+ """
191
+ if self ._logger :
192
+ self ._client ._logger .debug ("Client called on_subscribe" )
193
+ if self .on_subscribe is not None :
194
+ self .on_subscribe (self , user_data , topic , qos )
195
+
196
+ # pylint: disable=not-callable
197
+ def _on_unsubscribe_mqtt (self , client , user_data , topic , pid ):
198
+ """Runs when the client calls on_unsubscribe.
199
+ """
200
+ if self ._logger :
201
+ self ._client ._logger .debug ("Client called on_unsubscribe" )
202
+ if self .on_unsubscribe is not None :
203
+ self .on_unsubscribe (self , user_data , topic , pid )
204
+
185
205
def loop (self ):
186
206
"""Manually process messages from Adafruit IO.
187
207
Call this method to check incoming subscription messages.
0 commit comments