Xytronix Temperature Module AppleScript
- Chris Galfo
- Posts: 16
- Joined: Sun Aug 19, 2007 10:15 am
- Location: Auberry, CA
Xytronix Temperature Module AppleScript
I've found a nice little temperature reading module that can be used to get up to 4 accurate temperature readings into AppleScript where you can pass them along to Indigo. It's called a "daq Temperature Module" manufactured by Xytronix Research, Inc. and it connects to your Local Area Network (or via the internet with proper routing). I have uploaded an AppleScript for Indigo that I've been running on both a wired and wireless LAN for the past few months. The company also makes a general-purpose Analog Interface (which is somewhat more expensive) that I plan to get in the next few months, so look for a similar script for it too. Some really nice other features of the Temperature Module are that it has a built-in web server, it can send you e-mail when temperatures get above or below user defined limits, and it has two relays that it (or you) can use to turn on or off external devices (heating, cooling, or alarms). Best of all, you can modify this AppleScript to do complicated temperature control tasks based on temperature differences, trends, etc. (stuff that is too complicated for either Indigo or the Module itself to handle). The hardware/firmware is described at:
http://www.ControlByWeb.com/temperature/index.html
Enjoy,
Chris Galfo
http://www.ControlByWeb.com/temperature/index.html
Enjoy,
Chris Galfo
- jay (support)
- Site Admin
- Posts: 18316
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
- Chris Galfo
- Posts: 16
- Joined: Sun Aug 19, 2007 10:15 am
- Location: Auberry, CA
Finder Delete via Applescript
Hi Jay,
Yes, the Finder does have a "delete" file but it simply moves the file to the trash and doesn't actually remove it from disk. Since this would happen once a minute, the trash would soon fill up with lots of little files. If there's something I'm missing, please enlighten me.
It's not actually too important to have this script delete the temporary file, since it's very small (about 1 KB) and gets overwritten if it isn't deleted, it's just a nice thing to do so that the user doesn't wonder "where the heck did that file come from" when looking through the default directory. I was fairly surprised that AppleScript doesn't natively support deleting a file; it's a fairly serious omission IMO.
I'm hoping that I can get some Indigo user's hooked up with the Xytronix boxes since they're a very slick solution. I'm for anything that doesn't use a USB, can run stand-alone at a good distance from the computer and use under a watt of power.
-- Chris Galfo
Yes, the Finder does have a "delete" file but it simply moves the file to the trash and doesn't actually remove it from disk. Since this would happen once a minute, the trash would soon fill up with lots of little files. If there's something I'm missing, please enlighten me.
It's not actually too important to have this script delete the temporary file, since it's very small (about 1 KB) and gets overwritten if it isn't deleted, it's just a nice thing to do so that the user doesn't wonder "where the heck did that file come from" when looking through the default directory. I was fairly surprised that AppleScript doesn't natively support deleting a file; it's a fairly serious omission IMO.
I'm hoping that I can get some Indigo user's hooked up with the Xytronix boxes since they're a very slick solution. I'm for anything that doesn't use a USB, can run stand-alone at a good distance from the computer and use under a watt of power.
-- Chris Galfo
- matt (support)
- Site Admin
- Posts: 21437
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Re: Finder Delete via Applescript
Hi Chris,
Thanks for the sharing the script and info on the hardware. Definitely looks interesting. Now I just need a CAT5 drop down to where my turtle reptarium is...
Regards,
Matt
Thanks for the sharing the script and info on the hardware. Definitely looks interesting. Now I just need a CAT5 drop down to where my turtle reptarium is...
Regards,
Matt
- Chris Galfo
- Posts: 16
- Joined: Sun Aug 19, 2007 10:15 am
- Location: Auberry, CA
No, the script does not use ModBUS but reads data from the web-page that the Xytronix Temperature Module generates. If you have (or know of) an AppleScript driver for ModBUS, please pass that information along, since it could (in principle) also be used to interface the Temperature Module.
-- Chris Galfo
-- Chris Galfo
Hello all,
I am pulling my hair out having been unable to get the script to work.
The error message I get in indigo is:
Module 192.168.73.210:8081 is NOT responding...
The script never downloads the file from the module, but if you direct a browser at that address it comes up just fine.
I am not very good at scripting and have compared it to the original NOAA script but they are not the same. The NOAA script runs fine.
I am running the newest version of Mac OS (10.5.6) and the newest version of indigo.
Does anybody have any thoughts.
Bob
I am pulling my hair out having been unable to get the script to work.
The error message I get in indigo is:
Module 192.168.73.210:8081 is NOT responding...
The script never downloads the file from the module, but if you direct a browser at that address it comes up just fine.
I am not very good at scripting and have compared it to the original NOAA script but they are not the same. The NOAA script runs fine.
I am running the newest version of Mac OS (10.5.6) and the newest version of indigo.
Does anybody have any thoughts.
Bob
- Chris Galfo
- Posts: 16
- Joined: Sun Aug 19, 2007 10:15 am
- Location: Auberry, CA
Bob,
Sorry for the delay in getting back to you.. It sounds like the download is failing. Try the following:
Open the application "Script Editor" to a blank page and type in the following:
tell application "URL Access Scripting"
set temp_file to download "http://192.168.73.210:8081/index.html" to file "temp.txt"
end tell
then hit "Run"
A file called "temp.txt" should appear in your default directory and if you open the file you'll see that it contains a web page (html text) of your current temperature data. Let me know if this actually works, and we'll go from there.
I'm assuming that you have the Xytronix Temperature Module at a fixed IP address of 192.168.73.210 and its web server set to use port 8081 instead of the default port of 80.
-- Chris Galfo
Sorry for the delay in getting back to you.. It sounds like the download is failing. Try the following:
Open the application "Script Editor" to a blank page and type in the following:
tell application "URL Access Scripting"
set temp_file to download "http://192.168.73.210:8081/index.html" to file "temp.txt"
end tell
then hit "Run"
A file called "temp.txt" should appear in your default directory and if you open the file you'll see that it contains a web page (html text) of your current temperature data. Let me know if this actually works, and we'll go from there.
I'm assuming that you have the Xytronix Temperature Module at a fixed IP address of 192.168.73.210 and its web server set to use port 8081 instead of the default port of 80.
-- Chris Galfo
Yes on the ip address and the port number.Chris Galfo wrote:Bob,
snip...
I'm assuming that you have the Xytronix Temperature Module at a fixed IP address of 192.168.73.210 and its web server set to use port 8081 instead of the default port of 80.
-- Chris Galfo
I copied the script and ran it.
This was the error
URL Access Scripting got an error: An error of type -1 has occurred.
Thanks for looking at it
Bob Ross
- Chris Galfo
- Posts: 16
- Joined: Sun Aug 19, 2007 10:15 am
- Location: Auberry, CA
Bob,
I can't seem to find a list of error codes for AppleScript's URL Access Scripting that includes type -1 on-line or in my AppleScript book (Beginning AppleScript - Programmer to Programmer"). You might try going on an AppleScript user's forum and seeing if anyone knows what might be going on. In the meantime, I want to try changing my Temperature Module's port to see if I can reproduce the problem here (I already tried adding a ":80" to the end of my module's address and that works fine, so I'm guessing that the port specification doesn't have anything to do with it). I don't have Mac OS 10.5 so I'm testing under OS 10.4.
Chris Galfo
I can't seem to find a list of error codes for AppleScript's URL Access Scripting that includes type -1 on-line or in my AppleScript book (Beginning AppleScript - Programmer to Programmer"). You might try going on an AppleScript user's forum and seeing if anyone knows what might be going on. In the meantime, I want to try changing my Temperature Module's port to see if I can reproduce the problem here (I already tried adding a ":80" to the end of my module's address and that works fine, so I'm guessing that the port specification doesn't have anything to do with it). I don't have Mac OS 10.5 so I'm testing under OS 10.4.
Chris Galfo
Chris,
I have been playing around looking at all the code I can find on URL Access Scripting. I got a version to work, but I don't know why the original does not - could it be 10.5.6
this is your code:
This is what I got to work - seems like if there is anything in front of the download command it fails.
Bob Ross
I have been playing around looking at all the code I can find on URL Access Scripting. I got a version to work, but I don't know why the original does not - could it be 10.5.6
this is your code:
Code: Select all
tell application "URL Access Scripting"
set temp_file to download ("http://" & LAN_address & "/index." & request_str) to file ("zz_indigo_" & LAN_address) replacing yes
end tell
Code: Select all
tell application "URL Access Scripting"
set temp_file to ((path to temporary items) as string) & "temp.xml"
download LAN_address to temp_file replacing yes
end tell
- Chris Galfo
- Posts: 16
- Joined: Sun Aug 19, 2007 10:15 am
- Location: Auberry, CA
Interesting, I'm not sure exactly what's happening either. I'll need to experiment a little more and then update the script so that it doesn't break under Mac OS 10.5. I also think that the ":" in a port specified LAN address might cause problems in the way I was naming the temporary file, so that needs to be modified too.. I'll update it and send it to you tfor testing under 10.5 if you don't mind.
Thanks,
Chris Galfo
Thanks,
Chris Galfo