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

Question

Posted

Hi, is it possible triggered between scenes?

5 answers to this question

Recommended Posts

  • 0
Posted

@Enic Please, red the rules of the Forum before creating a post.
The title of the post does not specify what the issue is and the post itself is unclear. Please elaborate on the issue and change the title.

  • 0
  • Inquirer
  • Posted

    @A.Smolinski

    I can not find a way to delete the post, can you delete it? Thank you.

    • 0
    Posted

    You don't have to delete it, you can edit it. But if you really want to, I can do it.

    • 0
    Posted

    fibaro:startScenes(sceneID) ?

    • 0
  • Inquirer
  • Posted (edited)

    Thanks for answering, I can not find a better way to explain it than to give an example: 

    --Scene 1
    --[[
    %% autostart
    %% properties
    %% weather
    %% events
    %% globals
    valueToChange
    --]]

    local function tempFunc()
        fibaro:debug(initValue)
        setTimeout(tempFunc, 60*1000)
    end

    local initValue = 0

    local startSource = fibaro:getSourceTrigger();

    if ( startSource['type'] == 'autostart')  then
        tempFunc()   
    elseif ( startSource['type'] == 'property') then
       local initValue = tonumber(fibaro:getGlobalValue("valueToChange")) -- first example
       local initValue = initValue + tonumber(fibaro:getGlobalValue("valueToChange")) -- second example
    end


    --Scene 2
    -- global variable = valueToChange
    local function changeValue()
        local result = "1" -- this is an a possible example, it could be a function
        fibaro:setGlobal("valueToChange", "1");    
    end

    local startSource = fibaro:getSourceTrigger();

    if ( startSource['type'] == 'other')  then
        changeValue() 

    end

     

    The 1st scene is executed automatically, and gives as value 0,
    The second scene is manual, when it is executed it changes the value of the global variable = 1, since it is a trigger in scene number 1, it is executed by modifying the local variable that it already has, so without having to restart scene 1 it is already would return the value = 1.

     

    The problem is that a trigger generates a new scene and therefore the value of the scene that is already working is not updated. I'm right?

    The best way, is that the 1st scene works with a global variable, and another scene modifies the value of the global variable, this is the only way I have found to simulate a trigger between scenes.

     

    Example of how it would look:

    --Scene 1
    --[[
    %% autostart
    %% properties
    %% weather
    %% events
    %% globals
    --]]

    local function tempFunc()
        fibaro:debug(fibaro:getGlobalValue("valueToChange"))
        setTimeout(tempFunc, 60*1000)
    end

    local startSource = fibaro:getSourceTrigger();

    if ( startSource['type'] == 'autostart')  then
        tempFunc()   
    end


    --Scene 2
    -- global variable = valueToChange
    local function changeValue()
        local result = "1" -- this is an a possible example, it could be a function
        fibaro:setGlobal("valueToChange", "1");    
    end

    local startSource = fibaro:getSourceTrigger();

    if ( startSource['type'] == 'other')  then
        changeValue() 

    end

     

    And why do I say all this?
    - It could have scenes that update the value dynamically, so if they use local variables they will not have to be restarted when saving and restarting (LUA). example: variable count
    - Gives the possibility of configuration through a simple web page through http: Request when scenes based on LUA are used.

    And surely many more things.

     

    Edited by Enic

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