Hi I currently have a sensor joined to my chirpstack 4 lorawan network however I’m not sure how I would go about retrieving the data that is sent by the sensor. Ultimately I want to retrieve the data that is sent it looks like this data:“sN8g6HkKaVoUAKE=” I want to be able to retrieve that value using an api call so I can take the location data that can be retrieve from that string and plot it on a map. The part I am stuck with is how to using chirpstack 4 retrieve that value for each sensor i have on network.
Any help would be appreciated as i’ve had a look online but there doesn’t seem to be a whole lot of code examples out there.
You could use a deviceMetricsRequest via the grpc API to retrieve recent data. But as Chirpstack does not store device events for long, the recommended way to pull data out of Chirpstack is using an integration.
Also incase you don’t know, you can add a codec to the device profile of the device in order for Chirpstack to automatically decode the data when it gets it. So instead of data:“sN8g6HkKaVoUAKE=” Chirpstack would show “lat:30, long:60” and such. Most device manufacturers also provide codecs online.
Thanks for your response I’ll look into doing it that way I have a codec currently but it doesn’t appear to be working I think the oyster 3 Codec online needs to be modified slightly to work with chirp stack I saw a post on here of someone who had it working but they didn’t share the code so I’ll need to figure out what they changed to get it to work.
Wow that seems to be working thanks do you know if I can use the api to extract that location data now without having to decode the string again once the data is exported.
Do you know if there is any guides or anything out there for doing API data extraction I’ve done a bit of coding before but I’ve never had to extract data before.
In default Chirpstack, messages to/from gateways are posted under your region-
prefix (au915_0 in this case) these are still encrypted and considered the backend. The decrypted messages you want are posted under “application/…”, these are messages Chirpstack posts back to the broker after it has decrypted the region-prefix events and are considered the integration events.
Seeing as you don’t have any application/ events in MQTT explorer, you should check your chirpstack.toml to ensure the MQTT integration is set up, but it should be by default. The section you are looking for is [integration.mqtt] and the “server=” line should be pointed to Chirpstack’s broker. If that is set up correctly and you still do not see “application/…” events there is likely some other issue.
As an aside, an easy way to view the broker rather than using MQTT explorer is to just run mosquitto_sub -t "#" -v on the Chirpstack host (if you are running docker you will have to enter you mosquitto container first, or specify port/host). With that you should be able to see all the events and data.
I was able to get the application/ message to show in MQTT explorer by leaving it open for a while in the background. I am guessing it only updates when the sensors sends new data.
So I have setup pipe dream with HTTP integration and can see the post requests being sent to that however when I host a local server chirpstack doesn’t seem to be sending data to it however when I send the requests to the same url as configured in chirpstack via postman it can see the requests. I’m hosting the python script (the webserver) on the same machine as chirpstack is installed on. The only thing that I can maybe think of is that because my url is only http and not https it isn’t posting the data?