05-12-2010, 09:36 PM
OK after more hours than I would like to publish, I knocked up the following script in homeseer to sync the clock once a day with local pc time
tested it using hyperterminal and in the panel
myDT & myTm are variables to get the data in the right format
replace the ???? with a valid sign in code
Hope someone finds it useful any comments or suggestions welcome
---------------------------------------------------------
Sub main()
\' Initialize Comport 3
e=hs.OpenComPort(3,\"9600,n,8,1\",1,\"\",\"\")
if e \"\" then
hs.writelog \"Error opening COM3\",e
hs.speak \"Error opening com port 3 \"
else
hs.writelog \"COMPort3\", \"Setup complete\"
end if
myDT = Year(Now()) & Right(\"0\" & Month(now()), 2) & Right(\"00\" & Day(Now()), 2)
myTm = Right(\"0\" & Hour(now()), 2) & Right(\"00\" & Minute(Now()), 2) & Right(\"00\" & Second(Now()), 2)
hs.WriteLog \"Sync Comfort Clock\", myDT & myTm
hs.sendtocomport (3),chr(03) & \"LI????\" & chr(13)
\'replace ???? above with a valid password
hs.WaitSecs 3
hs.sendtocomport (3),chr(03) & \"DT\" & myDT & myTm & chr(13)
hs.closeComPort (3)
end sub
tested it using hyperterminal and in the panel
myDT & myTm are variables to get the data in the right format
replace the ???? with a valid sign in code
Hope someone finds it useful any comments or suggestions welcome
---------------------------------------------------------
Sub main()
\' Initialize Comport 3
e=hs.OpenComPort(3,\"9600,n,8,1\",1,\"\",\"\")
if e \"\" then
hs.writelog \"Error opening COM3\",e
hs.speak \"Error opening com port 3 \"
else
hs.writelog \"COMPort3\", \"Setup complete\"
end if
myDT = Year(Now()) & Right(\"0\" & Month(now()), 2) & Right(\"00\" & Day(Now()), 2)
myTm = Right(\"0\" & Hour(now()), 2) & Right(\"00\" & Minute(Now()), 2) & Right(\"00\" & Second(Now()), 2)
hs.WriteLog \"Sync Comfort Clock\", myDT & myTm
hs.sendtocomport (3),chr(03) & \"LI????\" & chr(13)
\'replace ???? above with a valid password
hs.WaitSecs 3
hs.sendtocomport (3),chr(03) & \"DT\" & myDT & myTm & chr(13)
hs.closeComPort (3)
end sub

