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

Display a temperature in a VD label?


Guest samuelboerhoop

Question

Guest samuelboerhoop

Which lua code do I use within a VD label to display a temperature from a multisensor from fibaro or aeon ?  

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Get sensor value by ordinary fibaro:getValue() and then use the example shown above main loop of virtual device to set label

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

Link to comment
Share on other sites

  • 0
Guest samuelboerhoop
  • Inquirer
  • in the main loop of the VD i put :
     
    -------------------------------------------------------------------------------------------
    --[[
    %% properties
    136 value 
    %% globals
    %% autostart
    --]]
     
    -- kill if already have an instance
    --if (fibaro:countScenes() > 1) then 
    --   fibaro:abort() 
    --end
     
    fibaro:call(18, "setProperty", "ui.flroomtemplbl.value", fibaro:getValue(136, "value"));
    -------------------------------------------------------------------------------------------------------------
    18 = virtual device number
    label name from this VD (18) = flroomtemplbl
    136 = ID from temp device (sensor)
     
    is this correct ? because at the moment my label is blank
     
    Do i need to add this code below in the main loop?
     

    -- kill if already have an instance
    if (fibaro:countScenes() > 1) then 
       fibaro:abort() 
    end
     
    ----------------------------------
    I got it to work
     
    fibaro:call(82, "setProperty", "ui.flroomtemplbl.value", fibaro:getValue(136, "value" ));
     
    in mani loop, wrong virtual device id = 82 instead of 18  

    Please login or register to see this image.

    /emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />
     
    BUT my label shows now 25,300000000001, 

     

    How can i display only one or two digits behind the comma ?

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    You need only one line:

    Please login or register to see this code.

    all the others are not relevant. To get precision you need try to change your line to:

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0
    Guest samuelboerhoop
  • Inquirer
  • That helps. thanks. and how do I add ℃ " (degree celcius) behind the temperature ?

     

    many thanks

    Link to comment
    Share on other sites

    • 0
    Guest samuelboerhoop
  • Inquirer
  • At this moment it shows

     

    "climate room : "

    next line 25.30"

     

    How can i bring "climate room and 25.3 in the same line as in :

     

    Climate Room     25.30 C

     

    I might even think that this is a software bug!

     

    In the iphone app is shows with two "::" as in "Climate Room :: 25.30

     

    the label in the iphone app is outlined to the left version 2.6

    In the iphone app it also needs to be outlined left and right in the column, see photo's

     

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    At this moment it shows

     

    "climate room : "

    next line 25.30"

     

    How can i bring "climate room and 25.3 in the same line as in :

     

    Climate Room     25.30 C

     

    I might even think that this is a software bug!

     

    In the iphone app is shows with two "::" as in "Climate Room :: 25.30

     

    the label in the iphone app is outlined to the left version 2.6

    In the iphone app it also needs to be outlined left and right in the column, see photo's

    I am wondering about the same. When i add mine i get the value with a lot of digits, how can one reduce the number of digits displayed in a virtual device label? Mine shows up like this: Temp Inne: 22.800000000000001

     

    And how can i display the unit at the back? i have tried :

    Please login or register to see this code.

    But i get [ERROR] line 2: ')' expected near '"unit"'

     

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
    Guest samuelboerhoop
  • Inquirer
  • As above: fibaro:call(82, "setProperty", "ui.flroomtemplbl.value", '\"' .. fibaro:getValue(136, "value") .. '\"')

    this worked for me

    As 82 - Virtue ID

    and 136  - Temperature ID

     

    hope it works out for you

    Link to comment
    Share on other sites

    • 0
    Guest samuelboerhoop
  • Inquirer
  • How do I add ℃ " (degree celcius) behind the temperature ? of the following code:

     

    fibaro:call(82, "setProperty", "ui.flroomtemplbl.value", '\"' .. fibaro:getValue(136, "value") .. '\"')

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