1-Wire temperature alarm status notification

jurdim

New Member
Hy
I am completely new to this and with this i mean electronics (1-Wire) software and linux everthing so i absolutely dont know what i am talking about.
After a post about 1 wire temperature measuring on a dutch Koi forum i got interested in 1-wire and ordered 1 linksys NSLU at a local computer store, followed by 1 DS9490R USB connecter and some DS18S20-Par sensors

The guys at the Koi forum wrote a very good manual (in Dutch) on how to setup the NSLU and install the software needed Owfs, openssh, rrdtool and winscp with PuTTy.
Just by simply following there manual i got it all working and at this moment i am testing with 2 sensors measuring temperature in my livingroom.

Next step i wanted was a network using hubs to simply connect the sensors to kind of klik and go so after searching i found a German company that sells temperature sensors bases on the DS1820 sensor and they also have hubs to go with their system that is a litle diferent than 1-wire.
Again with the help of the Koi forum Guys i made an adaptor cable and connected the first hub and sensor to my ds9490r and it works fine so i added 2 more hubs and some more sensors and it still works fine.

next week i am going to finally instal the hubs and sensors in and around my Koi pond to measure outside, water in the pond and water in the filter temperature followed by sensors mounted on my pumps to keep track of their temperature.
the complete setup wil look like this
netwerk.gif

to connect the hubs i will use Cat6 utp cable over a maximum distance of 25 meters.

Now my big question; the ds18s20 sensors can be set with a temperature high and low limit and go in to alarm state when either one of these limits is passed.
Just by looking in to winscp i noticed that every time this hapens a new folder is created in the alarm folder named after the sensor that has gone in to alarm status.

Now i would like to now if it is possible to send an alert by email or give a notice on my windows xp computer everytime such a folder is created based on software only ?
And if it is not possible just by software what would be needed to make this happen ?

Hoping jou can help me

Gr jurgen
 
Hi Jurgen, welcome to CT!

Do you happen to have a link to that manual? Sounds pretty interesting. Thanks!
 
Now my big question; the ds18s20 sensors can be set with a temperature high and low limit and go in to alarm state when either one of these limits is passed.
Just by looking in to winscp i noticed that every time this hapens a new folder is created in the alarm folder named after the sensor that has gone in to alarm status.

Now i would like to now if it is possible to send an alert by email or give a notice on my windows xp computer everytime such a folder is created based on software only ?
And if it is not possible just by software what would be needed to make this happen ?

Hoping jou can help me

Gr jurgen

No Ideas anybody ?
 
Given that you have an NSLU running owfs and rrdtool, it must be equipped with Perl. You can write a Perl script to periodically monitor a folder for the presence of new sub-folders.

I'd check the owfs forums. You've described a situation that other owfs users must have encountered.
 
Heck, you could even do this with a simple shell script (either use a loop, or cron to check every 60 seconds). If you paste the directory/file structure, I'm sure we can come up with something.
 
Heck, you could even do this with a simple shell script (either use a loop, or cron to check every 60 seconds). If you paste the directory/file structure, I'm sure we can come up with something.

Do you mean like this ? remember i have no idea what i am talking about the only thing i did sofar with my computer except surfing the internet is keep my video surveillance up and running
This is the directory structure of the NSLU the alarm folder is normally empty whenever a sensor goes in to alarm status a folder is created named after the sensor involved. The 3 folders above the alarm folder the ones with the numbers are named after the sensors
Directory_nslu.JPG

Gr Jurgen
 
Here is a quick script I put together. I only tested this on a CentOS server, but tried to stick with very basic commands, hoping it will work with the unslung distro. Make sure you have a mail command, or you won't get notified, the other commands should exist. This is a very basic script, I am not doing any error checking, and it probably could be optimized, but it's something. Let me know if it works.

Code:
#!/bin/sh

# where to store snapshot data
snapshotOld="/tmp/snapshot.old"
snapshotTmp="/tmp/snapshot.tmp"

# create snapshot if it doesn't exist
/bin/touch $snapshotOld

# directory to monitor
monitorDir=/tmp/test

# list new files and directories, save to file
/bin/ls -1 $monitorDir > $snapshotTmp

result=`/bin/grep -vf $snapshotOld $snapshotTmp`


if [ "$result" != "" ]; then
  echo $result | mail -s "New files" [email protected]
  /bin/mv -f $snapshotTmp $snapshotOld
else
  echo "no new files"
fi
 
Here is a quick script I put together. I only tested this on a CentOS server, but tried to stick with very basic commands, hoping it will work with the unslung distro. Make sure you have a mail command, or you won't get notified, the other commands should exist. This is a very basic script, I am not doing any error checking, and it probably could be optimized, but it's something. Let me know if it works.

Code:
#!/bin/sh

# where to store snapshot data
snapshotOld="/tmp/snapshot.old"
snapshotTmp="/tmp/snapshot.tmp"

# create snapshot if it doesn't exist
/bin/touch $snapshotOld

# directory to monitor
monitorDir=/tmp/test

# list new files and directories, save to file
/bin/ls -1 $monitorDir > $snapshotTmp

result=`/bin/grep -vf $snapshotOld $snapshotTmp`


if [ "$result" != "" ]; then
  echo $result | mail -s "New files" [email protected]
  /bin/mv -f $snapshotTmp $snapshotOld
else
  echo "no new files"
fi

Thanks Dan
Where should i put this code ? I send it to one of the dutch manual writers bud he is very busy at this moment

Gr Jurgen
 
Here is a quick script I put together. I only tested this on a CentOS server, but tried to stick with very basic commands, hoping it will work with the unslung distro. Make sure you have a mail command, or you won't get notified, the other commands should exist. This is a very basic script, I am not doing any error checking, and it probably could be optimized, but it's something. Let me know if it works.

[codebox]#!/bin/sh

# where to store snapshot data
snapshotTmp="/tmp/snapshot.tmp"

# directory to monitor
monitorDir=/tmp/1wire/bus.0/alarm

# list new files and directories, save to file
ls -1 $monitorDir > $snapshotTmp

result=`fgrep 10.DBA986010800 $snapshotTmp`

if [ "$result" != "" ]; then
cat /tmp/1wire/10.DBA986010800/temperature | nail -s "Temperatuur Alarm Woonkamer!!! " [email protected] [email protected]
else
echo "no alarm"
fi
touch /public/test[/codebox]

This works nice it even sends the temperature of that moment in the message
but you have to make 1 script for every sensor you use.
the mail is send atomatic thrue a crontab command.

As a mailing program we used Nail and after installing that you also have to place some account information in the nail.rc file in order for the script to be send.

It works great now


Thanks: Jurgen
 
Back
Top