basnijholt / miflora

☘️🌑🌼πŸ₯€πŸ‘ Mi Flora Plant sensor Python package
MIT License
363 stars 98 forks source link

Deal with invalid measurements reported from the sensor #48

Closed ChristianKuehnel closed 6 years ago

ChristianKuehnel commented 6 years ago

Sometimes the reading of the measurements fails and then the sensor returns INVALID_DATA = b'\xaa\xbb\xcc\xdd\xee\xff\x99\x88wf\x00\x00\x00\x00\x00\x00'.

My guess is: this happens when this operation fails: connection.write_handle("0x33", "A01F"):

We need someone to investigate the issue further and implement a solution that solves this this issue. My idea would be to retry reading the data we get the INVALID_DATA.

See also the discussion in https://github.com/open-homeautomation/miflora/issues/40

ChristianKuehnel commented 6 years ago

I just looked at the code and added some unit tests. This should not be a problem any more. If this is still an issue, please create a new bug report