directly read single Sensors without the need to setup a .digitemprc file

141 views
Skip to first unread message

Platsch-O-MAT

unread,
Feb 6, 2012, 6:03:05 PM2/6/12
to DigiTemp
Is it possible to read ONE (of many connected) Sensor without the need
to create a .digitemprc file?



Background:

I have a 1-wire network with an ever changing number of sensors.

That would not be a problem if I could create a .digitemprc file with
ALL sensors and then read only the sensor #x

The problem is, that after a time I would add a new sensor and would
then have to create the .digitemprc file anew. Then the new sensor
would not be at the end of the list of sensors but somewhere in the
middle and would change the sensor numbers (relevant for the "-t x"
option)

Surely, I could search the newly created .digitemprc file for the new
sensor and pull it to the end of the list to avoid this. (annoying!)

Presently my only viable way is to create a particular .digitemprc
file for each sensor (each file with only 1 sensor):

/usr/bin/digitemp_DS9097U -c /usr/bin/TEMP_1W_Aussen -a -q -o %.3C
/usr/bin/digitemp_DS9097U -c /usr/bin/TEMP_1W_Wohnzimmer -a -q -o %.3


But it would be a lot easier, when I could read the sensors
independently with one command line including their serial number
analog to this example:

digitemp -s /dev/ttyUSB0 -S 28907AAA03000029

with such an option it would be really easy to use the serial number
in a variable etc.


I hope you understand, what I need (with my poor english) (-:


Simon Morgan

unread,
Feb 7, 2012, 4:50:24 AM2/7/12
to digi...@googlegroups.com
Sorry but I can't help you but your English is first class :).

Simon

Tom

unread,
Feb 8, 2012, 2:33:11 PM2/8/12
to DigiTemp
Platch,

Copy the following bash script into a file and call it whatever you
want. eg: dt.sh
You should really use an existing .digitemprc file as a reference.

#!/bin/bash

A=0x${1:0:2}
B=0x${1:2:2}
C=0x${1:4:2}
D=0x${1:6:2}
E=0x${1:8:2}
F=0x${1:10:2}
G=0x${1:12:2}
H=0x${1:14:2}

echo "TTY /dev/ttyUSB0
READ_TIME 1000
LOG_TYPE 1
LOG_FORMAT \"%b %d %H:%M:%S Sensor %s C: %.3C F: %.2F\"
CNT_FORMAT \"%b %d %H:%M:%S Sensor %s #%n %C\"
HUM_FORMAT \"%b %d %H:%M:%S Sensor %s C: %.3C F: %.2F H: %h%%\"
SENSORS 1
ROM 0 $A $B $C $D $E $F $G $H
" > /usr/bin/.dtUSB0

/usr/bin/digitemp_DS9097U -c /usr/bin/.dtUSB0 -t 0

-------- CUT HERE -------
Modify the formats and and anything else you need changed.
Make the file executable.

Then just run dt.sh 28907AAA03000029

I hope this helps you and anyone else that may have the same
requirements.
Reply all
Reply to author
Forward
0 new messages