Configure parameters with MQTT

AB BLE Gateway V4 supports update parameters with MQTT from firmware v1.4.14. You can update parameters for one gateway or multiple gateways.

How to config parameters with MQTT

  • Download and install config tool v1.3.4+
  • BLE gateway must work as MQTT Client
  • Enable option Config by MQTT and set the Config Topic

Here're the required topics

  • Config Topic
  • Topic Prefix For Device Inbox
  • Device Outbox Topic

Config Topic

BLE gateway will subscribe the Config Topic when it connected MQTT broker. It uses to get parameters and change parameters remotely. You can use Config Topic for batch configure parameters for gateways.

An example for configure message (JSON format)

{
    "event": "update",
    "version": 1,
    "config": {
        "app": {
            "mqtt-host": "mqtt.bconimg.com",
            "mqtt-port": 1883,
            "mqtt-topic": "new/topic"
        },
        "network": {
            "ssid": "hello",
            "passcode": "12345678"
        },
        "filter-mac": [
            "123B00000000",
            "CC0000000000"
        ]
    }
}

Query application parameters

{
    "event": "query/app",
    "version": 1
}

Query network parameters

{
    "event": "query/net",
    "version": 1
}

Restart device

{
    "event": "restart",
    "version": 1
}

Query device information (Added from firmware v1.5.11)

{
    "event": "query/dev",
    "version": 1
}

Request OTA update(Added from firmware v1.5.12)

{
    "event": "ota",
    "version": 1
}

Note:

  • version must equal 1
  • event must be update for change parameters

Topic Prefix For Device Inbox

BLE gateway will subscribe the Topic Prefix For Device Inbox + MAC address when it connected MQTT broker. It uses to get parameters and change parameters for one gateway.

e.g.

  • Let's say the prefix is device/config/
  • The MAC address for gateway is AB123456FDEC
  • BLE gateway will subscribe topic = device/config/AB123456FDEC when it connected MQTT broker

See the example message in section Config Topic

Device Outbox Topic

BLE gateway will publish response data to Device Outbox Topic if it get query message

An example response message for event query/app

{
    "event": "app",
    "mac": "AB123456FDEC",
    "data": {
        ......
    }
}

Example response message for event query/net

{
    "event": "net",
    "mac": "AB123456FDEC",
    "data": {
        ......
    }
}

Supported parameters

app parameters

ParameterTypeDescription
conn-typeuint8Connection type, 1=WebSocket, 2=HTTP, 3=MQTT
req-intuint16Request interval,range is 1 ~ 180 second
min-rssiint8RSSI filter,default value is -127
adv-filteruint8Advertising filter, 0=no filter, 1=iBeacon only, 2=Eddystone UID only, 3=Eddystone URL only, 11=iBeacon+Eddystone TLM, 12=Eddystone UID+Eddystone TLM, 13=Eddystone URL+Eddystone TLM
dup-filteruint8Duplication filter, default 0
scan-actuint8Active scan, default 0
mqtt-portuint32MQTT Broker's port
http-portuint32HTTP server's port
ws-portuint32WebSocket Server's port
ota-urlstringOTA URL
http-hoststringHTTP server's hostname
mqtt-hoststringMQTT Broker's hostname
ws-hoststringWebSocket server's hostname
httpsuint8Enable HTTPS,default 0
mqttsuint8Enable MQTTS,default 0
wssuint8Enable WSS,defautl 0
mqtt-topicstringMQTT Topic
mqtt-usernamestringMQTT username
mqtt-passwordstringMQTT password
mqtt-id-prefixstringMQTT Client ID prefix
cfg-topicstringMQTT config topic
one-cfg-topicstringTopic Prefix For Device Inbox
mqtt-configuint8Enalbe MQTT config, default 0
http-urlstringHTTP server URI
filter-uuidstringiBeacon UUID filter, one uuid one line.
req-formatuint8Request format,0=msgpack, 1=json
ntp-enableduint8enable ntp client, default 0
ntp1stringFirst ntp server
ntp2stringSecond ntp server

Network parameters

ParametertypeDescripton
wifi-typeuint8WiFi type, 0=WAP, 1=WPA2 Enterprise
ssidstringWiFi SSID
passcodestringWiFi password
eap-identitystringEAP identify
eap-usernamestringEAP username
eap-passcodestringEAP passcode
eth-dhcpuint8Enable DHCP,default 1
eth-ipuint32Static IP address, enable when eth-dhcp=0
eth-gatewayuint32Network Gateway IP
eth-netmaskuint32Netmask
dns-mainuint32Main DNS,enable when eth-dhcp=0
dns-backupuint32Backup DNS
dns-fallbackuint32Fallback DNS

mac address filter

Use key filter-mac to configure mac address filter. It's an array. Per item is a mac address.

Last Updated:
Contributors: yanc, volca