Selector switch

Current modes work fine for time of day or presents. But I'd like to have something separate to control alternative/secondary modes like time of year.

For example I'd like a selector for seasons; winter, spring, summer, fall. Only one would be selected at any given time.

Is there a way to build a selector switch? I see the virtual switch and buttons. Not sure either of these would meet my needs.

Mode manager seems to only address time, eg time of day and presence modes.

Should I be looking at state machines?

How do you manage these alternative/secondary modes.


One way you can handle it is with a global variable.

season = “summer”

Then use the variable in your logic. You can set the season manually from the settings page or with a simple rule that runs once a day.


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.

1 Like

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. :wink:

1 Like

yeah. but you also get a tile for your dashboard... :slight_smile:

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.

1 Like

Starting with reply 15 this post has an interesting solution.