forked from bigbug0/mypytmex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
27 lines (22 loc) · 825 Bytes
/
example.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
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Erik Svensson <[email protected]>
# Licensed under the MIT license.
import tmex
def main():
session = tmex.Session()
devices = session.enumrate()
for key, device in tmex.iteritems(devices):
print('%s: %s %s' % (key, device['name'], device['description']))
while True:
try:
for key, device in tmex.iteritems(devices):
readout = session.readDevice(key)
if len(readout) > 0:
messages = ['%s:' % (key)]
for key, value in tmex.iteritems(readout):
messages.append('%s: %.2f' % (key, value))
print(' '.join(messages))
except KeyboardInterrupt:
break
if __name__ == "__main__":
main();