-
Notifications
You must be signed in to change notification settings - Fork 15
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
battery level question #2
Comments
Hi @pauledd, The logic for converting the byte data is in ibbq.go. The first byte ( |
thanks! But strange, if I pair the thermometer to my android I read battery is at 59%. If I then connect [edit]: I just managed to build your go application and it shows 91% battery. Hm so something is wrong.. |
@pauledd I think you might be right. Looking into it a bit further, I think the issue is the data is in big endian order, not little endian. Little-endian version:
Big-endian version:
I'll push up a fix shortly. |
okay that's fixed. Now the bigger question I have in my mind is, are the temperature readings correct? or are they also big-endian instead of little-endian. I'll need to do some more testing. |
Well, my 1st. sensor shows at 22°C a value of "dc000000" and at 29°C "22010000" |
@pauledd how has this update been working for you? I just ran a cook on the new build and the battery levels were all over the place. First 90 then down to 67 then down to 3 then up somewhere above 100 a few minutes later. Whatever these readings are, they don't seem to be big-endian. |
@sworisbreathing @pauledd Have you had any luck with this battery translation issue? I'm having similar problem with some python code I've been working on. |
@jshridha no, I've been looking at it off and on for a while now, and I can't make any headway on it. Neither big-endian nor little-endian interpretation of the data seems to come up with battery levels that match what the android app outputs. |
@sworisbreathing @pauledd Did any you found a solution to this? I have exact the same issue with the battery level jumping up and down when using big-endian. |
I did some investigation by decompiling the Android app. The current and max voltage are actually little-endian. The current voltage jumps and bit up and down for me as well (first = current, second = max):
After digging a little deeper I found the place where the percentage is calculated. So this array it used to plot the current voltage against for the actual percentage. I'm writing a iBBQ library for NodeJS where I implemented this myself: https://github.com/Ruben-E/node-ibbq. This is the code used for it (location in the repo here):
I found two of these voltage arrays, not sure which one to use yet. |
@Ruben-E Thanks for sharing that fix! Can you let me know how you decompiled the APK? I'd like to reproduce for my project and for my education. Thanks! |
@Ruben-E I think the right correction array is dependent on the device you are using. I've decompiled an APP I'm using with the iBBQ-2x and in the source they are using the one which ends with 6344 for a device called bbqgo. |
One of the most easiest ways is using a website for that. Grab the .apk file from somewhere and decompile it. Be careful if you download the .apk file from a random place tho. Decompiling should be fine, but I would not run it on the phone. |
Looks like it indeed. Same for the app I decompiled (same package name I see, but different developer name). |
I think this is one and the same "example app" from the original hardware manufacturer and the resellers (like inkbird) just do slight adaptations. |
Hi
Sorry, a little bit offtopic.
I currently try to find out how to parse the battery level via gatttool.
If I understand correctly I need to send a write request to handle 0x0034 with
the value 082400000000.
char-write-req 0x0034 082400000000
I then get a notification handle with a value back:
Notification handle = 0x0025 value: 24 7e 17 96 19 00
I assume that the value is the battery level, right? How did you
convert this in percentage?
The text was updated successfully, but these errors were encountered: