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

bluetooth_battery: init at 1.2.0 #103023

Merged
merged 2 commits into from
Jan 19, 2021
Merged

Conversation

cheriimoya
Copy link
Contributor

Motivation for this change

I have a bluetooth headset that's capable of reporting the battery state. This tool allows for reading the battery percentage from my bluetooth headphones. I'd like to have this upstream, because i use it in my statusbar and it may be useful to many people.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@cheriimoya
Copy link
Contributor Author

cc @ajs124

@@ -0,0 +1,30 @@
{ lib, fetchFromGitHub, buildPythonPackage, pybluez }:

buildPythonPackage rec {
Copy link
Member

Choose a reason for hiding this comment

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

This does not look like a library to me, but rather a case for buildPythonApplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, must have missed that when copying the expression from another package

@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 103023 run on x86_64-darwin 1

1 package marked as broken and skipped:
  • bluetooth_battery

Copy link
Member

@mweinelt mweinelt left a comment

Choose a reason for hiding this comment

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

The software seems a bit rough around the edges, but generally seems to work.

$ ./results/bluetooth_battery/bin/bluetooth_battery 
Usage: bl_battery.py <BT_MAC_ADDRESS_1>[.PORT] ...
         Port number is optional

Easy enough. But what do they mean by a port? And where to I find the MAC of my bluetooth devices?

$ ./results/bluetooth_battery/bin/bluetooth_battery  --help
<blocks>

Fine, bluetoothctl has those. My headphones are connected and I'm listening to music. Let's see how this goes:

$ ./results/bluetooth_battery/bin/bluetooth_battery CC:98:8B:XX:XX:XX
CC:98:8B:XX:XX:XX is offline (111, 'Connection refused')
$ ./results/bluetooth_battery/bin/bluetooth_battery CC:98:8B:XX:XX:XX
Battery level for CC:98:8B:XX:XX:XX is 50%

So yeah, seems to work generally. I'd love me some upower integration here. Until then, let's use this. Thanks for packaging it up, @cheriimoya.

@mweinelt mweinelt merged commit 0edf361 into NixOS:master Jan 19, 2021
@cheriimoya cheriimoya deleted the bluetooth_battery branch January 19, 2021 11:21
@cheriimoya
Copy link
Contributor Author

cheriimoya commented Jan 19, 2021

mmh yea, so the maintainer of the original code responded to a recent issue of mine, i think you have the same issue right there...

this fork has a nice readme update on how to find the bluetooth MACs

i didn't quite get the "port" part of the project either, i think it's more like a bluetooth channel (i guess?)

and for the upower part there is also an issue

@mweinelt

@mweinelt
Copy link
Member

mmh yea, so the maintainer of the original code responded to a recent issue of mine, i think you have the same issue right there...

also the same headphones 😄

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants