Gateway Warning - could not decode client ID

Hello, since version 3.11.0 I get following warning:

user.warn chirpstack-gateway-bridge[9842]: time=“2017-01-07T20:56:56.07667604Z” level=warning msg=“integration/mqtt/auth: could not decode client ID to gateway ID” client_id=LoRaWanAP-45-Gaerberbach error=“encoding/hex: invalid byte: U+004C ‘L’”

Any hints on what that does mean?


It means the configured client_id can’t be decoded as Gateway ID. This is a warning, not an error. If you configure the client_id to the Gateway ID (e.g. “0102030405060708”), then this will enable the MQTT last-will and testament feature :slight_smile:

1 Like

Hello @brocaar

as far as I understand, the Testamanet and Last-Will function is there to let the client tell the broker what will happen when the connection to the broker is aborted.

this happens automatically if the client_id = DevEUI.

My question: what is the “default-last-will” of Chirpstack Gateway Bridge? And where can this be customized?

If the client_id can be decoded to a Gateway ID, it will set a retained message containing the Gateway ID + connected state. Then if it disconnects, the LWT triggers sending a retained message containing the Gateway ID + disconnected state.

thank you - makes it a bit more clear.
so if the gateway disconnects, LWT sends Gateway ID + disconneected state.

why is this good? what does chirpstack do with this infomation?

It is (currently) not used by ChirpStack itself, but it can be used by external monitoring software to monitor which gateways are connected / disconnected. E.g. if a gateway often disconnects and you don’t monitor the MQTT broker logs, you might never know that a gateway has connectivity issues. By making this connection state message retained, you can at every time query the connection state of a given Gateway ID.


i have now configured this “feature”.
now i get the messages in protobuf format.

is there any example how to “decode” this? maybe in python? i can’t find anything in the docs.


its me again :wink:

sorry, i found it out by myself. if anyone else needs a python example - here you go.
its not a clean script, but it does check “ConnState” on mqtt.

from google.protobuf.json_format import Parse
import as gateway
import paho.mqtt.client as mqtt #import the client

import variables

mqtt_server = variables.mqtt_server
mqtt_port = variables.mqtt_port
mqtt_topic = variables.mqtt_topic
mqtt_client_id = variables.mqtt_client_id
mqtt_ca_certs = variables.mqtt_ca_certs

def unmarshal(message, pl):
    return pl

def on_connect(client, userdata, flags, rc):
    if rc==0:
        print("The Application has successfull connected to the MQTT broker %s on port %s as %s" % (mqtt_server, mqtt_port, mqtt_client_id))
        print("Bad connection Returned code=",rc)
        sys.exit("no connection possible")

def on_message(client, userdata, message):
    conn = unmarshal(message.payload, gateway.ConnState())
    print("Got: Gateway: %s with Message %s" % (conn.gateway_id.hex(), conn.state))

client = mqtt.Client(client_id=mqtt_client_id)
client.on_connect = on_connect
client.on_message = on_message

client.connect(mqtt_server, port=mqtt_port, keepalive=30) #connect to broker
client.loop_forever() #start the loop

hope it helps for someone