Global Variables are a useful way of sharing information between different scenes or parts of your Fibaro Home Center 2 (HC2) or Home Center Lite (HCL) Z-Wave Controller. Even though 'Variable' is a term often used in computer programming, don't be put off, they are easy to use and have lots of uses.
Global Variables in Fibaro HC
A Global Variable is simply a value that you define in the Home Center (HC). You can name it how you wish and then you use it to store information that can be used by scenes or other parts of the system. This is extremely useful for setting defined periods of the day, showing that some event has happened or even counting these events.
The Fibaro HC has two types of Global Variable - Standard and Predefined. They are both created in a similar way and work the same in scenes.
Standard Variable
The Standard variable can store any numerical value you wish (you cannot store letters or other symbols). The value stored in the Standard variable can be set manually in the HC's Variables Panel or from a HC scene. It can then be used as part of a condition in other HC scenes.
The Standard variable is similar to a Mailbox - you store values which can then be used by many parts of the system.
Examples of Standard Variables are:
- Event Indicator - the variable is set to '1' when a specific event has occurred. This is useful to capture an instantaneous event such as a light being turn On and then Off, a scene can be triggered based on the fact that the light was turned on at some time.
- Counter - the variable value can be increased each time an event occurs. I use this to monitor how many times it rains during a two day period to determine if the sprinklers need to be used.
Predefined variable
The Predefined variable has set values that you configure when you create the variable. The variable can then only be set to these values. It is useful for having defined values such as Night, Day, Home, Away etc.
In this respect the Predefined variable is like a Flag that shows a defined value.
Examples of Predefined Variables:
- Day / Night - useful for allowing scenes to only run during specific periods of the day, such as motion activated lights during the evening or night.
- Home / Away / Vacation - allows different scenes to run when people are at home or out, and also changing things totally when you are away from home for long periods of time (holiday).
Creating Global Variables in Fibaro HC
Both types of variable are created in a similar way - in the HC's Variables Panel or directly from within the Home Center's Graphical Scene Builder.
Predefined Variables
- Go to the Panels tab and select the Variables Panel from left-hand navigation bar
- In 'Predefined variables' click 'Add'
- Give the new variable a name - for example 'Home_Away'
- Add the values which you want the variable to have - for instance 'Home' and 'Away'
- Click the blue 'Save' button
Figure 1: Creating a Predefined Variable in Home Center
Standard Variable
- Go to the Panels tab and select the Variables Panel from left-hand navigation bar
- In 'Variables' click 'Add'
- Give the new variable a name - for example 'Rain'
- Add the default value - this is the value the variable is set to before you make any future changes
- Click the blue 'Save' button
Figure 2: Creating a Standard Variable in Home Center
Using Variables in Scenes
The Variables can now be used in scenes as part of conditions to trigger the scene.
- Create your scene - see APNT-61: Creating Scenes in Fibaro Home Center for more information
- When adding a 'block' - select Variable from the drop-down menu
- Select the Variable name you wish to use
Note - you can also select Add/Edit variable to go directly to the Variables Panel - Click the 'Save' button
- Figure 3 shows a very simple scene that turns a light if motion is detected and the Day_Night variable is set to 'Night'
Figure 3: Simple Scene using a Variable as a condition
Related Information
- APNT-61: Creating Scenes in Fibaro Home Center
- APNT-62: Scheduling Scenes in Fibaro Home Center
- APNT-50: Adding Devices in Fibaro Home Center
- APNT-26: Motion Activated Light Using Fibaro Home Center