Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'DevInfoResponse' object has no attribute 'info' #42

Open
sclaes opened this issue Feb 16, 2022 · 1 comment
Open

AttributeError: 'DevInfoResponse' object has no attribute 'info' #42

sclaes opened this issue Feb 16, 2022 · 1 comment

Comments

@sclaes
Copy link

sclaes commented Feb 16, 2022

Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import elitech
device = elitech.Device("/dev/ttyUSB0")
device
<elitech.Device object at 0x7faea38b9a30>
devinfo = device.get_devinfo()
devinfo
<elitech.msg.DevInfoResponse object at 0x7faea378e400>
print(devinfo.info)
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'DevInfoResponse' object has no attribute 'info'
print(devinfo.model_no)
50
print(devinfo.station_no)
1
print(devinfo.rec_count)
0
print(devinfo.start_time)
None

device.debug=True
body=device.get_data()
body
[]
print(devinfo.info)
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'DevInfoResponse' object has no attribute 'info'
print(device.encode)
utf8
print(device.get_devinfo)
<bound method Device.get_devinfo of <elitech.Device object at 0x7fe1ed9aca30>>
device.get_devinfo()

ba length=5
CC 00 06 00 D2
<elitech.msg.DevInfoResponse object at 0x7fe1ed8a0ca0>

$ elitech-datareader --command simple-set --interval=10 /dev/ttyUSB0
$ elitech-datareader --command get /dev/ttyUSB0
$ elitech-datareader --command latest /dev/ttyUSB0
$ elitech-datareader --command devinfo --encode=utf8 /dev/ttyUSB0
alarm=AlarmSetting.NONE
current=2022-02-16 16:35:12
delay=0.0
dev_num=E187109805
humi_calibration=0.0
humi_lower_limit=0.0
humi_upper_limit=0.0
last_online=2022-02-16 16:33:34
lower_limit=-30.0
model_no=50
rec_count=0
rec_interval=00:00:10
start_time=None
station_no=1
stop_button=StopButton.DISABLE
temp_calibration=0.0
temp_unit=TemperatureUnit.C
tone_set=ToneSet.NONE
upper_limit=60.0
user_info=RC-5 Data Logger
work_sts=WorkStatus.NOT_START
$ elitech-datareader --command get --page_size=500 /dev/ttyUSB0
Traceback (most recent call last):
File "/home/sclaes/.local/bin/elitech-datareader", line 8, in
sys.exit(main())
File "/home/sclaes/.local/lib/python3.8/site-packages/scripts/elitech_device.py", line 23, in main
command_get(args)
File "/home/sclaes/.local/lib/python3.8/site-packages/scripts/elitech_device.py", line 66, in command_get
device.get_data(callback=output, page_size=args.page_size)
File "/home/sclaes/.local/lib/python3.8/site-packages/elitech/init.py", line 136, in get_data
page = int(math.ceil(header.rec_count * data_size / float(page_size)))
UnboundLocalError: local variable 'data_size' referenced before assignment

Why is the attribute devinfo.info not defined? BTW: is there a tutorial? I got all the above from the source code...
BTW: How do I start recording? I set devinfo.start_time to 'now' but that doesn't make a difference. Neither does pressing the start button on the device (devinfo.rec_count stays 0). The device displays (a.o.) the temperature, so I assume it is working.

@sclaes
Copy link
Author

sclaes commented Feb 16, 2022

I found out I had to press and hold to start logging. I should have read the fine manual... :-/

The other problems/error are still not resolved but at least I can now use the device to log the temperature. I thought it also could log the humidity but it can't. I need a different logger for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant