adafruit / Adafruit_CircuitPython_MiniMQTT

MQTT Client Library for CircuitPython
Other
72 stars 50 forks source link

publish to a group is not working with is_group (bool) parameter? #180

Closed cudmore closed 8 months ago

cudmore commented 8 months ago

I have a number of Arduinos, each publishes to their own group.

I see the publish() is_group optional parameter in the API documentation and in the source code.

But when I call it from my CircuitPython code

try:
   mqtt_client.publish(feed, value, is_group=True)
except (ConnectionError) as e:
    print('iotMqtt error in publish', e)

I get the following

TypeError: unexpected keyword argument 'is_group'

In this example, mqtt_client = adafruit_minimqtt.MQTT and feed="rhcudmore/feeds/nano1.state"

I tried with two versions of the circuit python libraries but get the same error?

I am running CircuitPython on a Arduino RP2040 connect.

Any suggestions on how to get is_group working?

p.s. in the source code for def publish()

if is_group:
    self._client.publish("{0}/g/{1}".format(self._user, feed_key), data)
if shared_user is not None:
    self._client.publish("{0}/f/{1}".format(shared_user, feed_key), data)

Even if is_group was working, what is this feed format with /g/? Rather than the more documented feed format with /f/.

cudmore commented 8 months ago

Ah, got it. The is_group is defined for IO_MQTT.

It is not part of adafruit_minimqtt.MQTT.