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

Virtual Device - Which properties does it have?


perjar

Question

Hi,

 

I am wondering about the properties of a Virtual Device and how they can be accessed and changed.

 

For instance, if you want to change the icon of a VD you can use a statement like this:

Please login or register to see this code.

 

If you want to update a label text you would do:

Please login or register to see this code.

 

To my question then: Does anyone know of a complete list of properties applicable to a Virtual Device?

For instance: devices which report power consumption use the footer area to display current power usage. Can this area be accessed in a VD too? Someting along the lines of: 

Please login or register to see this code.

 

I am reading in Fibaro's documentation of the REST API about how to extract a list of all VDs and their properties/data. There are apparently properties like "caption", and "buttonIcon". The question is if and how these can be set via LUA code.

 

Thanks for any tips and hints.

/Per

 

 

  • Like 1
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
1 hour ago, perjar said:

To my question then: Does anyone know of a complete list of properties applicable to a Virtual Device?

For instance: devices which report power consumption use the footer area to display current power usage. Can this area be accessed in a VD too? Someting along the lines of: 

 

fibaro:log(“hello”)

  • Like 1
Link to comment
Share on other sites

  • 0
  • Inquirer
  • 14 hours ago, Jamie mccrostie said:

     

    fibaro:log(“hello”)

    Thanks a bunch Jamie!

     

    The message is temporarily displayed, for about 8-9 seconds, and then reset. By design apparently.

     

    In my case I have a VD which runs every 30 seconds using fibaro:sleep(30000) so I need to figure out a way to keep the message active in the log area.

     

    One option is to allow the VD to run every second and programmatically fix the 30 second sleep with an internal counter in the VD.

     

    Thanks!

     

     

    Link to comment
    Share on other sites

    • 0
    23 hours ago, perjar said:

    Thanks a bunch Jamie!

     

    The message is temporarily displayed, for about 8-9 seconds, and then reset. By design apparently.

     

    In my case I have a VD which runs every 30 seconds using fibaro:sleep(30000) so I need to figure out a way to keep the message active in the log area.

     

    One option is to allow the VD to run every second and programmatically fix the 30 second sleep with an internal counter in the VD.

     

    Thanks!

     

     

     

    Just put it in your VD main loop

    Link to comment
    Share on other sites

    • 0

    @perjar

    On 1-3-2018 at 4:57 PM, perjar said:

    I am reading in Fibaro's documentation of the REST API about how to extract a list of all VDs and their properties/data.

     

    This is a way to actually see all VD properties to get you started.

    When using Firefox:

    1. Install a JSON-viewer like 'KISaD JSON Viewer' (fast and simple).

    2. Open the VD General Tab.

    3. In the URL, replace     fibaro/en     by     api    ('en' is your current webUI language)

    4. Press [Enter]

    Link to comment
    Share on other sites

    • 0
    On 3/3/2018 at 8:41 AM, Jamie mccrostie said:

     

    Just put it in your VD main loop

    I have the same problem.

    My code is in the main loop, but it still dissapears after a short time, or when you refresh the browser.

     

    In the debugwindow, i see it is printing the timestamp over and over again:

     

    [DEBUG] 17:13:02: 16:54:54
    [DEBUG] 17:13:05: 16:54:54
    [DEBUG] 17:13:08: 16:54:54
    [DEBUG] 17:13:11: 16:54:54
    [DEBUG] 17:13:14: 16:54:54

     

    Piece of code from the mainloop:

     

    local hueTemperatureDeviceID = 3
    local hueMotionDeviceID      = 4
    local HUEkeukenPIR  = fibaro:getGlobal('KeukenPIR')   

    -- enter name of the user that you added to the HUE bridge
    local hueUser = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    -- enter icon ID's for corresponding status of the virtual device
    local iconOk          = 1028
    local iconalarm          = 1027
    local iconUnreachable = 1033
    local iconError       = 1034
    local debug           = false

     fibaro:debug(HUEkeukenPIR)
     fibaro:log(HUEkeukenPIR)

     

    I have no idea where to look anymore, anybody?

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