Introduction Description Schematic Instructions Software Vintages Differences with TEMP05 FAQ HomeSeer Setup News Upgrading TEMP08 References Ordering Information Download the Instruction Manual Here
(we're not kidding - we get a lot of e-mails with questions that are already addressed in the Frequently Asked Questions web page)
Note 1: Jim Doolittle has a stand-alone application that can also work as a HomeSeer plug-in. You can order DooTEMP08 from here.
Note 2: Ken Mitchell has written a HomeSeer Plug-in for the TEMP05 which can be used for the TEMP08. This plug-in eliminates the need for the script shown on this page. The beta forum for the plug-in is located here.
Note 3: Michael McSharry has also written a HomeSeer Plug-in for the TEMP05 which adds a database capture and charting. That plug-in can also be used for the TEMP08 The forum is located here.
Note 4: An alternate stand-alone application is available as thermd .
Note 5: The script information on this page refers only to TEMP08.
' this script reads data from TEMP08 and stores received sensor readings into HS virtual devices
' Modified by Mitch Matteau 07-01-23 added virtual device
update to switch reading
' Modified by Mitch Matteau 04-04-30 added "true" parameter to all hs.setdevicestring function calls
' Created by Mitch Matteau 02-12-21
'=============================================================
' HS virtual devices used;
' r1 to r19 for DS18S20 sensors
' r20-29 for humidity sensor
'=============================================================
sub main(data)
'=============================================================
dim i
dim result
dim virt_device
dim default_hc
dim prev_result
dim wind_dirn
dim wind_spd
dim wind_gust
dim high_wind
dim rain_history
dim rain_today
dim rain_absolute
dim SwitchStatus
dim SwitchNumber
dim SwitchBase
dim SwitchValue
' virtual device list
default_hc = "r"
wind_dirn = "z7"
wind_spd = "z4"
wind_gust ="z1"
high_wind = "v6"
rain_history = "v8"
rain_today = "v7"
rain_absolute = "v9"
SwitchBase = "s"
'=============================================================
' Check if the received data is from a temperature reading
'=============================================================
if mid(data,1,4)="Temp" then
sensorid = mid(data,7,2)
if left(sensorid,1) = "0" then
sensorid=mid(sensorid,2,1)
end if
i = Instr(data,"=")
result=trim(mid(data,i+1))
if right(result,1)="F" or right(result,1)="C" then
result = left(result,(len(result)-1))
end if
if CInt(sensorid)<=19 then
virt_device=default_hc+sensorid
prev_result=hs.DeviceString(virt_device)
end if
'=============================================================
' eliminate false readings
' false readings are replaced with the previous reading
'=============================================================
if left(result,3) = "???" then
result = prev_result
end if
if left(result,3) = "185" then '185 is an indicator that the device result
is invalid
result = prev_result
end if
'=============================================================
' Now save current readings into HomeSeer
'=============================================================
hs.SetDeviceString virt_device,result,true
if result<>prev_result then
hs.SetDeviceLastChange virt_device, Now()
hs.SetDeviceValue virt_device,result
end if
end if
'=============================================================
' Humidity Sensor Capture
'=============================================================
if left(data,10)="Humidity #" then
i=Instr(data,"#")
sensorid=mid(data,i+1,2)
if left(sensorid,1) = "0" then
sensorid=mid(sensorid,2,1)
end if
virt_device=default_hc+CStr(CInt(sensorid)+19)
prev_result=hs.DeviceString(virt_device)
i = Instr(data,"=")
result = Trim(mid(data,i+1))
if result="???" then
result=prev_result
hs.Writelog "Humidity","Sensor error on
#"+sensorid
end if
hs.SetDeviceString virt_device,result,true
if result<>prev_result then
hs.SetDeviceLastChange virt_device, Now()
end if
end if
'=============================================================
' Version capture
' virtual device z17 used to capture the data
'=============================================================
if mid(data,1,6)="TEMP08" then
version_id = "z17"
hs.SetDeviceString version_id,data,true
hs.SetDeviceLastChange version_id, Now()
end if
'=============================================================
' Relay Status capture
' virtual devices z31 through z38 used to capture the data
'=============================================================
if mid(data,1,5)="Relay" then
i = Instr(data,"=")
data = mid(data,i+1)
for i=1 to 8
virt_device= "z3"+trim(CStr(i))
a = trim(hs.StringItem(data,i,","))
if a<>hs.DeviceString(virt_device) then
hs.SetDeviceString virt_device,a,true
hs.SetDeviceLastChange
virt_device,Now()
end if
next
end if
'=============================================================
' Wind Direction capture
'=============================================================
if left(data,9)="Wind Dirn" then
result = mid(data,10)
position = InStr(result,"=")
if position<>0 then
a = mid(result,position+1) ' wind direction
if a <>"???" then
hs.SetDeviceString wind_dirn,a,true
hs.SetDeviceValue wind_dirn,0
end if
end if
end if
'=============================================================
' Wind Speed capture
'=============================================================
If left(data,10)="Wind Speed" Then
result = mid(data,11)
position = InStr(result,"=")
If position<>0 then
result = mid(result,position+1)
a = hs.StringItem(result,1,",") 'wind speed
a = Trim(replace(a,"MPH",""))
If left(a,3)<>"???" then
hs.SetDeviceString wind_spd,a,true
hs.SetDeviceValue
wind_spd,CInt(a)
else
a=0
end if
b = hs.DeviceString(high_wind)
if isnumeric(b) then
b =
CInt(hs.DeviceString(high_wind))
else
b = 0
hs.SetDeviceString high_wind,"0",true
hs.SetDeviceLastChange high_wind, Now()
end if
if Cint(a) > CInt(b) then
hs.SetDeviceString high_wind,CStr(a),true
hs.SetDeviceLastChange high_wind, Now()
hs.WriteLog "HIGH WIND",a+" mph"
hs.CreateVar("HWNDT")
hs.SaveVar
"HWNDT",Time()
end if
a = trim(replace(hs.StringItem(result,2,","),"Gust = ",""))
hs.SetDeviceString wind_gust,a,true
hs.SetDeviceValue wind_gust,CInt(a)
End if
end if
'=============================================================
' Rain Counts
'=============================================================
if Left(data,4)="Rain" Then
position=InStr(data,"=")
If position<>0 then
b = mid(data,position+1) ' rain count
If left(b,3)<>"???" then
b = trim(replace(b," Inch","")) ' remove units
c = hs.DeviceString (rain_history) ' History Info
a = hs.StringItem(c,7,",") ' Yesterday's count
hs.SetDeviceString rain_absolute,b,true ' absolute rain count
hs.SetDeviceLastChange rain_absolute, Now()
If
IsNumeric(b) then
l = CSng(b) ' Value of Absolute count
If Not IsNumeric(a) then
k = l ' on error, assume no count
Else
k = CSng(a) ' Value of Yesterday's count
End If
If (l-k) > 10 then
a = "0.00" ' can't do more than 9 inches in 1 cycle
Else
a = CStr(Round((l-k),2)) ' Result is today's count
End If
If IsNumeric(a) then
hs.SetDeviceString rain_today,a,true ' Today's count
hs.SetDeviceValue rain_today,CInt(a)
d = ""
For i = 1 to 7
d = d + hs.StringItem(c,i,",")+","
Next
d = d + b
hs.SetDeviceString rain_history,d,true ' Restore history info
hs.SetDeviceLastChange rain_history, Now()
End If
End If
End If
End If
End If
'=============================================================
' Switch Status Capture and transfer
'=============================================================
if Left(data,6)="Switch" Then
SwitchNumber = SwitchBase+mid(data,Instr(data,"#")+1,2)
SwitchStatus = mid(data,Instr(data,"=")+1,3)
if left(SwitchStatus,2)="On" then
SwitchStatus="On"
SwitchValue = 2
end if
if left(SwitchStatus,3)="Off" then
SwitchStatus="Off"
SwitchValue = 3
end if
'
use one of the following to report the switch status to an X-10 or virtual
device:
'hs.execX10 SwitchNumber,SwitchStatus,0
'hs.setdevicevalue SwitchNumber,SwitchValue
end if
'=============================================================
' use the following to debug your connection to TEMP08...
hs.writelog "TEMP08 RECEIVED",data
end Sub
Return to
TEMP0
8 Project