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

Global variable change not triggering scene


Vinisz

Question

Guys,

 

Problem, I have code below, however, change the value of Global variable "regenover" does not trigger the scene.

I don't understand why not, someone able to help me out here ?

 

--[[
%% globals
regenover
-]]

local trigger = fibaro:getSourceTrigger()
local regentijd = fibaro:getGlobalValue("regenover")

if regentijd == "0" then
fibaro:call(475, "turnOn")
fibaro:call(782, "pressButton", "5");
elseif regentijd == "5" then
fibaro:call(475, "turnOff")
fibaro:call(782, "pressButton", "4");
elseif regentijd == "15" then
fibaro:call(475, "turnOn")
fibaro:call(782, "pressButton", "3");
elseif regentijd == "30" then
fibaro:call(475, "turnOff")
fibaro:call(782, "pressButton", "2");
end
 

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • 37 minutes ago, RH_Dreambox said:

    Test with

    local regentijd = tonumber(fibaro:getGlobalValue("regenover"))

     

    How can that have anything to do with "triggering" the scene ?

    Link to comment
    Share on other sites

    • 0

    You cant trigger scene by changing the global manually, you must do that with lua.

    but you maby already know that.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • No, I didn't , thats strange...

    the variable is changed externallay via http post. Why doenst that work ?

    Link to comment
    Share on other sites

    • 0
    6 hours ago, Vinisz said:

    Guys,

     

    Problem, I have code below, however, change the value of Global variable "regenover" does not trigger the scene.

    I don't understand why not, someone able to help me out here ?

     

    --[[
    %% globals
    regenover
    -]]

    local trigger = fibaro:getSourceTrigger()
    local regentijd = fibaro:getGlobalValue("regenover")

    if regentijd == "0" then
    fibaro:call(475, "turnOn")
    fibaro:call(782, "pressButton", "5");
    elseif regentijd == "5" then
    fibaro:call(475, "turnOff")
    fibaro:call(782, "pressButton", "4");
    elseif regentijd == "15" then
    fibaro:call(475, "turnOn")
    fibaro:call(782, "pressButton", "3");
    elseif regentijd == "30" then
    fibaro:call(475, "turnOff")
    fibaro:call(782, "pressButton", "2");
    end
     

    code looks ok, you dont need the local get source trigger line.

    the only thing i would try is adding brackets around the 'if' conditions (shown in bold)...

     

    eg

     

    if (regentijd == "0") then
    fibaro:call(475, "turnOn")
    fibaro:call(782, "pressButton", "5");

    fibaro:debug('regentijd is 0')
    elseif (regentijd == "5") then
    fibaro:call(475, "turnOff")

    ...

     

    and so forth and give it a go, also adding debug commands in aswell just in case the device isnt responding at least if it prints the statement you know code is ok, again i have highlighted in bold

     

    thanks

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 7 minutes ago, morpheus75 said:

    code looks ok, you dont need the local get source trigger line.

    the only thing i would try is adding brackets around the 'if' conditions (shown in bold)...

     

    eg

     

    if (regentijd == "0") then
    fibaro:call(475, "turnOn")
    fibaro:call(782, "pressButton", "5");

    fibaro:debug('regentijd is 0')
    elseif (regentijd == "5") then
    fibaro:call(475, "turnOff")

    ...

     

    and so forth and give it a go, also adding debug commands in aswell just in case the device isnt responding at least if it prints the statement you know code is ok, again i have highlighted in bold

     

    thanks

     

    Thanks @morpheus75 but the problem is the scene doesn't fire, not that the device is no working so @sonnyboy answer is correct, the scene does not fire when changing global variables manually, only when changed via LUA (or maybe also via blockscene)

    To my opninion, this is a design flaw..... but now I at least know "why" so I can work on a solution.

    Link to comment
    Share on other sites

    • 0

    @Vinisz, make sure you set invokescene to true. That is not documented in active rest in your unit nor in developer.fibaro.com.

     

     

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