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

[VD] HC2 Icon preview {v1.0}


Sankotronic

Question

[VD] HC2 Icon preview v2.1

 

Dear Fibaro friends!

 

As you know, the worst part of importing and setting up virtual devices is finding icons ID's. How many times you noticed my VD's here with beautiful icons ;-)  , but when you imported it all beauty is gone and there is just that ugly, blue box :-( And then even when you manage to import those beautiful icons of mine :-D then what? In code you have to setup some iconID but where to find that?

 

Well, the time finally came to put us all to the end of that misery!!! Here it is, HC2 Icon Preview VD in its glory:

Please login or register to see this spoiler.

 

This latest version can be found here for download:

 

Enjoy coding! :-) 

 

 

Edited by Sankotronic
New version published in download section
  • Like 5
  • Thanks 1
Link to comment
Share on other sites

Recommended Posts

  • 0

I'll have to get back to you about that example when I get my garage door control hardware installed.

Link to comment
Share on other sites

  • 0
51 minutes ago, clowg said:

I'll have to get back to you about that example when I get my garage door control hardware installed.

 @clowg

 

here is another idea for you

This is our Playroom remote control and the icon display the status

 

TV on

 

Please login or register to see this image.

/monthly_2017_04/58f35f3d18aa3_play3.PNG.6b529a3c02b8a4f4e6cb3d05126a3bfb.PNG" />

 

Music Playing

58f35f3d65560_play2.PNG.26f6c244eb3eec3adc8e4ac6f6922325.PNG

 

TV and Music off

58f35f3d8e355_play1.PNG.1a3e2c8ad3959ec2efc988ac46105c41.PNG

 

and the full remote

 

Please login or register to see this attachment.

 

Edited by AutoFrank
Link to comment
Share on other sites

  • 0
1 hour ago, Sankotronic said:

 

