Ok, I built 4 global variables. But it seems like all 4 are available can be selected within RM. IOW, I could potentially make summer & fall true at the same time.
Here's what I'm thinking:
I do want to use global variables so then rules can use this variable as needed
I'd like to "build" this variable so only one out of the four is true at any given time
What I'm thinking is to have a dashboard button where I can select one of the 4 as needed.
Is there a step I'm missing to assign season ="x".
I'm very new to HE, so maybe I'm not looking at this from the right perspective. I'm here to learn. Starting small, but hope to move onto more complicated stuff.
I was thinking of one variable called "season" that would would be set to one value: summer, fall, winter, spring. You could in theory set it to anything (eg, Monday) but that can be remedied. You could set the value via a rule or have a default setting. Say you wanted it to use the spring setting if the variable isn't recognized you can use logic similar to this:
if (season == "summer") {
// Do summer stuff
} else if (season == "fall") {
// Do fall stuff
} else if (season == "winter") {
// Do winter stuff
} else {
// Do spring stuff
}
So if the season variable holds summer, fall, or winter it will do the task for the respective season. If it contains anything else it will do the spring tasks.
I do something similar with holidays. I have a script that runs once a day and sets a variable based on the current holiday. For example, yesterday was the Forth of July so it set the variable to "forth". My exterior lights use this and for the Forth they get set to red, white and blue; for Christmas it is red and green. If it doesn't recognize the value it sets them to warm white.
This is just one of one thousand ways you can do this. You could also setup four custom modes. Instead of "Home" you could have "Home (summer)" or "Home (fall)" and just set the appropriate mode.
I wrote something as I needed exactly what you're describing.
in HPM.
Oddly, about 2 weeks ago I embarked on a rewrite to have the option to choose Astonomical or Meteorological. Its not done and wont be for a while .. But SeasonName will be the state name in both fwiw.
Yeah, lots of ways to get it done. I have nine lights outside. Three work as dusk to dawn lights and they all come on full if a motion or contact sensor is triggered. It would be just a few lines in Rule Machine. Instead I ended up with several hundred lines of custom code.
I like the idea of a multi switch, that could be useful, where a tile acted as a dropdown so that only one selection could be made. The valueof that 'switch' could then be used in rules.
You could use a virtual thermostat and select temperature values - If temperature = 1 do this, if temperature = 2 do that. It's a bit Heath Robinson though as there are no labels just numeric values.