Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Network layer BatteryPercentage to ApplicationUplink #7449

Open
wants to merge 3 commits into
base: v3.33
Choose a base branch
from

Conversation

halimi
Copy link
Contributor

@halimi halimi commented Dec 18, 2024

Summary

References: #7427

The Network Server already receives the battery percentage via the DevStatus MAC command and stores it. We can forward this value to the Application Server in the ApplicationUplink message.

Changes

  • Extend the ApplicationUplink message with the LastBatteryPercentage message
  • Add the stored values during the uplink match

Testing

Steps

...

Results
Regressions

...

Notes for Reviewers

...

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • Testing: The steps/process to test this feature are clearly explained including testing for regressions.
  • Infrastructure: If infrastructural changes (e.g., new RPC, configuration) are needed, a separate issue is created in the infrastructural repositories.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@halimi halimi self-assigned this Dec 18, 2024
@halimi halimi added this to the v3.33.1 milestone Dec 18, 2024
@github-actions github-actions bot added the c/network server This is related to the Network Server label Dec 18, 2024
@halimi halimi force-pushed the feature/7427-battery-percentage branch from f035a81 to 3ddac1b Compare December 18, 2024 16:46
@halimi halimi marked this pull request as ready for review December 19, 2024 10:50
@halimi halimi requested a review from a team as a code owner December 19, 2024 10:50
@halimi halimi requested a review from johanstokking December 19, 2024 10:50
Comment on lines +192 to +197
// The battery percentage of the end device.
// The value is defined in the [0, 100] interval.
google.protobuf.FloatValue value = 2 [(validate.rules).float = {
gte: 0,
lte: 1
}];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't really match the validation rules. I think the comment needs to be changed to [0..1] interval. That would not be a percentage anymore, which is [0..100].

I hope it is [0, 100] like the comment says, otherwise turn it into a [0, 100] so that it matches the name (percentage), which is what API consumers would find most natural I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've copied this from the end_device.proto and calls it "percentage" but indeed then the validation should be [0, 100]
https://github.com/TheThingsNetwork/lorawan-stack/blob/v3.33/api/ttn/lorawan/v3/end_device.proto#L1142-L1148

  // Latest-known battery percentage of the device.
  // Received via the DevStatus MAC command at last_dev_status_received_at or earlier.
  // Stored in Network Server.
  google.protobuf.FloatValue battery_percentage = 35 [(validate.rules).float = {
    gte: 0,
    lte: 1
  }];

But I'll check it again and change it (or convert it) in my implementation to be a percentage value [0, 100].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/network server This is related to the Network Server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants