Newbie trying to get automation to work
Posted: 20 Nov 2014 14:33
I'm just starting to figure out z-wave and HA, and have set ut a RaZberry and a Fibaro wall plug to start testing.
Now I wonder how can I get the plug to turn on at given times of the day, and then of at other times. I want this plug to turn on a lamp at 6 am and again at 4pm, and turn it of at 9am and 1am. I tried to make a cron job using this thread: viewtopic.php?f=3419&t=20601, but it the commands never fires.
Here's the script I use:
And I use a cron.js file from https://github.com/StefanLiebenberg/cron.js/
Thanks!
Now I wonder how can I get the plug to turn on at given times of the day, and then of at other times. I want this plug to turn on a lamp at 6 am and again at 4pm, and turn it of at 9am and 1am. I tried to make a cron job using this thread: viewtopic.php?f=3419&t=20601, but it the commands never fires.
Here's the script I use:
Code: Select all
executeFile("/userModules/cron.js");
var Crontab = new Cron(); //instatiates the Cron module
//simple example of turn on a wallPlug at specific time automatically
//runs every day, at 12h01m00sec
Crontab.add( new Cron.Job( "0 01 12 * * *", function () {
//get status of the switch. Change N and I, according to your actual config
var status = zway.devices[5].instances[0].SwitchBinary.data.level.value;
//if the swich is off, turn it on
if(status==false){
zway.devices[5].instances[0].SwitchBinary.Set(255);
}
}));
//runs every day, at 12h00m00sec
Crontab.add( new Cron.Job( "0 00 12 * * *", function () {
//get status of the switch. Change N and I, according to your actual config
var status = zway.devices[5].instances[0].SwitchBinary.data.level.value;
//if the swich is on, turn it off
if(status==true){
zway.devices[5].instances[0].SwitchBinary.Set(0);
}
}));
Crontab.start();
Thanks!