• Re:
    Advertising

    Data that is received via bluetooth advertising will be relayed over
    MQTT in the following format:

    /ble/presence/DEVICE - 1 or 0 depending on whether device has been seen or not
    /ble/advertise/DEVICE - JSON for device's broadcast name, rssi and manufacturer-specific data (if mqtt_advertise=true in config.json -the default)
    /ble/advertise/DEVICE/manufacturer/COMPA­NY - Manufacturer-specific data (without leading company code) encoded in base16. To decode use var data = Buffer.from(msg.payload, 'hex'); (if mqtt_advertise_manufacturer_data=true in config.json - the default)
    /ble/advertise/DEVICE/rssi - Device signal strength
    /ble/advertise/DEVICE/SERVICE - Raw service data (as a JSON Array of bytes) (if mqtt_advertise_service_data=true in config.json)
    /ble/advertise/DEVICE/PRETTY or /ble/PRETTY/DEVICE - Decoded service data based on the decoding in attributes.js
        1809 decodes to temp (Temperature in C)
        180f decodes to battery
        feaa decodes to url (Eddystone)
        2a6d decodes to pressure (Pressure in pa)
        2a6e decodes to temp (Temperature in C)
        2a6f decodes to humidity (Humidity in %)
        ffff decodes to data (This is not a standard - however it's useful for debugging or quick tests)
    /ble/json/DEVICE/UUID - Decoded service data (as above) as JSON, eg /ble/json/DEVICE/1809 => {"temp":16.5} (if mqtt_format_json=true in config.json - the default)
    /ble/advertise/DEVICE/espruino - If manufacturer data is broadcast Espruino's manufacturer ID 0x0590 and it is valid JSON, it is rebroadcast. If an object like {"a":1,"b":2} is sent,
    /ble/advertise/DEVICE/a and /ble/advertise/DEVICE/b will also be sent. (A JSON5 parser is used, so the more compact {a:1,b:2} is also valid).
    

    I have multiple devices and would like to register for messages from any of them. Sometimes I take one to my Mom's house where one is in use for her to have a panic button that sends me an SMS when she presses it. I have a lab setup at home here. I have another one etc etc.

    Rather than having to change the ID for each environment it would be nice to register for any messages coming from manufacturer ID == x.

    Is it correct that that isn't available using the current broadcasting/registration model?

  • The code that handles this is at https://github.com/espruino/EspruinoHub/­blob/master/lib/discovery.js#L135-L169

    And as far as I can tell, if you sent any service data it should be relayed as /ble/advertise/DEVICE/SERVICE (as long as mqtt_advertise_service_data is set in the config)

    So I guess you could use that? Obviously something similar could be implemented for manufacturer data but IMO using service data is just as easy.

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

Regarding Espruino Hub, is there a way to register for any espruino device messages?

Posted by Avatar for HeneryH_(Henery_Hawk) @HeneryH_(Henery_Hawk)

Actions