Ok, there you are: you have a Soft-I/O device to read out your sensors and you want XTension to know about it. ¿Izza simple, no? No. Here is how to store and keep Soft-I/O values in XTension and how to let XTension work with this data.
First, make a new pseudo unit in XTension, name it 'solarboiler'. That will hold the values for the solar boiler, such as top- middle and bottom temperature.
Put a variable for each of values of the solar boiler in this unit: add a property in the unit 'solarboiler' that you name 'top temperature' and do likewise for all other values you want to store.
By now, you have probably found how to read out soft-I/O by using php and socket communication. Use PHP to read the temperature in the boiler top, store it in the php variable $toptemp. Now you need that value into XTension's unit solarboiler, in the property 'top temperature'. You can do that by calling, from the same php scipt, a shell script which composes an AppleScript with the appropriate values and eventually stores the temperature in XTEnsion:
shell_exec("osascript -e 'tell application \"XTension\"' -e 'set unit property \"temperature\" in unit \"solarboiler\" to ".$toptemp."' -e 'end tell'");
(be sure to keep it all on one line) and abra-kadabra-kazooo, there is the temperature value for you!
From within XTension you can use the measured values in scripts such as:
on motion("shower");
set toptemp to Get Unit Property "temperature" from unit "solarboiler"
if toptemp<50 then
turnon("kettle")
end if
end
[edited Saturday, October 3, 2009 , variable names did not match]
Last change: Saturday, October 3, 2009