Temperature rising
Summer is upon us, temperature is rising, and I’m curious how my little server cabinet is faring.
A few years ago I bought an Elitech RC-4 Temperature Data logger for keeping an eye at the temperature at the office I used to work at.
It’s a pretty good device, you can leave it recording by itself, battery-backed, then read the data using the USB connector.
There’s even a Python elitech-datareader unofficial library, which did the job pretty nicely.
A few years have done past, I got the little device from a drawer and put it to use again.
First problem: the original author of elitech-datareader hasn’t updated
it past Python 3.9. It fails to install on Python 3.10 onwards because 2to3
no longer exists, as Python 2.7 is long past its end of life.
Fortunately, a
fork + PR
exists, which does little more than bump requirements.txt from pyserial==2.7 to pyserial>=2.7.
Thank you, random Internet person!
After installing it on the FreeBSD server I have, I had to figure out the permissions for my user to read from USB.
The device is recognised as such on lsusb:
Bus /dev/usb Device /dev/ugen0.4: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x10c4 Silicon Labs
idProduct 0xea60 CP210x UART Bridge
bcdDevice 1.00
iManufacturer 1 Silicon Labs
iProduct 2 CP2102 USB to UART Bridge Controller
iSerial 3 0001
bNumConfigurations 1
I started reading about permissions on the /dev/ugen0.4 and /dev/usb/0.4.0,
even reading more about devd(8) but later realised it was a red herring.
Thanks to
a forum entry about USB-to-serial adapter
I learnt about the ucom kernel module, it already being loaded, and the device being
at /dev/cuaU0.
Granted myself access to the dialer group and I was able to run this:
$ ~/.local/bin/elitech-datareader --command latest /dev/cuaU0
16000 2021-12-08 15:30:21 16.5 58.1
The date is very old and those numbers don’t represent the values I was looking for… But I can talk to the device, and that’s all I needed.
To set the basics, elitetech-datareader has a simple-set command.
$ ~/.local/bin/elitech-datareader --command simple-set --interval=300 /dev/cuaU0
$ ~/.local/bin/elitech-datareader -c devinfo /dev/cuaU0
alarm=AlarmSetting.NONE
current=2024-07-21 23:29:55
delay=0.0
dev_num=7185D00277
humi_calibration=0.0
humi_lower_limit=20.0
humi_upper_limit=90.0
last_online=2024-07-21 23:29:43
lower_limit=-30.0
model_no=42
rec_count=0
rec_interval=00:05:00
start_time=2024-07-21 23:28:36
station_no=1
stop_button=StopButton.ENABLE
temp_calibration=0.0
temp_unit=TemperatureUnit.C
tone_set=ToneSet.NONE
upper_limit=60.0
user_info=RC-4HC Data Logger
work_sts=WorkStatus.NOT_START
Took me a while to remember that I have to hold the button on the device for about 5 seconds until a little “play” icon appears on the display.
The device will not record any data, and you won’t
get any output from -c get until after that “play” icon appears.
This also applies if you do another -c init or -c simple-set,
as the devices reconfigures itself.
$ ~/.local/bin/elitech-datareader -c get /dev/cuaU0
1 2024-07-21 23:32:38 21.6 51.1
I’ve configured my for collecting every 300 seconds. I don’t need
data more often than that, and the device stops logging
when its buffer is full. At 16000 positions, I should have about
55 days before having to run a simple-set and press the
button again.
Next steps in this journey is to set up some monitoring and dashboards to see temperature over time.