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!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

[SOLVED]Variables as triggers


jodohl

Question

I need help to understand why the below described HC2 Scene does not trigger when set to "Automatic" and the Variable "ATest" is set to "True". 

 

I can trigger the Scene manually wherafter the Device "Test" turns off as expected. Below follows the details:

 

In order to understand the difference between "Automatic" and "Manual" and the effect of having av Scene turned "On" or "Off" in HC2, I made the following very simple test Scene in the Graphic Block editor:

 

IF Variable "ATest" == "True"

THEN Device "Test" = "Turn Off"

 

The Variable "ATest" was created in the HC2 Variable Panel as a "Predefined Variable" with to defined values, namely "True" or "False".

The Device "Test" is a Fibaro Wallplug

 

In precise LUA code: 

--[[
%% properties
%% weather
%% events
%% globals
ATest
--]]

local startSource = fibaro:getSourceTrigger();
if (
 ( fibaro:getGlobalValue("ATest") == "True" )
or
startSource["type"] == "other"
)
then
    fibaro:call(182, "turnOff");
end

 

Any help to explain why the Scene does not turn off the device will be highly appreciated!

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi @jodohl

 

When your scene is set to 'Automatic' then it will run whenever the following occurs:

  1. When the ATest global variable changes value (but not when changed via the Variables panel).
  2. You run it manually (eg: from the HC2 web portal or via the mobile app)
  3. The scene is run programatically from another scene, using the fibaro:startScene function (or equivalent in block scenes).

When it is set to 'Manual', then it will run when:

  1. You run it manually from the HC2 web portal or mobile app.
  2. The scene is run programatically from another scene.

So your scene will be triggered to run automatically in Automatic mode, but only when the ATest global variable is changed by another scene.

 

Dave

 

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thanks a lot, Dave! I had not noticed that changing value in the Value Panel will not trigger. Imporant to keep in mind:-)

    Link to comment
    Share on other sites

    • 0

    In addition, the scene is not triggered if the variable is changed via the Fibaro REST API unless you also add the following in your json struct in the call: 

    Please login or register to see this code.

     

     

     

     

     

    Edited by perjar
    • Like 1
    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.

    Guest
    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...