Thank you @annhan91

 I had a quick look at the api and I'm not sure it supports a delete action but hopefully I'm wrong ;)

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 1 hour ago, AutoFrank said:

     I had a quick look at the api and I'm not sure it supports a delete action but hopefully I'm wrong ;)

     

    You are right @AutoFrank, there is no other action through REST API for icons except getting their info, but @annhan91 is not using that approach but Het.Fhttp to authenticate and then tcp call to play with icons. Very interesting solution! Only I wish now I have another HC2 to play with this code since I don't really want to delete to my working system.

     

    It seems if I continue to do stuff I do, I will need one developer HC2 with which I can play :-) 

    Link to comment
    Share on other sites

    • 0

    Hi Sankotronic,

     

    I will also say thank you for sharing all that cool stuff. The VD will save me a lot of time. The icons are not well sorted in my HC2.;( 

    The smartest things that work in my HC2  are from you. :D For the translations I was unfortunately too late :( . If you need more translations for the german language in the future I will try to help you. Many many thanks from my side 

     

    P.S. In june i will visit your beautiful country again.

     

     

    Link to comment
    Share on other sites

    • 0

    Thanks @Sankotronic, just used this for the first time.

    Works like a charm and soooo much easier then inspecting elements in Google Chrome!!

     

    Jim

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @FunkFib and welcome to Fibaro forum!

     

    I'm glad that you like some of my work. I hope there will be more soon. Regarding translations, there will be more to translate in future so you are not too late and your help will be much appreciated.

     

    If you plan to visit Croatia in first half of June then you will be more than welcome to visit my humble home if it will be on your way to your destination. We can get in touch over PM.

     

     

    Link to comment
    Share on other sites

    • 0
    Guest andyhud

    Thanks Sankotronic, this is just amazing! So much credit for your hard work!!

     

    I have created the VD and can scroll through the icons no problems, however can I apply one to a "Device"? I have an Aeon Labs Smart Switch for my Washing Machine and would like to use the Washing Machine Icon (22) for it. Other than saving the icon to my desktop then adding it to the device, can it be added another (and better) way?

     

    Thankyou !

     

    Andy

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi Andy,

     

    This current version of Icon Preview can't set icons to other devices or VD. New version of Icon Preview & Setup can setup icons for VD's that are using my new setup system. Unfortunately that new setup system i still haven't released due to some limitations and problems caused by HC2 that I have to overcome. 

    Link to comment
    Share on other sites

    • 0
    Guest andyhud
    4 minutes ago, Sankotronic said:

    Hi Andy,

     

    This current version of Icon Preview can't set icons to other devices or VD. New version of Icon Preview & Setup can setup icons for VD's that are using my new setup system. Unfortunately that new setup system i still haven't released due to some limitations and problems caused by HC2 that I have to overcome. 

    Hi Sankotronic

     

    Understood and thanks for the clarity... so to set an icon for a "device" I can just save the image out of HD Icon Preview and just add it manually?

     

    Thanks again

     

    Andy

     

     

    Link to comment
    Share on other sites

    • 0

    Hello, i just try to change the Icons in my VD by using the following code:

     

       local ThisDeviceId = fibaro:getSelfId();
             debug("silver", 'This devicenumber is :' .. ThisDeviceId);

             fibaro:call(ThisDeviceId, "setProperty", "currentIcon", 1057);

     

    but i also get the message:

    [DEBUG] 09:48:44: line 51: attempt to call method 'getSelfId' (a nil value)

     

    can somebody help me - what's wrong?

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @Cannon_82 and welcome to Fibaro forum.

     

    I can only see problem in second line:

    Please login or register to see this code.

    debug is reserved word in LUA. Do you have function that is called like that and it uses colors? If yes, then there is problem with "silver" color. There is no silver color, but "grey" or "white". 

    Link to comment
    Share on other sites

    • 0

    Hello Sankotronic, thanks for your answer. i use a extra debug function:

     

    -- debug-function
    function debug( color, message )
     fibaro:debug(string.format('<%s style="color:%s;">%s<!--%s-->', "span", color, message, "span"));
    end

     

    i use different web-colors in other scenes like "darkorange", "orangered" and many other. These colors were use correct in the debug messages.

     

    i also try the code in a completely new scene without the debug entry and nothing else. there came also the error.   :-( 

     

     

    And thank you for the great work. Your scenes and VDs are great - Keep it up!

    Edited by Cannon_82
    formating
    Link to comment
    Share on other sites

    • 0

    My fault! I try it in a scene, not in a virtual device.   o.O

     

    Thanks for the help.

     

    is there any possibility to change the icons of scenes?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 12 hours ago, Cannon_82 said:

    My fault! I try it in a scene, not in a virtual device.   o.O

     

    Thanks for the help.

     

    is there any possibility to change the icons of scenes?

     

    Hi @Cannon_82,

     

    there is a way to change scene icons, but change will not show until web GUI page is refreshed or network data reloaded in mobile app so there is no much use of it. At least that is information I have.

    Link to comment
    Share on other sites

    • 0

    I can only agree with previous speakers that this is a very useful VD! Impressive piece of work.

     

    On a side note: I am curious about the concept of storing a table in a global variable. This changes everything! I mean, the standard functionality for global variables in the HC2 is quite lobotomized as it can only handle numbers and fixed values, no strings or data structures.

     

    The mechanism for creating a global variable if it does not exist is an eye-opener for a newbie like me. 

     

    A question then: Are these things documented somewhere so I can read about how this works or have  you used trial-and-error to find out how it works?

     

    Thanks for the great code and the inspiration!

    Per

     

     

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @perjar,

     

    There is no official explanation of how to create global variables from LUA code but I find a way thanks to help from this forum members. This community here is great and wiling to help.

     

    I have posted here procedure how to add different types of global variables using LUA code and also how to store and read LUA table data to global variables. You can find that post here:

    BTW that code can be used in both VD Main loop and LUA scene.

     

    Hope that this helps

    Enjoy coding :-)

     

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