Global Variables - Switch vs variable connector

Hello
I'm starting to learn Rules and it's fun! I can't find this answer so maybe somebody knows...

For a boolean global variable, is there any difference if the connector is a variable or a switch (other than dashboard display vs control) ie

  • day variable, switch connector (set true/false at sunrise/sunset) vs

  • day variable, variable connector (set true/false at sunrise/sunset)

(Think I could also use string and others but that wouldn't get me an answer on the impact of connector choice for a boolean global variable which is what I don't understand being new to this :slightly_smiling_face:)

Any help is much appreciated. Have a great Sunday!

A switch can be exposed to Alexa so that she can cause things to happen in Hubitat during Alexa routines. Global variables stay in rules.

1 Like

Note that this isn't quite true anymore: a few firmware versions ago, we got the ability to create global (and local) variable "connectors," which expose them as devices. For a boolean variable, one option you have is to expose the device as a switch--so you can, in turn, expose that to Alexa (or use in any app like a switch).

If we think to a while back, there was a time before Rule Machine had global variables. Therefore, if you wanted something to function as one, you pretty much had to use a virtual device. Some people were also used to using these workarounds due to using virtual devices like variables in "stock" apps that had simple options for things like restrictions, where a virtual switch (for example) could effectively function as some sort of variable to control the automation in some way. And even after the introduction of global variables, there was a time without connectors, so a virtual device was still the only way to access them from outside Rule Machine.

The biggest difference nowadays might mostly be only in the history of each. :smiley:

Hey
Thanks!
That sounds right since both GVs are Boolean it should only matter within the scope of what a virtual switch vs a variable is capable of - but to confirm I'll play it back - If I understood correctly then

  • I create a Global Variable (Boolean type) and define its connector to be a variable, let's name that GV a Jelly and

  • I create a Global Variable (Boolean) and define its connector to be a switch, let's name that GV Bean

  • then the only difference between the two is that Alexa can't work Jelly but can work with b Bean?

  • And is this true only because a virtual switch can be seen and modified by an external components like Alexa for example, whereas a boolean variable needs to be used by components that can access and modify variables, like a rule or an automation for example?

See my pic to illustrate what I did with the two GVs with their variable type and associated connectors.

Thanks so much!

Okie Dokie! I think I got it... no diff unless you want to use the GV outside of RM or internal automations
Thank you!
:partying_face:

Actually, with the appearance of "connectors" for global or local variables, even that isn't really a difference now. :slight_smile:

Awesome... I was suspicious that I was missing something :hatching_chick: