-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan.py
32 lines (25 loc) · 1002 Bytes
/
scan.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from os import path
import functools
import gateway_addon
import signal
import sys
import time
sys.path.append(path.join(path.dirname(path.abspath(__file__)), 'lib'))
try:
from btlewrap import available_backends, BluepyBackend, GatttoolBackend, PygattBackend
from miflora.miflora_poller import MiFloraPoller, \
MI_CONDUCTIVITY, MI_MOISTURE, MI_LIGHT, MI_TEMPERATURE, MI_BATTERY
from miflora import miflora_scanner
#from miflora.miflora_poller import MiFloraPoller
#from miflora import miflora_scanner
#from btlewrap.bluepy import BluepyBackend
#from miflora import miflora_scanner, BluepyBackend
#from miflora.miflora_poller import MiFloraPoller
#from btlewrap.bluepy import BluepyBackend
except Exception as ex:
print("Error loading requirements: " + str(ex))
backend = BluepyBackend
devices = miflora_scanner.scan(backend, 10)
#print('Found {} devices:'.format(len(devices)))
for device in devices:
print('{}'.format(device))