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

How to retrieve the name of the room for a given device?


Krikroff

Question

Hi,

Anyone knows the function?

For the device name it's fibaro:getName(deviceID);

But I need to concatenate room name with device name...

I would eternally grateful

Please login or register to see this image.

/emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

You can from a virtual device get the name

Please login or register to see this code.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • You can from a virtual device get the name

    thank you very much for your reply jompa68, I thought this solution but it is not very optimized (and sexy) in a loop eg.

    i need a native function.

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    Link to comment
    Share on other sites

    • 0

    I made do with the room id from getRoomID and looked up a name in a table of names in my code ordered the same as rooms.

    Not sexy either but could not find a nice way.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I made do with the room id from getRoomID and looked up a name in a table of names in my code ordered the same as rooms.

    It's a good idea, thank you robmac. But if Fibaro can add a native function to handle this.

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 0

    +1.

    a few other missing calls getDevices to return a table of devices? Net/json API is great for integration but clunky for internal programming .

    Link to comment
    Share on other sites

    • 0
    a few other missing calls getDevices to return a table of devices?

    accepted, maybe will be in next beta

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • accepted, maybe will be in next beta

    You're the boss Andrew

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" /> , thank you for your efforts and for your attention.

    All the best.

    Link to comment
    Share on other sites

    • 0
    accepted, maybe will be in next beta

    You're the boss Andrew

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" /> , thank you for your efforts and for your attention.

    All the best.

    Are you sure it is not Adam

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Thanks Andrew very nice.

    Link to comment
    Share on other sites

    • 0

    Hi, i've found a way if you have HomeTable implemented:

     

    I don't know if this performs better than calling the API:

     

    local jT = json.decode(fibaro:getGlobalValue("HomeTable"));

     

    function getRoomName(roomID)
      for i, v in pairs(jT) do
        if v.ID == roomID then
          return i;
        end;
      end;
    end

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