Skip to content

Commit

Permalink
Implement suggested fix for issue ThomDietrich#39
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsAC committed May 28, 2018
1 parent 590cc5e commit fee0dcd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions miflora-mqtt-daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from configparser import ConfigParser
from unidecode import unidecode
from miflora.miflora_poller import MiFloraPoller, MI_BATTERY, MI_CONDUCTIVITY, MI_LIGHT, MI_MOISTURE, MI_TEMPERATURE
from btlewrap import available_backends, BluepyBackend, GatttoolBackend, PygattBackend
from btlewrap import available_backends, BluepyBackend, GatttoolBackend, PygattBackend, BluetoothBackendException
import paho.mqtt.client as mqtt
import sdnotify

Expand Down Expand Up @@ -221,7 +221,7 @@ def flores_to_openhab_items(flores, reporting_mode):
flora_poller.fill_cache()
flora_poller.parameter_value(MI_LIGHT)
flora['firmware'] = flora_poller.firmware_version()
except IOError:
except (IOError, BluetoothBackendException):
print_line('Initial connection to Mi Flora sensor "{}" ({}) failed.'.format(name_pretty, mac), error=True, sd_notify=True)
else:
print('Internal name: "{}"'.format(name_clean))
Expand Down Expand Up @@ -316,7 +316,7 @@ def flores_to_openhab_items(flores, reporting_mode):
try:
flora['poller'].fill_cache()
flora['poller'].parameter_value(MI_LIGHT)
except IOError:
except (IOError, BluetoothBackendException):
attempts = attempts - 1
if attempts > 0:
print_line('Retrying ...', warning = True)
Expand Down

0 comments on commit fee0dcd

Please sign in to comment.