Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,


as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.


As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!



Smart Home Forum by FIBARO Team

  • 0

HOWTO: Switching on a light in a scene



Although the visual scene creator module is aimed to be easy and understandable, creating your first scene might not be that easy if you have no programming experience.

When I first got my HC2, the first scene I created was a 'Watch a movie' scene. The scene simply needed to switch on a light. This proved to be not that straightforward as I initially thought.

First of all, there are two types of scenes:

1. you have scenes that run once (when you trigger them)

2. you have scenes that run continuously in a loop in the background

In our example, we don't need to have the scene running in the background, the scene just needs to be executed when we trigger it.

Create a new scene and name it 'Watch a movie', make sure you uncheck 'Active Scene' (this will prevent the scene from running in a continuous loop in the background).

Goto the Advanced tab and start constructing your scene.

The first thing that you will notice when you play around with this scene builder is that you cannot simply add a light and instruct it to turn on. Every scene needs to start with a condition (IF) and according to this condition you can do something (THEN).

IF [condition]

THEN [action]

The condition in our case does not make any sense because we just want our light to switch on. However, your scene needs to start with a condition so we need to add useless and confusing logic.

Try this:

IF DEVICES [light1] == [off]

THEN DEVICES [light1] = [on]

Save the scene and click RUN (there is also a STOP button here, I will explain this later on). When you click RUN, Light1 should switch on.

Now, if your forgot to uncheck 'Active Scene' when you created the scene, and you were to turn off light1, it would immediately switch back on again (because the scene is running in a loop in the background).

You turn off the light by going to 'Devices', locate 'Light1' and click the OFF button. Clicking the STOP scene button will not turn light1 back off. This button is used to stop a scene from running while it is running. In our case, the scene is only running a fraction of a second so clicking STOP will not do anything. You can have very large and complex scenes that run over a longer period of time. In those cases, clicking the STOP button would halt a scene from continuing to run.

Back to our example. We got our scene working but consider an example where you need to switch on 20 lights.

IF DEVICES [light1] == [off]

THEN DEVICES [light1+light2+light3+light...] = [on]

This will work as long light1 is turned off but what if you manually turned on [light1]? The scene would no longer work unless you first turn off [light1].

You could change your scene logic to this:

IF DEVICES [light1] == [off]

OR DEVICES [light2] == [off]

OR DEVICES [light3] == [off]

OR ...

THEN DEVICES [light1+light2+light3+light...] = [on]

but this would become an unnecessary large scene logic.

As an alternative, you could fix this problem using a variable. A variable is basically something that stores information. You assign a value to a variable and you can check the value of the variable in a condition.

Goto the variables panel in the Panels section and add a new variable, name it one and assign the value 1 to it.

Change your scene to this:

IF VARIABLE [one] == [1]

THEN DEVICES [light1+light2+light3+light...] = [on]

Unless you change the value of the variable one it will always remain 1 so this scene will always switch on your light(s) when you trigger it.

  • Thanks 1
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi Janbe,

Thanks for this explanation. I was already working with the scenes, but it is always nice to see some things explained so I could learn and become better. If you wan't to share more knowledge you are welcome

Please login or register to see this image.

/emoticons/default_icon_biggrin.gif" alt=":-D" />



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...