RGBW lights for each holiday/season


#1

1) Give a description of the problem
I’m working on defining each holiday/season based on their date range as a constant integer Var = {formatDateTime($now,'MMdd' isBetween(1100,1200)};
for example (Thanksgiving). However, I don’t know how to execute the check later in the piston.

2) What is the expected behaviour?
At sunset, set bulbs to a random color based on a list of options provided based on the holiday/season.
I can set up the sunset part, as I currently have another piston doing that, but wanted to make sure I’m setting up the definings correctly first.

I’m trying to keep it as organized as possible, where I define everything at the top.
Then in the execute block, something like, “if Thanksgiving_Date is true, then set Porch to Thanksgiving_Colors”

3) What is happening/not happening?
Just getting started, need guidance.

**4) Post a Green Snapshot of the piston![image|45x37]


#2

Have you seen this thread?

There are some elegant solutions over there that does all of this, plus more


#3

I have not seen that, and that’s awesome and close, but not quite.
Any idea how I could implement where the 3 bulbs pick a color from the list (all unique) and to add the compare in the execute block so it’s all clean?
I’ve decided to use the “only when” but I want the statement to be “Only when> DateTime isBetween Thanksgiving_Date”. I can build the expression, but don’t know how to enter it into webcore… “date(isBetween(Thanksgiving_Date))”
any idea on that?


#4

There are also about a half dozen variations found by searching for “holidays” here.


Usually a good path to take is start with an “Example” piston… (a similar one known to work well)… and then tweak it a bit to fit your house…

No need to recreate the wheel from square one again… Unless you just want practice coding…


#5

That’s actually why I’m doing this project - I want to learn more about webcore coding.
Now the only two issues I’m trying to get right are:

  1. The evaluation line to determine if the date is within Thanksgiving_Date range
  2. Set variable for each bulb based on the values I have inside Thanksgiving_Colors, while keeping the define at the top.

I could apply these ideas to other projects I’ve been planning, this is just the most fun one lol.


#6

Okie dokie… I understand completely…

I think that I’ll let someone else answer your questions…


#7

Thank you very much though! I’ll ponder around the other holiday projects. Maybe someone has done a part of what I’m trying to accomplish and that’ll be another thing completed.


#8

I do not want to discourage you… Some of my best pistons I discovered “off the beaten path”… I encourage that type of exploration…

Alternatively, I think that you can get a lot of inspiration if you examine the way other people have done it…


#9

So I’ve been digging around and figured out enough to get it to work. Now I’m working on the random colors, of which I have a feeling I got working, but for some reason it’s always picking dark orange…
Any idea? I’m only testing with Thanksgiving colors for now. once that’s working, I’ll modify the rest.

Nevermind… I guess the $now variable doesn’t work as I thought it would and it was throwing off my test.

Next up is to make the bulbs (Color_Bulb_#) to not be set to the same thing.