Giter Site home page Giter Site logo

Comments (2)

tdicola avatar tdicola commented on July 30, 2024

Hrm I can't repro this with the mosquitto test server (http://test.mosquitto.org/). Here's the auth configuration I was using for the sketch:

/************************* Adafruit.io Setup *********************************/

#define AIO_SERVER      "test.mosquitto.org"
#define AIO_SERVERPORT  1883
#define AIO_USERNAME    ""
#define AIO_KEY         ""

And the feed config (slight change to add my name/a unique value to the front of the feed so nothing conflicts with it on the test server):


// Setup a feed called 'photocell' for publishing.
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
const char PHOTOCELL_FEED[] PROGMEM = AIO_USERNAME "tdicola/feeds/photocell";
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, PHOTOCELL_FEED);

// Setup a feed called 'onoff' for subscribing to changes.
const char ONOFF_FEED[] PROGMEM = AIO_USERNAME "tdicola/feeds/onoff";
Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, ONOFF_FEED);

I let it connect to the mosquitto test server, then using this Paho MQTT python library (https://pypi.python.org/pypi/paho-mqtt) code on another machine I published a message to the 'tdicola/feeds/onoff' feed that the sketch is listening to. Here's the code I was using:

import paho.mqtt.publish as publish
publish.single('tdicola/feeds/onoff', payload='ON', hostname='test.mosquitto.org', port=1883)
print 'Sent message!'

In the serial output I only see one message received:

Sending photocell val 249...OK!
Got: ON

Sending photocell val 250...OK!

I'm curious how are you publishing messages when testing on other brokers--could it be sending two messages?

For Adafruit IO specifically though it does look like right now one change, like pressing a toggle switch on a dashboard, can generate two events. It's something being looked at to simplify and only generate one message, but for now there could be duplicates since it's QOS 0.

For other brokers though if you send one message and receive two responses with the library it does seem unexpected. Let me know if you have more details on a repro example and I can try it too. Thanks!

from adafruit_mqtt_library.

toddtreece avatar toddtreece commented on July 30, 2024

the duplicate message issue was fixed with io.adafruit.com, so i'm going to close this one

from adafruit_mqtt_library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.