-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathexample.py
More file actions
32 lines (25 loc) · 720 Bytes
/
example.py
File metadata and controls
32 lines (25 loc) · 720 Bytes
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
import elitech
import datetime
import sys
port = sys.argv[1]
print("PORT: {}".format(port))
device = elitech.Device(port)
device.debug = True
device.init()
# get devinfo
devinfo = device.get_devinfo()
for k,v in vars(devinfo).items():
print("{}={}".format(k, v))
device.set_clock(devinfo.station_no, datetime.datetime.now())
# get data
body = device.get_data()
for elm in body:
print("{0}\t{1:%Y-%m-%d %H:%M:%S}\t{2:.1f}".format(*elm))
# update param
#param_put = devinfo.to_param_put()
#param_put.rec_interval = datetime.time(0, 0, 10)
#param_put.stop_button = elitech.StopButton.ENABLE
#param_put_res = device.update(param_put)
#print(param_put_res.msg)
# get devinfo
#print(vars(device.get_devinfo()))