basnijholt / miflora

☘️🌡🌼🥀🏡 Mi Flora Plant sensor Python package
MIT License
362 stars 99 forks source link

Exception "Could not read data from Mi Flora sensor" (FW: 2.6.5) #126

Closed CodeFinder2 closed 5 years ago

CodeFinder2 commented 5 years ago

Hi,

first of all: great library! Thanks! Unfortunately, I am getting the error

$ python3 demo.py --backend bluepy poll "XX:XX:XX:XX:XX:XX"
Getting data from Mi Flora
FW: 2.6.5
Name: Flower care
Traceback (most recent call last):
  File "demo.py", line 99, in <module>
    main()
  File "demo.py", line 95, in main
    args.func(args)
  File "demo.py", line 30, in poll
    print("Temperature: {}".format(poller.parameter_value(MI_TEMPERATURE)))
  File "/home/abo/.local/lib/python3.5/site-packages/miflora/miflora_poller.py", line 141, in parameter_value
    raise BluetoothBackendException("Could not read data from Mi Flora sensor %s" % self._mac)
btlewrap.base.BluetoothBackendException: Could not read data from Mi Flora sensor XX:XX:XX:XX:XX:XX

Versions: Python v3.5.2 miflora v0.5 btlewrap v0.0.4 bluepy v1.3.0 Xubuntu v16.04.6 LTS

Searching for devices gave me 4 which is correct:

sudo python3 demo.py --backend bluepy scan
Scanning for 10 seconds...
Found 4 devices: [...]

3 (white, international version) of those 4 are working fine, having FW v2.7.0. The fourth device seems to be the chinese version (not white) running FW v2.6.5.

Do you have any idea why this doesn't work? (Even) the Mi Home android app is able to retrieve the data so the device seems functional ...

If you need more information, please let me know! Thanks in advance!

CodeFinder2 commented 5 years ago

Okay, solved! I've upgraded to firmware v3.1.9 (using the Flower Care android app) and voila:

Getting data from Mi Flora
FW: 3.1.9
Name: Flower care
Temperature: 16.2
Moisture: 17
Light: 336
Conductivity: 93
Battery: 99

:-)

Sorry for the noise!