adafruit / Adafruit_CircuitPython_AdafruitIO

Adafruit IO for CircuitPython
http://io.adafruit.com
MIT License
49 stars 33 forks source link

Missing "on_publish" event callback in the class IO_MQTT - adafruit_io.py #122

Closed wavesailor closed 3 months ago

wavesailor commented 4 months ago

The "on_publish" event callback is missing in the class IO_MQTT which is defined in the library module adafruit_io.py. This for the latest library version: adafruit-circuitpython-bundle-py-20240702.zip

class IO_MQTT:
...
    def __init__(self, mqtt_client):
    ...
        # User-defined MQTT callback methods must be init'd to None
        self.on_connect = None
        self.on_disconnect = None
        self.on_message = None
        self.on_subscribe = None
        self.on_unsubscribe = None
        # MQTT event callbacks
        self._client.on_connect = self._on_connect_mqtt
        self._client.on_disconnect = self._on_disconnect_mqtt
        self._client.on_message = self._on_message_mqtt
        self._client.on_subscribe = self._on_subscribe_mqtt
        self._client.on_unsubscribe = self._on_unsubscribe_mqtt
        self._connected = False
        ...
...

It is defined in the class MQTT in library module adafruit_minimqtt.py

class MQTT:
...
    def __init__(
        ...
        # Default topic callback methods
        self._on_message = None
        self.on_connect = None
        self.on_disconnect = None
        self.on_publish = None
        self.on_subscribe = None
        self.on_unsubscribe = None
        ....
...
brentru commented 4 months ago

@tyeth Want to take a look?