Customizing Application Server to write Downlink payload(maccommands) to db (loradatastore)

Hi,
Im trying to get downlinks’ MacCommands in Application Server and write them to the loradatastore db which has no downlink table(but it has uplink table named “device_up”). Because I want to track MacCommands, which the Downlinks has it in, that is sending from Network Server to the Gateway.
However, as I recognized, there is no related function in application server to handle downlink payload. I can see downlinks’ maccommands in the application server’s UI but I want to handle this data when the UI is not running.

I forked your source codes from your github repositories. I can access Downlinks’ MacCommands in Network Server, I think I should send these to AS. In AS, I try to add a controller to the as.go named HandleDownlinkData(like HandleUplinkData) but in this case I should add new structs related downlink to the API’s readonly files(like as.pb.go). I guess this is not a best practice for this work.

What would you suggest to me in this case ?
Thanks.

@brocaar

Maybe the Uplink / downlink logging to Redis Stream feature which was recently introduced could help you?

https://www.chirpstack.io/network-server/changelog/#uplink-downlink-logging-to-redis-stream

It is not hepling because we want a persistent storage like other lora servers have. But we put an downlink event to the AS and triggerred it from the NS. Downlink event passes to the postgresql integration statically and writes the data to the “device_down” table just like the “device_up” table.

1 Like