diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2017-01-15 14:22:09 +0100 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2017-01-15 14:22:09 +0100 |
commit | ad7538a019718d89691935028379e2aba94cdfa6 (patch) | |
tree | c3394fb23bc74f7fffedf272885e87c43f125f92 | |
parent | Wrap the meter information to a namedtuple, instead of a string. (diff) | |
download | glucometerutils-ad7538a019718d89691935028379e2aba94cdfa6.tar glucometerutils-ad7538a019718d89691935028379e2aba94cdfa6.tar.gz glucometerutils-ad7538a019718d89691935028379e2aba94cdfa6.tar.bz2 glucometerutils-ad7538a019718d89691935028379e2aba94cdfa6.tar.lz glucometerutils-ad7538a019718d89691935028379e2aba94cdfa6.tar.xz glucometerutils-ad7538a019718d89691935028379e2aba94cdfa6.tar.zst glucometerutils-ad7538a019718d89691935028379e2aba94cdfa6.zip |
-rwxr-xr-x | glucometer.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/glucometer.py b/glucometer.py index 1cb263d..8e19237 100755 --- a/glucometer.py +++ b/glucometer.py @@ -54,18 +54,20 @@ def main(): device = driver.Device(args.device) device.connect() + device_info = device.get_meter_info() try: if args.action == 'info': - print(str(device.get_meter_info()).strip()) try: - print('Time: %s' % device.get_datetime()) + time_str = device.get_datetime() except NotImplementedError: - print('Time: N/A') + time_str = 'N/A' + print("{device_info}Time: {time}".format( + device_info=str(device_info), time=time_str)) elif args.action == 'dump': unit = args.unit if unit is None: - unit = device.get_glucose_unit() + unit = device_info.native_unit readings = device.get_readings() |