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

Python3 - code for recorded hangs #40

Open
OldShaterhan opened this issue Jan 26, 2020 · 11 comments
Open

Python3 - code for recorded hangs #40

OldShaterhan opened this issue Jan 26, 2020 · 11 comments

Comments

@OldShaterhan
Copy link
Contributor

Hey guys,
I'm running instance of this code, but unfortunately, for some reason when I run it in Python3 for old data (-r switch) it suddenly hangs on random date and time and doesn't finish it work. When I break it by Ctrl+C from traceback I see it hangs on band.waitForNotifications(0.1), what executes btle.py line 560, then 407 and 342.
Have anyone idea how to solve this issue?

@creotiv
Copy link
Owner

creotiv commented Jan 26, 2020

Did you try to change start date? https://github.com/creotiv/MiBand2/blob/master/example.py#L34

@OldShaterhan
Copy link
Contributor Author

Hmm... I'm quite new to Python, and my source bases on this solution (small changes), but - to be specific - I just reinitated the device, so it doesn't have new records (for instance - now i have records from Jan 26th, 19:50 local time, and it gained records up to 20:57 local time (now it's 21:18).

For Python2 it worked properly, but when I changed code (basing on changes here and some that I did earlier) to work with Python3, then it hangs on
fds = self._poller.poll(timeout*1000)

Anyway, I will change start date in few minutes, as I'm going to replace it with some more actual date.

@OldShaterhan
Copy link
Contributor Author

OldShaterhan commented Jan 26, 2020

I replaced it and now it hanged on 20:53 on first attempt, again 20:57 on second one.
Start date at this moment is 01.12.2019 01:01.

I see similar issue when I'm trying to use get_heart_rate_one_time - measurement is finished, but source again hangs on the lines (560->407->342) of bluepy/btle.py, but this error occurs also on Python2.7

@creotiv
Copy link
Owner

creotiv commented Jan 27, 2020

BluePy not the best Bluetooth lib, there are many problems with it, but also maybe something with packets. I will assign this to the guy who made this function(cause I lost my band a long time ago)

@creotiv
Copy link
Owner

creotiv commented Jan 27, 2020

@FHantke Can you help to solve this issue? Thanks

@OldShaterhan
Copy link
Contributor Author

OldShaterhan commented Jan 27, 2020

Coming back to HR - after few hours now in few iterations it was measured properly, but steps hanged e.g. on 2:21 AM, but this only applies to the Python3 version, with the older one everything was fine.

Thanks.

Edit: One more thing that can be a bit interesting - I'm running it on RPi Zero WH.

@OldShaterhan
Copy link
Contributor Author

Another update: I got opportunity to test original code on MB2 - issue still exists :/

@FHantke
Copy link
Contributor

FHantke commented Jan 28, 2020

hey, I'll check it out if I find the time. Haven't used MB in a while.
Keep me up to date, when you fix the issue :)

@OldShaterhan
Copy link
Contributor Author

@FHantke I'm not quite good in Python, but if I'll find something I'll let you know. However I need this ASAP, anyway thanks :D

@OldShaterhan
Copy link
Contributor Author

Another update: now HR obtaining works for only one device, on second not.

@OldShaterhan
Copy link
Contributor Author

Well, I'm testing it again and again and I found one thing that may interest you:

For device initialized by this date: ISODate("2020-01-26T21:31:00.000Z") (this is my local time, not UTC actual), with start date before that date then records are available till 22:55. When I'll try fetch data from exactly that date (i.e. 2020-01-26T22:55), only one record is obtained and code freezes. When I change it to next minute (i.e. 2020-01-26T22:56) - I'm getting records up to 2020-01-27T12:08 and library freezes again.

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

3 participants