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

Pushing virtual button after variable change


Question

Posted

Hello.

 

How can i get any variable change to push a virtuel button (in my example sonos TTS).

The button is working correctly, and the variables is changing, but nothing happens.

 

I tried as a scene, it is working, and pressing the button if i am pushing "RUN" but when the variables is changing nothing is happening.

 

 

--[[
%% autostart
%% properties
%% globals
presence_vince
--]]

local startSource = fibaro:getSourceTrigger();
if (
 ( fibaro:getGlobalValue("presence_vince") == "Absent" )
or
startSource["type"] == "other"
)
then
 fibaro:call(80, "pressButton", "3");
end

 

and

 

--[[
%% autostart
%% properties
%% globals
presence_vince
--]]

local startSource = fibaro:getSourceTrigger();
if (
 ( fibaro:getGlobalValue("presence_vince") == "Present" )
or
startSource["type"] == "other"
)
then
 fibaro:call(80, "pressButton", "4");
end

10 answers to this question

Recommended Posts

  • 0
  • Inquirer
  • Posted

    another way around could be: if

    status == "Present"
    then 
    fibaro:call(thismodule, "setProperty", "currentIcon", 40)
        fibaro:call(109, "pressButton", "1"); 
    end
     
    fibaro:sleep(1000);
     
    But the button is being pressed constantly, i only want it to being pressed once...
     
    Anyone ?
    • 0
    Posted

    I assume you are changing variable in Variables Panel? Scenes do not react on variables changed like that. You have to change it in e.g. Virtual Device button or other scene, or by performing HTTP request with proper arguments ("invokeScenes"=true). The easiest way would be to create temporary virtual device with two buttons for changing vale of variable.

    • 0
  • Inquirer
  • Posted

    The variables 

     

    I assume you are changing variable in Variables Panel? Scenes do not react on variables changed like that. You have to change it in e.g. Virtual Device button or other scene, or by performing HTTP request with proper arguments ("invokeScenes"=true). The easiest way would be to create temporary virtual device with two buttons for changing vale of variable.

    The variables is changed thru my RPI running FING making an HTTP request on present/absent on the wireless network.

    It works like a charm and now i want to push a scene when the variables is changing form absent/present and the other way around. Unfortunately currently i am not so sharp YET into Lua.

    • 0
    Posted

    When changing a variable from RPI just add mentioned "invokeScenes"=true parameter as body. It will trigger scenes that are based on given variable.

    • 0
  • Inquirer
  • Posted

    When changing a variable from RPI just add mentioned "invokeScenes"=true parameter as body. It will trigger scenes that are based on given variable.

     

    I am not quite sure what you mean, i am using this call from the RPI:

    Please login or register to see this code.

    • 0
    Posted

    Instead of {"value": "Present"} try {"value": "Present","invokeScenes"=true}

    • 0
  • Inquirer
  • Posted

    Instead of {"value": "Present"} try {"value": "Present","invokeScenes"=true}

    Added it to the push, but how do i get the change of the value to push a button/start a scene?

    • 0
    Posted

    It looks to me that this is what is suggested to happen with the invokeScenes parameter:

    You use curl to change the variable remotely

    The invokeScenes true parameter causes scenes that normally react on the related variable to be triggered

    The way to push a virtual device button would thus be to have a scene do this

     

    So, a scene that reacts on change of variable Presence_PG should be triggered automatically. My guess is though that this code won't work. The value and invokeScenes are specified differently? Change it to "invokeScenes":true or "invokeScenes":"true" might help. And of course, you do need to have a scene that responds to global presence_PG (just mentioning this, because the scene code posted here responds to another var name).

    • 0
  • Inquirer
  • Posted

    It looks to me that this is what is suggested to happen with the invokeScenes parameter:

    You use curl to change the variable remotely

    The invokeScenes true parameter causes scenes that normally react on the related variable to be triggered

    The way to push a virtual device button would thus be to have a scene do this

    So, a scene that reacts on change of variable Presence_PG should be triggered automatically. My guess is though that this code won't work. The value and invokeScenes are specified differently? Change it to "invokeScenes":true or "invokeScenes":"true" might help. And of course, you do need to have a scene that responds to global presence_PG (just mentioning this, because the scene code posted here responds to another var name).

    I tried with both "invokeScenes":true and "invokeScenes":"true" & "invokeScenes"=true but it doesnt trigger this scene:

    Please login or register to see this code.

    However it triggers this icon changes fine:

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    FINALLY, got it working with: "invokeScenes"=true and some changes in the scene.

    Thank you!

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