AirStatus
AirStatus copied to clipboard
Airpods Pro systemd service crashes
Maybe this could help:
● airstatus.service - AirPods Pro Battery Monitor
Loaded: loaded (/etc/systemd/system/airstatus.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2021-12-28 09:51:09 CET; 571ms ago
Process: 58060 ExecStart=/usr/bin/python3 /home/dodalovic/me/projects/opensource/AirStatus/main.py /tmp/airstatus.out (code=exited, status=1/FAILURE)
Main PID: 58060 (code=exited, status=1/FAILURE)
CPU: 52ms
When I execute the command /usr/bin/python3 /home/dodalovic/me/projects/opensource/AirStatus/main.py /tmp/airstatus.out
, it works just fine, stays running indefinitely
Pop!_OS 21.10
uname -a
Linux pop-os 5.15.8-76051508-generic #202112141040~1639505278~21.10~0ede46a SMP Tue Dec 14 22:38:29 U x86_64 x86_64 x86_64 GNU/Linux
Hello @dodalovic,
Does something show up with journalctl
?
My output keeps saying that no module named bleak found even though I installed the requirements.txt.
https://pastebin.com/aMx9d0WW
I figured it out. I was doing pip install instead of sudo pip install on requirements.txt. After doing that and systemctl enable airstatus and a reboot, my percentages look to be displaying properly.
Forgot to mention, you also have to have ControllerMode=dual in /etc/bluetooth/main.conf for the percentages to show up.
@delphiki I'm getting this via journalctl
:
Jan 26 15:35:56 pop-os systemd[1]: Started AirPods Battery Monitor.
Jan 26 15:35:56 pop-os python3[473254]: Traceback (most recent call last):
Jan 26 15:35:56 pop-os python3[473254]: File "/home/dodalovic/me/tools/AirStatus/main.py", line 1, in <module>
Jan 26 15:35:56 pop-os python3[473254]: from bleak import discover
Jan 26 15:35:56 pop-os python3[473254]: ModuleNotFoundError: No module named 'bleak'
@dodalovic You probably forgot to install the requirements:
pip install -r requirements.txt
@delphiki After doing that, and restarting service, i still have:
Jan 26 16:38:11 pop-os systemd[1]: airstatus.service: Scheduled restart job, restart counter is at 32.
Jan 26 16:38:11 pop-os systemd[1]: Stopped AirPods Battery Monitor.
Jan 26 16:38:11 pop-os systemd[1]: Started AirPods Battery Monitor.
Jan 26 16:38:11 pop-os python3[498384]: Traceback (most recent call last):
Jan 26 16:38:11 pop-os python3[498384]: File "/home/dodalovic/me/tools/AirStatus/main.py", line 1, in <module>
Jan 26 16:38:11 pop-os python3[498384]: from bleak import discover
Jan 26 16:38:11 pop-os python3[498384]: ModuleNotFoundError: No module named 'bleak'
Jan 26 16:38:11 pop-os systemd[1]: airstatus.service: Main process exited, code=exited, status=1/FAILURE
Jan 26 16:38:11 pop-os systemd[1]: airstatus.service: Failed with result 'exit-code'.
Jan 26 16:38:15 pop-os systemd[1]: airstatus.service: Scheduled restart job, restart counter is at 33.
Jan 26 16:38:15 pop-os systemd[1]: Stopped AirPods Battery Monitor.
Jan 26 16:38:15 pop-os systemd[1]: Started AirPods Battery Monitor.
Also, the numbers read are way different from the ones i see on my IPad. Not sure why though.
@dodalovic Dude, add SUDO in front of pip install! I literally told you how to get it working.
Thx @Movisivi, but it's not related to that. Also, I prefer not to use sudo
for installing dependencies. :)
I get the following error:
/usr/bin/python3: can't open file '/tmp/airstatus.out': [Errno 2] No such file or directory
What might cause the problem?