basnijholt / miflora

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

No Data with any Bluetooth Backend #141

Closed AlexHowser closed 4 years ago

AlexHowser commented 4 years ago

Hi! I try to retrieve Data from my Roya Gardeneer Dongles (Firmware 3.2.1) using my raspberry pi4 for a while now. I allways end Up with errors. (Error and Source attached beneath)

Anyone else having this issues? Thanks in advance! Alex

Erros:


Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/btlewrap/bluepy.py", line 27, in _func_wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/btlewrap/bluepy.py", line 75, in read_handle return self._peripheral.readCharacteristic(handle) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 529, in readCharacteristic self._writeCmd("rd %X\n" % handle) File "/usr/local/lib/python3.7/dist-packages/bluepy/btle.py", line 302, in _writeCmd raise BTLEInternalError("Helper not started (did you call connect()?)") bluepy.btle.BTLEInternalError: Helper not started (did you call connect()?)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "miflora2.py", line 27, in readValues(plants[i],str(plants[secondstep])); File "miflora2.py", line 10, in readValues print (poller.parameter_value('temperature')); File "/usr/local/lib/python3.7/dist-packages/miflora/miflora_poller.py", line 156, in parameter_value self.fill_cache() File "/usr/local/lib/python3.7/dist-packages/miflora/miflora_poller.py", line 85, in fill_cache firmware_version = self.firmware_version() File "/usr/local/lib/python3.7/dist-packages/miflora/miflora_poller.py", line 128, in firmware_version res = connection.read_handle(_HANDLE_READ_VERSION_BATTERY) # pylint: disable=no-member File "/usr/local/lib/python3.7/dist-packages/btlewrap/bluepy.py", line 33, in _func_wrapper raise BluetoothBackendException() from lasterror btlewrap.base.BluetoothBackendException ____-

I use folliwing Code:


from miflora.miflora_poller import MiFloraPoller,MI_CONDUCTIVITY, MI_MOISTURE, MI_LIGHT, MI_TEMPERATURE, MI_BATTERY

from btlewrap.gatttool import GatttoolBackend

from btlewrap.bluepy import BluepyBackend from btlewrap.pygatt import PygattBackend

poller = ""; def readValues(name,mac): print(mac); poller = MiFloraPoller(mac, BluepyBackend); print (poller.parameter_value('temperature')); temp = poller.parameter_value('temperature'); moisture=(poller.parameter_value("moisture")) light=(poller.parameter_value("light")) conductivity=(poller.parameter_value("conductivity")) battery=(poller.parameter_value("battery")) print(f'Pflanze: {name} Temperatur:{temp} Feuchtigkeit: {moisture} Licht: {light} Düngung: {conductivity} Batterie: {battery}');

plants=["Quentin Tarrantreeno","86:A9:3E:BD:2F:05","Lilie","C4:7C:8D:66:A7:C1"];

lenplants = len(plants); print(lenplants); i = 0 while i < lenplants: secondstep = i + 1; print(f'name: {plants[i]} adresse: {plants[secondstep]}'); readValues(plants[i],str(plants[secondstep])); poller = ""; i=i+2;


AlexHowser commented 4 years ago

can be closed, was caused by wrong mac address