TheThingsNetwork / lorawan-stack

The Things Stack, an Open Source LoRaWAN Network Server
https://www.thethingsindustries.com/stack/
Apache License 2.0
936 stars 302 forks source link

Display both AFcntDown and NFcntDown on the device console #6946

Closed StevenCellist closed 3 months ago

StevenCellist commented 4 months ago

Summary

Display the application downlink frame counter as well as the network downlink frame counter in the device console, next to the uplink frame counter.

Current Situation

Currently, the single downlink frame counter only keeps track of the application downlink frame counter, and does not show anything related to the network frame counter. To find out the actual FCnt and keep track of network downlinks, one has to leave the console open to catch a network downlink, which shows the actual FCnt. Although, even this event only shows a complete FCnt, not a separation between AFcnt and NFcnt.

Why do we need this? Who uses it, and when?

Adding the network downlink frame counter aids easier analysis of behaviour of individual nodes, e.g. performance under ADR. Some RF environments are quite unstable, causing many ADR downlinks; being able to compare these 'hidden' downlinks quantitively will help a lot. It also helps validating correct behaviour of nodes in general.

Proposed Implementation

Change the current downlink frame counter such that it shows the AFcnt / NFcnt values when hovering over it with the cursor, or duplicate the downlink arrow, with e.g. one with N and one with A next to it, with a complete separation between the two.

Contributing

Code of Conduct

KrishnaIyer commented 4 months ago

and does not show anything related to the network frame counter. To find out the actual FCnt and keep track of network downlinks, one has to leave the console open to catch a network downlink, which shows the actual FCnt.

So the issue is that the network downlinks are only counted when the Console is open?

StevenCellist commented 4 months ago

No, sorry for not explaining clear enough. By that, I mean the following: image The frame counter at the top displays N/A (because I didn't send any downlink, i.e. AFcntDown = N/A), but the network has sent 143 downlinks, which I can only find by leaving the console open to catch these downlinks. Because in the JSON, it shows f_cnt = 142. There currently is no way to see this real number of downlinks except for leaving the console open (for possibly, hopefully a very long time!) to catch one of these downlinks.

And sadly, the information in the JSON doesn't even discern AFcntDown and NFcntDown; in the next screenshot there is a device where I have sent a downlink through the console, but a network downlink reports the same f_cnt value as the full_f_cnt value. image

I hope this explains what I would like to see improved!

Edit: note that these devices run an actual LoRaWAN v1.1 stack that really discerns these two counters!

KrishnaIyer commented 4 months ago

Ok noted. This looks like a bug.

@ryaplots: What field is used by the Console to display the downlink frame counter?

ryaplots commented 4 months ago

Ok noted. This looks like a bug.

@ryaplots: What field is used by the Console to display the downlink frame counter?

The downlink counter in the title section is last_a_f_cnt_down - https://github.com/TheThingsNetwork/lorawan-stack/blob/8449d7c93a111ee338a44db882d1da6f70f2457a/pkg/webui/console/store/reducers/devices.js#L103-L110

https://github.com/TheThingsNetwork/lorawan-stack/blob/8449d7c93a111ee338a44db882d1da6f70f2457a/pkg/webui/console/store/reducers/devices.js#L177-L188

KrishnaIyer commented 4 months ago

@StevenCellist: We looked into this and it's indeed true that we only display the application frame counter for LW1.1 devices. We should perhaps add two frame counters here if the device is LW 1.1. @kschiffer what's your suggestion?

StevenCellist commented 4 months ago

@KrishnaIyer that would be very much appreciated! My ideas would be a) two downlink counters side by side, or b) showing the separate counters upon mouse hover.

kschiffer commented 4 months ago

Yeah let's store and display both downlink counters:

image

@StevenCellist would this serve your needs sufficiently?

StevenCellist commented 4 months ago

@kschiffer yes perfect! The only thing I wonder, is if this is clear enough for new users, as to what they should look at, but I myself would be very happy with it.

kschiffer commented 4 months ago

Yeah, we'll add a detailed description to the tooltip (help icon) as well.

ryaplots commented 3 months ago

What should be the text of this detailed description? @KrishnaIyer @kschiffer

KrishnaIyer commented 3 months ago

I think this following makes sense:

Nwk: frame counter for network downlinks (FPort = 0) App: frame counter for application downlinks (FPort >=1)

StevenCellist commented 2 months ago

@kschiffer @ryaplots first and foremost thank you very much for implementing the separate counters: makes my life much easier and looks great! I'm sorry for bumping this; however, it seems the implementation is not yet perfect. I'd like to show two cases:

And in some case, which I don't know how to reproduce yet (screenshot from a couple days ago), the counters get the same value even though the App should still be at n/a: WhatsApp Image 2024-05-01 at 23 02 34_b2b25487 This is likely in the same ballpark as the previous point.

If I can help by sharing access to these LW v1.1 devices (or maybe you can already access them, dunno), let me know please! Would be happy to test :)