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

Help! How to change icons with REST API HC3


Question

Posted

           Hi everybody, i was tried to change the icon of a QA that i created  but i don´t understand how to use all API REST documentation yet (more precisely the sintax to api.put(), api.post(), api.get() to change, create, and obtain icons of the system, don´t understand the sintaxis). I want to do that when i press down the ON QA button the icon change and when i press down the OFF QA button toggle to another icon. I attach the image of QA below where i must to insert the code to change the icon (alse add QA file to post) Your help would be greatly appreciatly. Thank you.

 

Please login or register to see this attachment.

Please login or register to see this attachment.

13 answers to this question

Recommended Posts

  • 0
Posted

Hi @Herni ,

 

changing icons of the QA normally should not be that difficult, but it depends on what type of QA you used for your QA. In this case if it is just an ON/OFF QA device then you should use as device type "Binary switch". Then you can upload to the QA device two icons for ON and OFF state and they will show when you change state of the QA device.

 

lately with last HC3 firmware updates some of the QA devices types do not show icon change such as "player" and "Weather", but I hope that Fibaro will correct this in the next update.

 

  • Like 1
  • 0
  • Inquirer
  • Posted
    54 minutes ago, Sankotronic said:

    Hi @Herni ,

     

    changing icons of the QA normally should not be that difficult, but it depends on what type of QA you used for your QA. In this case if it is just an ON/OFF QA device then you should use as device type "Binary switch". Then you can upload to the QA device two icons for ON and OFF state and they will show when you change state of the QA device.

     

    lately with last HC3 firmware updates some of the QA devices types do not show icon change such as "player" and "Weather", but I hope that Fibaro will correct this in the next update.

     

     

     Hi @Sankotronic Thank for your response. I think that the QA is Binary switch don´t remember that type i choose when i created it. But yes, the QA must turn ON/OFF a list of TV selected from the drop down list.  

    • 0
    Posted

    And also you have to change QA value to ON or OFF when pressing buttons. Usually there is original code that already does this and you need just to add your own code to do something else. It should then also change the icon depending on the on/off state.

    • 0
  • Inquirer
  • Posted
    10 minutes ago, Sankotronic said:

    And also you have to change QA value to ON or OFF when pressing buttons. Usually there is original code that already does this and you need just to add your own code to do something else. It should then also change the icon depending on the on/off state.

     

    1 hour ago, Herni said:

    i was tried to change the icon of a QA that i created  but i don´t understand how to use all API REST documentation yet (more precisely the sintax to api.put(), api.post(), api.get() to change

     

           Yes, i have tried to use the api.get(/icons) but i don´t know how to use it to get icons table of the system and aftet that obtain the icon that i need. Or how to upload a new icon with api.post(). Mainly my problem is i don´t know what path i must to pass to the function argument to get an icon o upload a new icon. I was looked at the HC3 Rest API to learn how to that but i had not success. 😕

    Just now, Herni said:

     

     

           Yes, i have tried to use the api.get(/icons) but i don´t know how to use it to get icons table of the system and aftet that obtain the icon that i need. Or how to upload a new icon with api.post(). Mainly my problem is i don´t know what path i must to pass to the function argument to get an icon o upload a new icon. I was looked at the HC3 Rest API to learn how to that but i had not success. 😕

     

    Please login or register to see this link.

    • 0
    Posted

    @Herni you can use self:updateProperty("deviceIcon", iconnumber) to change the icon.
    You can upload the icons with the gui. Use the standard option to upload. 

    Give a right mouse click on the uploaded icon, save as, and you can see the number.

    Use that number to update the deviceIcon property. 

    • 0
    Posted (edited)

    Hi @Herni ,

     

    you do not need to use REST API to change QA icon. Depending on QA type, e.g. "binary switch" it is enough to first upload pair of icons that you want to use to the QA:

    Please login or register to see this spoiler.

     

    After that when you change QA state with following command:

    Please login or register to see this code.

     

    This is native to "binary switch" QA so no extra command is necessary.

     

    In case of some other QA (currently on firmware 5.160.42 and beta 5.161.15 does not work for QA type "weather" and "Player") you can use command:

    Please login or register to see this code.

     

    to change QA icon where icon_ID must be replaced with number which you can find by right clicking on icon and on menu opened selecting option "Save image as..." and in opened save window you will see icon name: "User1001.png". Number in the name is actually icon ID that you need to replace icon_ID in the above command.

     

    In my case, I upload icons using browser locally connected to the HC3.

    Edited by Sankotronic
    • Like 1
    • 0
  • Inquirer
  • Posted
    1 hour ago, SmartHomeEddy said:

    @Herni you can use self:updateProperty("deviceIcon", iconnumber) to change the icon.
    You can upload the icons with the gui. Use the standard option to upload. 

    Give a right mouse click on the uploaded icon, save as, and you can see the number.

    Use that number to update the deviceIcon property. 

     

             Oh sure!!! I forget that 😖. Is the way more easy to upload icon. After that i must to use the self:updateProperty( ) command that i usually use to control slider, buttons objects, to change the icon. Thank so much @SmartHomeEddy

    • 0
  • Inquirer
  • Posted
    1 hour ago, Sankotronic said:

    Hi @Herni ,

     

    you do not need to use REST API to change QA icon. Depending on QA type, e.g. "binary switch" it is enough to first upload pair of icons that you want to use to the QA:

    Please login or register to see this spoiler.

     

              Hi @Sankotronic yes i forget this. First I upload the icon with GUI used the standard way (As @SmartHomeEddy mentioned above) and then i use self:updateProperty method to change the icon. Thanks to both guys!!!

    • 0
    Posted

    I have one question not linked to Icon but button label we have on a BinarySwitch QA ?  they are named Turn ON  / Turn Off, but i would like to change them ? how it is possible ?

    thanks

    • 0
    Posted

    Hi @SakkhhoID ,

     

    I guess it is translated to the language that is selected on HC3 General settings Main tab, or not? 🤔 Didn't really tested myself since I keep English as main language on my HC3.

     

    • 0
    Posted

    So it is not possible to change these names ?

    • 0
    Posted
    2 hours ago, SakkhhoID said:

    So it is not possible to change these names ?

     

    Hi @SakkhhoID ,

     

    As far as I know it is not possible. Maybe there is a way, but Fibaro didn't reveal how it can be done.

    BTW - At the end I tested few QA types if will be translated when HC3 language is changed, but translations are not completed yet.

    • 0
    Posted

    ok thanks, it is a bit strange that we cannot change a label ...

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