Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Commit

Permalink
dded "-v" flag to demo.py to print debug output to console.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKuehnel committed Oct 21, 2017
1 parent 7aad55a commit bba1378
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import argparse
import re
import logging

from miflora.miflora_poller import MiFloraPoller, \
MI_CONDUCTIVITY, MI_MOISTURE, MI_LIGHT, MI_TEMPERATURE, MI_BATTERY
Expand All @@ -18,6 +19,7 @@ def valid_miflora_mac(mac, pat=re.compile(r"C4:7C:8D:[0-9A-F]{2}:[0-9A-F]{2}:[0-
parser = argparse.ArgumentParser()
parser.add_argument('mac', type=valid_miflora_mac)
parser.add_argument('--backend', choices=['gatttool', 'bluepy'], default='gatttool')
parser.add_argument('-v', '--verbose', action='store_const', const=True)
args = parser.parse_args()

backend = None
Expand All @@ -28,6 +30,9 @@ def valid_miflora_mac(mac, pat=re.compile(r"C4:7C:8D:[0-9A-F]{2}:[0-9A-F]{2}:[0-
else:
raise Exception('unknown backend: {}'.format(args.backend))

if args.verbose:
logging.basicConfig(level=logging.DEBUG)

poller = MiFloraPoller(args.mac, backend)

print("Getting data from Mi Flora")
Expand Down

0 comments on commit bba1378

Please sign in to comment.