January 6, 2026

Bluetooth, Linux, and my TP351

I am running Fedora 42. I have my TP-link UB500 dongle plugged in, and am going to attempt to follow the steps described in this web page: First packages. He lists a bunch of debian packages, so I will try installing Fedora equivalents:
dnf install bluetooth -- 9 packages including tlp and kernel-tools
dnf install bluez -- already installed
dnf install bluez-tools -- 1 package
python3 -- already installed
dnf install python3-pydbus -- 1 package
dnf install python3-gi -- no such thing
dnf install python3-gobject -- already installed (the equivalent to python3-gi)
The page next tells me to run "hcitool lescan" to get the mac address of my device. This does not exist on Fedora, and I read that it is deprecated with equivalent functionality being available via bluetoothctl. It turns out that bluetoothctl is interactive and gives you a prompt, so I do this:
su
bluetoothctl
scan on
[CHG] Controller 78:20:51:F6:07:84 Discovering: yes
[NEW] Device 44:B7:D0:79:14:C5 DR D07914C5
[NEW] Device F5:61:EB:B4:71:04 TP351S (7104)
exit
Now I try to get the software he suggests:
cd /Projects
mkdir Blue
cd Blue
wget https://raw.githubusercontent.com/pasky/tp357/refs/heads/main/tp357tool.py
chmod a+x tp357tool.py
./tp357tool.py F5:61:EB:B4:71:04 now
Don't forget the "now" in the above. This gives:
temp,humid
27.4,36
Next I copy and paste his script, make the changes to add the MAC address, as well as putting a shebang line up top. Then:
chmod a+x tp351.py
./tp351.py
After a wait, it exits and I do see a file "tp350.log" as follows:
2026-01-06,19:01:30 27.4 36
The rest of his page discusses adding this to a crontab, but we won't do that. What is interesting is that we now have the ability to pull a single reading from my TP351. No evidence of battery status, which we saw on the Android app.

Analysis

The file tp357tool.py has 152 lines of python code, which should be worth studying. He mentions that the TP357 (which I also have) claims to store up to a year of history, and his python code can fetch it.

Note: After obtaining data via linux, my android phone was unable to talk to the TP351 until I pulled the USB to bluetooth dongle out and replugged it. There may be ways to release bluetooth so that the phone has a chance at it also.

After looking into this, I believe the trick may be needing to make this call when done:

device.Disconnect()

Repeat this with my TP357

It is as easy as getting the MAC address using bluetoothctl, editing that into the script, and running it.


Have any comments? Questions? Drop me a line!

Tom's Software pages / tom@mmto.org