For the last few days I have been trying to write a very simple background script that will start at a certain time and end at another. All I want the script to do is turn the lights on when the script starts and turn them off when it ends.
So would anyone be willing to write or show me a script that could do this?
My channels:
Roof_
Top_window_1
Top_window_2
Mid_window_1
Mid_window_2
Mid_window_3
Bottom_window_1
Bottom_window_2
Bush_1
Bush_2
Bush_3
Bush_4
Bush_5
Bush_6
Garage_Door
Tree
Any help will be appreciated.
Take this one for example and add your items.
void Start() {
ChannelCollection Roof;
ChannelCollection Windows
ChannelCollection Bush;
ChannelCollection GarageDoor;
ChannelCollection Tree;
Roof = Channels(
Roof_);
Windows = Channels(
Top_window_1,
Top_window_2,
Mid_window_1,
Mid_window_2,
Mid_window_3,
Bottom_window_1,
Bottom_window_2);
Bush = Channels(
Bush_1,
Bush_2,
Bush_3,
Bush_4,
Bush_5,
Bush_6);
// Setup to turn on BG at a particular time
DateTime now = DateTime.Now; //get the current time
// The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
DateTime start = new DateTime(now.Year, now.Month, now.Day, 17, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 22, 30, 00);
// We only want the channels to turn on while the current time is
// between 5:30 pm and 10:30 pm.
// This will repeat forever until it's stopped by the application.
//while (true)
while(now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
now = DateTime.Now; //update the current time
//On(CandyCanes);
// Set 1
//Ramps all channels from 0-100 over 3 seconds
Ramp(All, 0,20,30,40,50,60,70,80,90,100, Over(3).Seconds, Wait);
//Turns all channels on for 10 seconds If you just want to turn everything on and that's it, comment out the ramp and fade.
On(All, Over(10).Seconds, Wait);
//OR turn things on at 50% vs 100%
//On(Windows, At(50)); // At 50%
//On(Bush, At(50));
//On(Tree, At(50));
// Can also chase your bushes
//Chase(Bush, Over(5).Seconds, Wait);
//Fades all channels down from 100 - 0
Ramp(All, 100,90,80,70,60,50,40,30,20,0, Over(3).Seconds, Wait);
//
}
Off(All);
}
Hey,
Thanks for the help, but after configuring it the way I want and messing around with it for a few days I still can't get any response from my lights.
So at this point I'm just stumped.
QuadSlayer wrote:Hey,Thanks for the help, but after configuring it the way I want and messing around with it for a few days I still can't get any response from my lights.
So at this point I'm just stumped.
Post your code so we can take a look.
Its the code Livermore-Dad posted
void Start() {
ChannelCollection Roof;
ChannelCollection Windows;
ChannelCollection Bush;
ChannelCollection GarageDoor;
ChannelCollection Tree;
Roof = Channels(
Roof_);
Windows = Channels(
Top_window_1,
Top_window_2,
Mid_window_1,
Mid_window_2,
Mid_window_3,
Bottom_window_1,
Bottom_window_2);
Bush = Channels(
Bush_1,
Bush_2,
Bush_3,
Bush_4,
Bush_5,
Bush_6);
// Setup to turn on BG at a particular time
DateTime now = DateTime.Now; //get the current time
// The DateTime constructor goes (YYYY, MM, DD, HH, MM, SS)
DateTime start = new DateTime(now.Year, now.Month, now.Day, 18, 30, 00);
DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 00, 00);
// We only want the channels to turn on while the current time is
// between 5:30 pm and 10:30 pm.
// This will repeat forever until it's stopped by the application.
//while (true)
while(now.CompareTo(start) >= 0 && now.CompareTo(end) <= 0)
{
now = DateTime.Now; //update the current time
//On(CandyCanes);
// Set 1
//Ramps all channels from 0-100 over 3 seconds
Ramp(All, 0,20,30,40,50,60,70,80,90,100, Over(3).Seconds, Wait);
//Turns all channels on for 10 seconds If you just want to turn everything on and that's it, comment out the ramp and fade.
On(All, Over(10).Seconds, Wait);
On(All, Wait);
//OR turn things on at 50% vs 100%
//On(Windows, At(50)); // At 50%
//On(Bush, At(100));
//On(Tree, At(50));
// Can also chase your bushes
//Chase(Bush, Over(5).Seconds, Wait);
//Fades all channels down from 100 - 0
//Ramp(All, 100,90,80,70,60,50,40,30,20,0, Over(3).Seconds, Wait);
//
}
Off(All);
}
