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

Fix for Firmware 3.6.6 Mi Flora Max #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions miflora/miflora_poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def fill_cache(self):
datetime.now() - self._cache_timeout + timedelta(seconds=300)
)
return
time.sleep(1) # without this, the previous write_handle is done after we read the data
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a poor fix, I know that. But I don't really know much about Python or the Bluethooth libaray. It should be checked whether the handle has already been written.

self._cache = connection.read_handle(
_HANDLE_READ_SENSOR_DATA
) # pylint: disable=no-member
Expand Down Expand Up @@ -200,10 +201,13 @@ def _check_data(self):
if self._cache[7] > 100: # moisture over 100 procent
self.clear_cache()
return
if self._firmware_version >= "2.6.6":
if sum(self._cache[10:]) == 0:
self.clear_cache()
return
# I have no idea why this exists? ( Mi Flora Max Data: B6 00 63 00 00 00 00 38 8D 02 00 00 00 00 00 00 )
# With this cleaning, the cache is always empty.

#if self._firmware_version >= "2.6.6":
# if sum(self._cache[10:]) == 0:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are the bytes 11-16 important?

# self.clear_cache()
# return
if sum(self._cache) == 0:
self.clear_cache()
return
Expand Down