• I have a pixel ring and an Espruino WiFi firmware: 2v07.

    I am doing some basics MQTT testing, I send a message from my Raspberry PI via an MQTT broker. It's extremely simple as follows:

    topic: heartbeat
    message: 0 || 1 driven by an occupancy sensor.

    Here's a snippet of where the values are received and output to the WebIDE:

    function onInit() {
      wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) {
        if (err) {
          return;
        }
        startMQTT();
      });
    }
    
    function startMQTT() {
      mqtt = require("MQTT").create(server, options);
      
      mqtt.on('connected', function() {
        mqtt.subscribe("heartbeat");
      });
    
      mqtt.on('publish', function (pub) {
        console.log(pub.topic, pub.message);
        if(pub.message === '1') {
          lightsOn();
        }else{
          lightsOff();
        }
      });
    
      mqtt.connect();
    }
    

    I'll also include an image from another tool I debug topics/messages on Windows, this doesn't appear to show any malformed topic or message.

    What is confusing is that i'm only subscribing to the "heartbeat" topic, so how could it even output something other than heartbeat? Like heartb1 or rtbeat1 as seen below!

    Any idea what could be causing this, or where to even start debugging something like this using the MQTT library for Espruino?

    Thanks, Neil


    2 Attachments

    • espruino2.png
    • espruino1.png
About

Avatar for Coder2012 @Coder2012 started