I'm trying to run a script in HaikuHelper that will email me and my wife whenever our doors are opened during our work hours. I entered the following script below, clicked the "Run Script" button and saw the following in the log:
2015-06-16 18:01:57 Our House: Initializing scripting environment…
2015-06-16 18:01:57 Our House: Applying controller script…
but when the doors open between the appointed times (8am to 5pm), nothing happens. Tried restarting HaikuHelper and I see the same lines about applying the script when the program starts, but it doesn't seem to be working. So, I'm guessing this is a scripting error! Any ideas are greatly appreciated.
function onZoneNotReady(zone)
{
if (zone.number == 1)
{
var date = new Date();
if(date.getHours() >=17 && date.getHours() <=8)
{
helper.sendMail (controller, '[email protected]','Front Door Notice','Front Door was opened.');
helper.sendMail (controller, '[email protected]','Front Door Notice','Front Door was opened.');
}
}
if (zone.number == 2)
{
var date = new Date();
if(date.getHours() >=17 && date.getHours() <=8)
{
helper.sendMail (controller, '[email protected]','Garage Door Notice','Door to Garage was opened.');
helper.sendMail (controller, '[email protected]','Garage Door Notice','Door to Garage was opened.');
}
}
if (zone.number == 3)
{
var date = new Date();
if(date.getHours() >=17 && date.getHours() <=8)
{
helper.sendMail (controller, '[email protected]','Back Door Notice','Back Door was opened.');
helper.sendMail (controller, '[email protected]','Back Door Notice','Back Door was opened.');
}
}
}
2015-06-16 18:01:57 Our House: Initializing scripting environment…
2015-06-16 18:01:57 Our House: Applying controller script…
but when the doors open between the appointed times (8am to 5pm), nothing happens. Tried restarting HaikuHelper and I see the same lines about applying the script when the program starts, but it doesn't seem to be working. So, I'm guessing this is a scripting error! Any ideas are greatly appreciated.
function onZoneNotReady(zone)
{
if (zone.number == 1)
{
var date = new Date();
if(date.getHours() >=17 && date.getHours() <=8)
{
helper.sendMail (controller, '[email protected]','Front Door Notice','Front Door was opened.');
helper.sendMail (controller, '[email protected]','Front Door Notice','Front Door was opened.');
}
}
if (zone.number == 2)
{
var date = new Date();
if(date.getHours() >=17 && date.getHours() <=8)
{
helper.sendMail (controller, '[email protected]','Garage Door Notice','Door to Garage was opened.');
helper.sendMail (controller, '[email protected]','Garage Door Notice','Door to Garage was opened.');
}
}
if (zone.number == 3)
{
var date = new Date();
if(date.getHours() >=17 && date.getHours() <=8)
{
helper.sendMail (controller, '[email protected]','Back Door Notice','Back Door was opened.');
helper.sendMail (controller, '[email protected]','Back Door Notice','Back Door was opened.');
}
}
}