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

[Update]: Thermopro TP357 #1422

Open
capo-at-the-5th-fret opened this issue Dec 26, 2024 · 1 comment
Open

[Update]: Thermopro TP357 #1422

capo-at-the-5th-fret opened this issue Dec 26, 2024 · 1 comment

Comments

@capo-at-the-5th-fret
Copy link

Reference: #961

"I'll run a scan again in a couple weeks to see if I can detect a battery level change."

Well, I forgot to send an update for battery level!

In the sample from the issue I posted:

043e 25 02010000 012a98487e48 19 0d 09 545033353720283241303129 02 0105 07 ffc2 1701 27 022c bc

27 = humidity
02 = battery level

So the byte after the humidity is the battery level, where 2 = 3 bars, 1 = 2 bars, 0 = 1 bar.

This is what 3 bars looks like in the UI:

tp357

I was using this code:

xvalue = data[3:7]
        (temp, humi, battery) = unpack("<hBB", xvalue)
        result = {
            "temperature": temp / 10,
            "humidity": humi,
            "battery": battery
        }

just so I could have a battery value, but it would be reported as 2%, 1% and 0%. Something like High, Medium and Low (or 3 bars, 2 bars, 1 bar) would be much better, but I don't know how to do that, or if it's even possible?

Here's the battery 'diary':

2022-12-23 - Generic Brand, came with something, possibly Google Chromecast
2023-04-13 - Battery level changed from 2 to 1 (1.15V using multimeter)
2023-05-07 - Battery level changed from 1 to 0 (0.91V using multimeter)
2023-06-02 - Battery dead (0.64V using multimeter)
2023-06-02 - Greencell Brand, came with something (1.27V using multimeter; reads full in app)
2023-06-07 - Battery level changed from 2 to 1 (1.18V using multimeter)
2023-06-13 - Battery dead (1.11V using multimeter)
2023-06-13 - Energizer Lithium (1.73V using multimeter)
2024-01-10 - Battery level changed from 2 to 1
2024-01-13 - Battery level changed from 1 to 0

It doesn't seem to last long on level 1.

@DigiH
Copy link

DigiH commented Dec 31, 2024

In Theengs Decoder we just use two states for the battery(_low) by looking at Bits 0 and 1 of the battery level byte you are referring to.

https://github.com/theengs/decoder/blob/development/src/devices/TPTH_json.h#L19-L25

Might be an idea to implement this similar in ble_monitor, as this nicely works with the HA binary sensor battery device class.

It doesn't seem to last long on level 1.

Thanks for this observation! We might also change the battery low to already register with 1, instead of only at level 0 then 😉

DigiH added a commit to DigiH/decoder that referenced this issue Dec 31, 2024
TP35X/393 batt_low adjustment to already register a low battery with value 1 of 2-1-0, as per user observation in

custom-components/ble_monitor#1422
DigiH added a commit to theengs/decoder that referenced this issue Dec 31, 2024
TP35X/393 batt_low adjustment to already register a low battery with value 1 of 2-1-0, as per user observation in

custom-components/ble_monitor#1422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants