Unable to initiate a connection between a local Chirpstack docker and a mocked Gateway

I’m in the process of implementing a local dev environment for Chirpstack without having to setup real devices and gateways and I seem to have encountered a rather strange roadblock.

Using the Chirpstack-Docker straight out of the box, I’m unable to mock a gateway and device connection. I’ve tried by hand to emulate a gateway /conn + /stats payload, but even then, my local Chirpstack instance doesn’t acknowledge my mocked gateway’s existence (the “Last Seen” field in Chirpstack is never updated).

However when using LWN Simulator to simulate a device and gateway, the local gateway-bridge registers a /conn event and starts listening for other events of the gateway. However, the same thing as before happens.

My takeaway from all this is that there’s probably something rather obvious I’m missing either in the Chirpstack.toml or when creating my tenant + application.

Does anyone have any idea what could be the issue?

The gateways “last seen” status is based on stats messages, not /conn events.

Not sure why LWN simulator wouldn’t be sending those though.

Hi Liam, thanks for your reply, this is indeed weird, even the device’s join request don’t appear to work with the LWN-Simulator.

However, I have found my problem regarding why my gateway and devices were never seen. Turns out that I had a local Mosquitto instance that ran in the background on my computer. As such, Chirpstack was subscribed to the Mosquitto inside Chirpstack-Docker, whilst I was both subscribed and broadcasting my /stats and /conn events on my local Mosquitto instance.

To fix this problem I had to kill the process that ran Mosquitto on my local computer and eventually uninstalled it completely.

Once done, subscribing to mqtt://localhost:1883 in MQTT Explorer now showed what was going on inside the docker instead of my local instance.

So if someone else has a similar problem, close Chirpstack-Docker and make sure that the Mosquitto broker you have subscribed to stops working (you should be disconnected). You can also run the “ps” command on your machine to double-check that you don’t have a rogue “mosquitto” process running in the background.

As for the LWN-Simulator I was only really using it as a debugging tool for my issue. At time of writing, it still wasn’t working. Even with ABP devices, the simulator cannot get them to join and it never sent a “/stats” to Chirpstack (I did however see a few /conn topics).

Hope this helps someone else eventually!

1 Like