You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Hi,

    I cant seem to get mqtt explorer on mac to connect to EH even though Im using the same ip address that my browser is getting connected with

    Port 1883 should do it, however maybe you could log into the Pi and type mosquitto_sub -v -t "#" to see if you can connect to MQTT on the Pi? It's possible it isn't installed.

    It might also be qorth checking /etc/mosquitto/mosquitto.conf and /etc/mosquitto/conf.d to check there's nothing in there that's stopping it accepting outside connections. It seems an options called bind_addresss can end up locking it down.

    I want to send state change data for when its moving so i did this

    Ok, I think the issue is there are two different communication methods in Bluetooth:

    • Advertising - where you have your Manufacturer Data UUID like 0x0590. This is what gets broadcast to everyone (without a connection needed) and what EspruinoHub picks up normally
    • Services/Characteristics - with setServices/updateServices - these are only available when you're actually connected to a device. EspruinoHub can read these but you have to specifically request that it does it by MQTT messages.

    So I think realistically for what you want, you just want to do NRF.setAdvertising like the example at the bottom of: http://www.espruino.com/Reference#l_NRF_­setAdvertising

    So:

    function UpdateNewServiceValue (val){
    NRF.setAdvertising({},{
      showName:false,
      manufacturer:0x0590,
      manufacturerData:JSON.stringify(val)
    });
    }
    
About

Avatar for Gordon @Gordon started