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

Press VD button, from within other VD


kariem112

Question

I have several AV equipment connected to my HC2. Each of them as a virtual device with all remote control buttons mapped on them, and they work as expected. Now, I am trying to create a virtual device with all important functions of the various audio video equipment on them. 

 

I tried the following:

 

fibaro:call(162, "pressButton", "Button82");

 

In which 162 is the virtual device ID of the device I want to control, and "Button82" is the id of the button I would like to press. This does not work.What do I need to change to get it to work?

Link to comment
Share on other sites

Recommended Posts

  • 0

Hi,

 

Close but you have to count which the key is and send as last argument. Example: Say you have VD with 4 keys. If you like to push key number 3, then send:

Please login or register to see this code.

So what you send is the key number, and the key number is counting from top left and +1 for each key - no matter what you have called the key, you have to send the number that represents that key (OH and if you have a label, that counts +1 also).

  • Thanks 1
Link to comment
Share on other sites

  • 0

Ok following on from that, i have my sony tv remote as a plugin.  Can anyone tell me how to press a button on that plugin from a virtual device?

 

Or can i only do it from 1 VD to another VD?  Alternately does anyone have the LUA for sony tv?

Cheers

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Hi,

     

    Close but you have to count which the key is and send as last argument. Example: Say you have VD with 4 keys. If you like to push key number 3, then send:

    Please login or register to see this code.

    So what you send is the key number, and the key number is counting from top left and +1 for each key - no matter what you have called the key, you have to send the number that represents that key (OH and if you have a label, that counts +1 also).

    hmm. ok, do I really need to manually count all the buttons / other elements ? I have copied the acual remote in de VD, so there are a lot of buttons

    Please login or register to see this image.

    /emoticons/default_icon_razz.gif" alt=":-P" />  Do disabled buttons also count?

     

    @pt13: you can use fibaro:call ( 5 , 'up' ); -- up where 5 is the virtual device ID, and up is the command. For a list of commands, right click in the LUA screen and goto your Sony VD.

    Link to comment
    Share on other sites

    • 0

    Hi Kariem, 

    I actually just figured that out!  however......i have only been able use "power" which switches the tv on or off.  I can't find the commands as the sony tv remote is a plugin so i can't see the LUA script......unless im not looking somewhere?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi Kariem, 

    I actually just figured that out!  however......i have only been able use "power" which switches the tv on or off.  I can't find the commands as the sony tv remote is a plugin so i can't see the LUA script......unless im not looking somewhere?

    Well, I have several plugins (where I can not find the LUA as well, the KODI plugin for example). Lets check if you looked in the right place

    Please login or register to see this image.

    /emoticons/default_wink.png" alt=";)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

     

    If you go to your newly created Virtual Device where you want to "press the sony buttons". Go to advanced, and create an empty button. Select LUA code instead of the default string (radio button below the code entry screen). Right click in that code entry screen and look voor your Sony device. You will then see a list of command you can use. (you cannot click them, it is just an overview) 

    Link to comment
    Share on other sites

    • 0

    ok so i have just found that......i can click on them and it inserts

    fibaro:getValue(874, "ui.CHANNEL_UP_Button.caption")
    fibaro:getValue(874, "ui.VOLUME_UP_Button.caption")
     
    So obviously i can replace 'getvalue' with 'call'.  however, it doesn't work.  the "ui.CHANNEL_UP_Button.caption" seems odd?  
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  •  

    ok so i have just found that......i can click on them and it inserts

    fibaro:getValue(874, "ui.CHANNEL_UP_Button.caption")
    fibaro:getValue(874, "ui.VOLUME_UP_Button.caption")
     
    So obviously i can replace 'getvalue' with 'call'.  however, it doesn't work.  the "ui.CHANNEL_UP_Button.caption" seems odd?  

     

    UI is userinterface. Do you see any actions in the Sony VD list?

    Link to comment
    Share on other sites

    • 0

    yeah under actions is:

     

    fibaro:call(874, "setMute", "")
    fibaro:call(874, "setVolume", "")
    fibaro:call(874, "turnOff")
    fibaro:call(874, "turnOn")
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  •  

    yeah under actions is:

     

    fibaro:call(874, "setMute", "")
    fibaro:call(874, "setVolume", "")
    fibaro:call(874, "turnOff")
    fibaro:call(874, "turnOn")

     

    These you can use

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> If there are no more, maybe try creating the sony VD yourself.

    Link to comment
    Share on other sites

    • 0

    hmmm  they don't seem to work....the only one that works is "power".  i have zero clue about lua so im struggling!  i was hoping someone had created a sony VD.  problem with a plugin is you cant incorporate it into a scene!

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • hmmm  they don't seem to work....the only one that works is "power".  i have zero clue about lua so im struggling!  i was hoping someone had created a sony VD.  problem with a plugin is you cant incorporate it into a scene!

    You should be able to use them in scenes. When creating a scene, you can select virtual devices, and then the sony....  

    Link to comment
    Share on other sites

    • 0

    The Sony though isn't a VD. It's a plugin. So doesn't show up.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • The Sony though isn't a VD. It's a plugin. So doesn't show up.

    Same thing with Kodi plugin. And that one shows up

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" /> what kind of scene do you try to create? If i remembered correctly, the first trigger in creating a scene, can not be a "plugin" device. 

    Link to comment
    Share on other sites

    • 0

    For plugins you need to perform API calls just like the interface does. It is a workaround, but that's the only way so far, sorry. So you have to look up the action with Firebug plugin and perform the same one with Lua. There are multiple examples of such calls here on the forum, especially in Knowledge Base.

    Link to comment
    Share on other sites

    • 0

    Ok so this is the action (i think) for the volume up button from firebug......any idea the command i can use?

     

     

    <button id="element_874_VOLUME_UP_Button" class="com_fibaro_default_ButtonPlus" onmouseup="mainData.devices[874].buttonEvent('VOLUME_UP_Button','onReleased'); unregisterCancel(this)" style="height: 72.5px; width: 50.5px; margin: 4px; line-height: 73px;">

    Link to comment
    Share on other sites

    • 0

    So i have to actually send the command and watch in the firebug console what the action is?

    Link to comment
    Share on other sites

    • 0

    Yes, in order to get all the data needed (method, payload and url) you need to check the console while sending this very message.

    Link to comment
    Share on other sites

    • 0

    Hi, i appreciate your help thus far!  I am very new to LUA and coding etc.....

    when i look at the console in firebug, there isnt a s d pecific action that comes up, then if i look at the jquery there is a lot of stuff there that i can't necessarily find anything relating to the button im pressing.........are you able to point me in the right direction?

     

    thank you!

    Link to comment
    Share on other sites

    • 0

    For example clicking on VOL+ button on Sony Plugin results in sending GET request on this URL:

    Please login or register to see this code.

    So you have too look for lines like that.

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