The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]

Re: AddTimer()



Hi,

The time given should be a date format. 00:15:00 is actually 1970/1/1
00:15:00 and as that is before now it runs straight away.
What you want is DateAdd("n",now(),15)  which just adds 15
minutes ( n
being minute) to now and returns it as a correct date format.  There are
some more examples here:
http://www.w3schools.com/vbscript/func_dateadd.asp

eg:

if lcase(x)="on" then

y=xap.AddTimer("EnsuiteFanTimer",DateAdd("n",now(),15),"ensuite_fan_off")
end if


Also as a side note it is worth downloading the latest intranet ocx from
mi4.biz (http://www.mi4.biz/modules.php?name=Content&pa=showpage&pid=39)
as the one inclueded with Floorplan is a little out of date.

hth

James

Shane Harrison wrote:
> Hi there,
>
> Looking for a bit of help. Want to switch a bathroom fan off x minutes
after
> it is turned on.  I have the following script run on a change to that
device
>
> Sub Main()
>
> x=xap.GetState("nzha.linet.controller1:fan.ensuite")
>
> if lcase(x)="on" then
>   
y=xap.AddTimer("EnsuiteFanTimer","00:15:00","ensuite_fan_off")
> end if
>
> End Sub
>
>
> Problem is that the script "ensuite_fan_off" seems to run
immediately.  Can
> anyone see something I am doing wrong?  Is the format
"00:15:00" correct for
> 15 minutes?
>
> Any pointers appreciated.
>
> Cheers
> Shane
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>




xAP_Automation Main Index | xAP_Automation Thread Index | xAP_Automation Home | Archives Home

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.