• Fri 2020.04.24

    http://www.espruino.com/tinyMQTT
    http://www.espruino.com/MQTT

    First time user configuring the MQTT broker for Windows10.

    https://mosquitto.org/

    Have installed mosquitto and am able to start inside a cmd.exe window:

    D:\Program Files\mosquitto>mosquitto -v
    1587778119: mosquitto version 1.6.9 starting
    1587778119: Using default config.
    1587778119: Opening ipv6 listen socket on port 1883.
    1587778119: Opening ipv4 listen socket on port 1883.
    

    I have attempted using the test server, with no apparent success. Switched to localhost, no luck there either.

    var mqtt = require("tinyMQTT").create("test.mosquitto.org");
    var mqtt = require("tinyMQTT").create("localhost");
    var mqtt = require("tinyMQTT").create("127.0.0.1");
    

    Most likely either a configuration issue or likely a 'how to use' issue. Any insight to get over the hump would be appreciated. Thanks in advance.

    Familiar with xampp and now off to review and see if possible to pass data through that means.

  • Sat 2020.04.25

    Well, that took a bit of searching.

    https://stackoverflow.com/questions/26716279/how-to-test-the-mosquitto-server

    D:\Program Files\mosquitto>mosquitto -v
    1587778119: mosquitto version 1.6.9 starting
    1587778119: Using default config.
    1587778119: Opening ipv6 listen socket on port 1883.
    1587778119: Opening ipv4 listen socket on port 1883.
    1587782463: New connection from 192.168.1.70 on port 1883.
    1587818485: Client <unknown> has exceeded timeout, disconnecting.
    1587818555: New connection from ::1 on port 1883.
    1587818555: New client connected from ::1 as mosq-IhvXaEE4c7edRcm7oB (p2, c1, k60).
    1587818555: No will message specified.
    1587818555: Sending CONNACK to mosq-IhvXaEE4c7edRcm7oB (0, 0)
    1587818555: Received SUBSCRIBE from mosq-IhvXaEE4c7edRcm7oB
    1587818555:     'test/topic' (QoS 0)
    1587818555: mosq-IhvXaEE4c7edRcm7oB 0 'test/topic'
    1587818555: Sending SUBACK to mosq-IhvXaEE4c7edRcm7oB
    1587818615: Received PINGREQ from mosq-IhvXaEE4c7edRcm7oB
    1587818615: Sending PINGRESP to mosq-IhvXaEE4c7edRcm7oB
    1587818622: New connection from ::1 on port 1883.
    1587818622: New client connected from ::1 as mosq-gVXsXW2uZllppBjj8I (p2, c1, k60).
    1587818622: No will message specified.
    1587818622: Sending CONNACK to mosq-gVXsXW2uZllppBjj8I (0, 0)
    1587818622: Received PUBLISH from mosq-gVXsXW2uZllppBjj8I (d0, q0, r0, m0, ''test/topic'', ... (12 bytes))
    1587818622: Sending PUBLISH to mosq-IhvXaEE4c7edRcm7oB (d0, q0, r0, m0, ''test/topic'', ... (12 bytes))
    1587818622: Received DISCONNECT from mosq-gVXsXW2uZllppBjj8I
    1587818622: Client mosq-gVXsXW2uZllppBjj8I disconnected.
    1587818674: Received PINGREQ from mosq-IhvXaEE4c7edRcm7oB
    1587818674: Sending PINGRESP to mosq-IhvXaEE4c7edRcm7oB
    1587818734: Received PINGREQ from mosq-IhvXaEE4c7edRcm7oB
    



    Sending and Receiving!! Now off to load up tinyMQTT . . . .

  • Sat 2020.04.25

    I'm at a loss. I'm missing a piece of the puzzle, conceptually.

    I switched to an Espruino WiFi, as tinyMQTT is setup for that, for a sanity check.

    From a cmd window, I'm able to publish a topic and message that a subscriber is able to display. This means the MQTT broker, Mosquitto is running as a server. I also believe that socket communication is occurring on the default port :1883 confirmed by netstat and the fact no errors appear.

    Unable to make further progress, for a sanity check, I created a Xampp server and am able to view .html pages along with exectuting .php scripts from the Windows file system, using the browser as a client. Using Fiddler, I'm able to detect and view packets that go out to the web.

    Loading tinyMQTT onto the WiFi does in fact blink the WiFi LED once a second for around ten seconds, concluded by the 'disconnect' message.

    Here is where there seems to be a disconnect. I'm not seeing packet traffic using Fiddler. That app did recently update, and appears very different, so still getting used to that, and am 90% sure there isn't an option I'm missing. It is quite possible I'm not remembering all the needed detail for bi-direction WiFi, I'll keep at that.

    Re-reading Espruino docs for MQTT, tinyMQTT and EspruinoHub, I'm under the impression that the PI is used as a server running Node-Red to use as an intermediary for the Espruino WiFi device we are attempting to build. I shouldn't even need the PI, nor do I want to learn another OS or that line of device hardware, as Mosquitto is running on the PC. My belief is that should be the equivalent and actually replace the PI at this point. Is that concept true?

    So it appears I'm missing the part that bridges the WiFi communication through to Windows on through the dedicated socket used by the Mosquitto Pub-Sub server. Anyone able to confirm and assist with the missing conceptual part or provide some troubleshooting ideas, snippets, web links to move forward?

  • First guess: windows firewall blocks MQTT packet. Check windows firewall settings.
    0th point: your Espruino Wifi can connect to your Wifi, and for example can GET google.com?
    1st point: your Espruino Wifi can access your computer. Can it get the same html you can access with your browser? You try to connect to the right IP address? If your computer has multiple network cards, VPN set up, VM running on your macine, you might have multiple IP addresses.

    Last time I used Fiddler, it didn't capture incoming traffic. Only outgoing traffic. So your MQTT traffic won't show up.

    Do you have another computer or did you get phone / tablet that could be used to verify connectivity? For example Fing is pretty useful to scan your wifi, discover devices and find open ports:

    • is your computer and Espruino Wifi present on the same Wifi network as expected?
    • does your computer have the IP address you think it has?
    • is port 1883 open on your PC?


    Don't have anything, because that was before a couple of reinstalls, but ESP8266 could connect to mosquitto running on Win10. IIRC just followed the official guide because test.mosquitto.org was unreliable...

    Yes, the PI is just a computer running Linux, nothing special. Just it's easier and cheaper to run 24/7/365 than your normal PC...

  • Thank you @AkosLukacs - loads to absorb there, will be busy the rest of this evening!! ;-)



    I see that you have been successful with WiFI <==> MQTT
    Have you any desire over BLE?
    @BobFrankston has made some strides here #21 post:

    ble<=>ip

    Solving this would be really cool for Bangle/widgets, as I'm sure Bob see's it that way too.

  • Hey, wait, what? Just reading the topic now: "MDBT42Q". That's BLE chip. I see that other topic now.
    Have tried EspruinoHub, but BLE doesn't seem to be powerful enough in my house (50-60cm thick brick main walls). So home automation things just use wifi or on hold for now...

  • 'I see that other topic now'

    I can even hear your wheels turnin' on the other side of the world! What about a Bangle controller for that home automation? Time for me to dig out that MDBT42Q <==> WiFi SPI bus direction switching proof of concept code now that we have a visual means using Bangle to send via BLE.

  • Sun 2020.04.26

    Well @AkosLukacs it appears your #4 post 0th and 1st points are starting to prove out.

    new Sun Apr 26 post Sanity check for Wifi and http modules please

    While I never saw any errors using the MQTT tutorial snippet, they are certainly there calling the Wifi and http modules directly. Since I can't get at the AP and IP detail to debug, unable to progress further.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Configuring MQTT for tinyMQTT mosquitto.conf using MDBT42Q running on Windows10

Posted by Avatar for Robin @Robin

Actions