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

Question

Posted (edited)

Hi
There is a lot of posts about icons, but i could not find any that properly describe how can one upload some icons to HC3 from external sources.
We have a lot of installations, and we use a lot of quickapps everywhere. We also have some custom icons for plugins, but when we install a new system and upload the new plugin, we can't upload the icon with the plugin. While we are personally at customer's house, we can do the regulat way using GUI to add new icons, but many times we need to remotly update some icons when we remotly install some quickapp. So i could not find any way how to upload icons from external source to the HCs system so i can then use them for some devices.
The API documentation is very very poor, so it is almost impossible to do it by just guessing what format, what argumetns etc to use
Did anyone have some luck with this?

Edited by Neo Andersson

16 answers to this question

Recommended Posts

  • 0
Posted

Why are you not using (inside the QA): 

self:updateProperty("deviceIcon",iconDefault)

where iconDefault is the ID of the icon like 1293?

 

But if you want to do this upgrade out of the targeted QA that's an other story...
There is a POST http command which seems to be(see note below):

https://IP_HC3/api/devices/ID_QA/action/setIcon

with arguments that include 

- access token or basic authorization

- base64 encoded image string changed to a json file i.e. :

You need first to upload to your png image(image_data)...

 

function base64encode(data
      __assert_type(data,"string")
      local bC='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
      return ((data:gsub('.', function(x)
              local r,b='',x:byte() for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
              return r;
            end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
            if (#x < 6) then return '' end
            local c=0
            for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
            return bC:sub(c+1,c+1)
          end)..({ '', '==', '=' })[#data%3+1])
    end
 

local api_url = "https://192.168.1.50/api/devices/123/action/setIcon"

Please login or register to see this code.

Please login or register to see this code.

Please login or register to see this code.

Then send to HC3:

Please login or register to see this code.

Please login or register to see this code.

 

Please login or register to see this code.

I have not yet tested it but it seems possible...

Hope it helps

 

Note: I am sure that this may be easier using PLUA of @jgab but you need to be local with the HC3

  • 0
  • Inquirer
  • Posted

    well, thats my bad..i consturced my goal a bit idiot way :-)
    I need to get our own icons from our server to a customer's HC3
    so whe we install our plugins some function would run inside that would fetch an icon from our server and upload it to hc..i thinkg this is not possible

    • 0
    Posted (edited)
    8 minutes ago, Neo Andersson said:

    well, thats my bad..i consturced my goal a bit idiot way :-)
    I need to get our own icons from our server to a customer's HC3
    so whe we install our plugins some function would run inside that would fetch an icon from our server and upload it to hc..i thinkg this is not possible


    I know this is 100% possible :D I just dont know how.
    But I know the Heatit Renergy Quickapps does this :D 


     

    8 minutes ago, Neo Andersson said:

    well, thats my bad..i consturced my goal a bit idiot way :-)
    I need to get our own icons from our server to a customer's HC3
    so whe we install our plugins some function would run inside that would fetch an icon from our server and upload it to hc..i thinkg this is not possible


    And here is a QA made by jgab that upload base64 icons :D 
    Maybe this will help you? :)

     

    Edited by Brors94
    • Like 1
    • Thanks 1
    • 0
    Posted (edited)
    On 2/7/2026 at 10:52 PM, Neo Andersson said:

    need to get our own icons from our server to a customer's HC3

    If your pluging is using a single Icon, may be possible but multiple icon set like for Binary switch or shutter: Oops🥶

    Due to HC3 evolution and backward compatibility, icons are not saves the same way depending of its ID or type; I have wrritten a QA to view all existing Icons in my HC3 but I am not sure that it can found all of them

    Attached if you want to test it

     

    Please login or register to see this attachment.

    Edited by Christb
    New version includinf Room & Scene icons
    • 0
    Posted
    15 hours ago, Brors94 said:

    And here is a QA made by jgab that upload base64 icons :D

    I was unable to find this post again, thank you (for information it is page 78)

    • Like 1
    • Thanks 1
    • 0
    Posted
    On 2/7/2026 at 8:56 PM, Christb said:

    have not yet tested it but it seems possible..

    I have changed a little my https request to make the test, as below:

    local device = 758

    local integrationPin = "xxxx"

    local payload_table = {icon = "data:image/png;base64," .. icon_b64}

    local json_payload = json.encode(payload_table)

    local api_url = "http://"..hc3_ip.."/api/devices/"..device.."/action/setIcon"

    http:request(api_url,{
                              options={
                                      method="POST",
                                      checkCertificate=false,
                                      headers={
                                        ["Authorization"] = "Basic "..bearer_token,
                                        ["Content-Type"]  = "application/json",
                                        ["Accept"] = "*/*",
                                        ["delay"] = "30",
                                        ["integrationPin"] = integrationPin,
                                                },
                                      data=tostring(json_payload)
                                      
                                      },
                                      success = function(r) if type(r.data)=="table" then print("Status",r.status,"Data ->",json.encode(r.data)) else print("Status",r.status,"Data :",r.data) end end,
                                      error = function(err) print("ERR:",err) end
                      }
                  )

    And I am getting the following answer:

    Status 202 Data -> {"endTimestampMillis":1770655284534,"message":"Accepted","startTimestampMillis":1770655284527}

    wich means accepted and delayed as in Swagger Status of such request can be only 202,400,403 or 404.

     

    But the icon is not changed so I have not any clue what HC3 is doing with the above request: If some one knows ?

    • 0
    Posted
    On 2/9/2026 at 6:29 PM, Christb said:

    have not yet tested it but it seems possible.

    YES, IT IS POSSIBLE but not with my previous lua code1 using https but with a PowerShell scrip 😄, not originaly written by me 🤧, that I just update. I am also trying to make a user manual.

    I am right now testing it and have succesfully been able to:

    • Backup on my PC all my HC3 icons by type(com.fibaro.<type>) i.e. 188 icons
    • Load a 'test_Icon.png' that I just created using GIMP into a test QA type 'com.fibaro.deviceController' with single icon changed from User1236 to User1240 (new id created for test_Icon.png) 

    I need now to test the following:

    1. Upload of sets of icons User<id>0 and User<id>100f or a binary switch - code done but not yet tested,
    2. Upload the 11 icons needed for a com;fibaro.multilevelSwitch but I am confident - code done but not yet tested,
    3. Restore all backup Icons back to the HC3 (may not be needed) - code done but not yet tested.

    When the above tests done succesfuly, I will need to add to the script the action to remotely update the QA displayed icon(s) - code to be written from scratch; not a big deal but I am just learning PwS code

     

    1 I have asked Fibaro support why it is not giving any result and hope their answer to be done via this post.

    • 0
    Posted

    🙂

    1 hour ago, Christb said:

    I need now to test the following:

    All 3 tested and ok: single, dual or multiLevel new icons uploaded in QA and useable🙃.

     

    I will start to write the user manual but I need first to add into the script how to change the curent deviceIcon id for the QA,remotely.

     

    If someone has already wrote an https request for changing the Icon id, I will appreciate to get it and I will try to make it compatible to a PowerShell script.

    • Like 2
    • 0
    Posted

    Some news: I have finished to modify the Python script and now it can do the following 4 tasks:

    • 'backup': Saving to a server directory all HC3 icons by device type,
    • 'restore': Restoring from server all HC3 icons using the above backup directory,
    • 'load': upload new sets of icons to one or more devices, 
    • 'updateALL': Change current device icon in which a new icon has been uploaded to the new one,
    • 'updateOne': Change the icon of device ID to  icon id xxxx (Userxxxx).

    I will publish it this week when all tests are completed with an user manual and some icons to test the 'load' task.

    • Like 1
    • 0
    Posted (edited)

    As promized, please find here the following files (zipped)

    • Python script HC3IconMgrV1.10.py
    • HC3IconMgrSettings - example.json 
    • HC3IconManager U_Manual.pdf
    • A set of icons to test
    • An example of the global variable in g_Icons2Load.json 
    • The lua code in QAExampleCode1.1.10.lua

    Best practice is:

    - first read the user manual,

    - update the HC3IconMgrSettings - example.json and rename it "HC3IconMgrSettings.json",

    - Try first the 'save' task,

    Then have fun with other tasks... 

     

    Warning: There are some issues loading a new icon set to a Zwave device: I will try to fix that and let you now. But the script isworking well

    Please login or register to see this attachment.

    for loading new icon sets for QAs

    Please login or register to see this attachment.

    Edited by Christb
    Add a Warning
    • 0
    Posted (edited)
    17 hours ago, Christb said:

    Warning: There are some issues loading a new icon set to a Zwave device: I will try to fix that and let you now. But the script isworking well

    Please login or register to see this attachment.

    for loading new icon sets for QAs

     

    Well, I test again the version V1.10 for a Zwave device and it is working😄.

    My warning came when I found a bug I introduced in the new version I am working on (Adding room icons management).

     

    Just let me know if loading with V1.10 a new icon set to a Zwave is also OK for you.

    Edited by Christb
    • 0
    Posted (edited)

    An error in the format needed to scan *.png images in a directory was wrong so the task 'restore' was almost doing nothing🤧

    Changing theformat with a python 3.14 compatible format it is now working fine.🙂

    Attached new version V1.11 and new user manual.

      

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Edited by Christb
    • 0
    Posted

    I had since a long time willing to know wat are the existing icons that Fibaro includes in the HC3.

    I already did a QA to display all User icons (device, room, scene) but also the iconSets icons that you can only get using the api.get(“/icons”) inside a QA.

    With the experience of the HC3IconsMgr.py, I have written a new Python scrip called ‘displayHC3Icons.py’ which this time is a comprehensive program to display all HC3 Fibaro and User icons.

    It will allow you to do the following:

    ·         python displayHC3Icons.py Device
    which is displaying all Fibaro and User’s icon for Device of svg or png type using a user declared web browser.

    ·         python displayHC3Icons.py Room
    which is displaying all Fibaro and User’s icon for Room of svg or png type using a user declared web browser.

    ·         python displayHC3Icons.py Scene
    which is displaying all Fibaro and User’s icon for Scene of svg or png type using a user declared web browser.

     

    You can add one argument to the 3 above command lines in adding at the end an integer, value > 0 which will give the interval between 2 successive images in second; if missing default value is 5s.

    For information, the number of displayed icons by Id is set by following rules:

    ·         if ‘id’ is of kind ‘unary”: just one, named ‘iconName.ext’

    ·         if ‘id’ is of kind ‘binary”: two icons, named ‘iconName0.ext’ and ‘iconName100.ext’

    ·         if ‘id’ is of kind ‘multi”: eleven icons, named ‘iconName0.ext’, ‘iconName10.ext’, ‘i iconName20.ext’, ‘iconName30’, ‘iconName40.ext’, ‘iconName50.ext’, ‘iconName60.ext’, ‘iconName70.ext’, ‘iconName80.ext’, ‘iconName90.ext’ and ‘iconName100.ext’

    ·         if ‘id’ kind is an integer, it will display the number of icons that are defined in a file called ‘iconSetTable.json’; see specific chapter in the user manual.

    Three other tasks are possible:

    •         python displayHC3Icons.py getOneId <iconType> <id>

    This allows to display just one icon in your default web browser but you need to specify first which ‘iconType’ your id is, i.e. Device, Room or Scene.

    Number of displayed icons will follow above kind value.

    •         python displayHC3Icons.py iconType <id>

    This program is done for device id for which “device Type” are not yet known in the file ‘displayIconKind.json’: it will try to display all possible icons, using the kind ’multi’ by default, opening a browser page by icon; the number of real images, i.e. different from , displayed will give you the kind type at the exception of any new id which is in iconSet.json file; see later.  

    •  

       python displayHC3Icons.py saveFibaro <iconType>  <ext>

    This command has a mandatory argument: <Device>, <Room> or <Scene> and optional argument: <png> or <svg> which then will only save the declared type, if absent, both png and svg type will be saved. It will save only Fibaro icons.

    During the saving process, the http address for the image will be printed in the PS console as well has it icon Id; the program will create for each ‘deviceType’ a corresponding directory in which the number of saved icons will follow the king value for the id.

    Warning, if the number of icon ids in your HC3 is around 1200, the number of saved icons may be over 2400 depending id’s kind. Don’t forget to check the needed disk space: around 10k per png image and 4k per svg image.

    For my HC3 a little more than 16Mo are necessary - 1182 ids there off 589 devices, 148 rooms and 175 scenes.

    You will find attached 4 files:

    displayHC3Icons.py: python script,
    displayHC3Icons.py v0.2.5_User Manual.pdf,
    IconKindDisplay.json: defining the kind of all devicesType I know,
    IconSetTable.json: File giving http address of the 19 specil ids.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    • 0
    Posted

    Please login or register to see this code.

     

    Suported device types:
    ["com.fibaro.energyMeter"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.humiditySensor"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.powerSensor"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.energyMeter"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.temperatureSensor"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.windSensor"] = QuickAppBase.iconProviders.single,
    -- binary actors
    ["com.fibaro.binarySwitch"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.doorLock"] = QuickAppBase.iconProviders.binary,
    -- binary sensors
    ["com.fibaro.binarySensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.doorSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.floodSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.smokeSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.windowSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.motionSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.rainDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.heatDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.gasDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.coDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.fireDetector"] = QuickAppBase.iconProviders.binary,
    -- multilevel actors
    ["com.fibaro.multilevelSwitch"] = QuickAppBase.iconProviders.multilevel,
    ["com.fibaro.rollerShutter"] = QuickAppBase.iconProviders.multilevel,
    -- other
    ["com.fibaro.deviceController"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.genericDevice"] = QuickAppBase.iconProviders.single

     

    Sample usage:

    Please login or register to see this code.

     

     

    • 0
  • Inquirer
  • Posted
    23 hours ago, m.roszak said:

    Please login or register to see this code.

     

    Suported device types:
    ["com.fibaro.energyMeter"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.humiditySensor"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.powerSensor"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.energyMeter"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.temperatureSensor"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.windSensor"] = QuickAppBase.iconProviders.single,
    -- binary actors
    ["com.fibaro.binarySwitch"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.doorLock"] = QuickAppBase.iconProviders.binary,
    -- binary sensors
    ["com.fibaro.binarySensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.doorSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.floodSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.smokeSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.windowSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.motionSensor"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.rainDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.heatDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.gasDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.coDetector"] = QuickAppBase.iconProviders.binary,
    ["com.fibaro.fireDetector"] = QuickAppBase.iconProviders.binary,
    -- multilevel actors
    ["com.fibaro.multilevelSwitch"] = QuickAppBase.iconProviders.multilevel,
    ["com.fibaro.rollerShutter"] = QuickAppBase.iconProviders.multilevel,
    -- other
    ["com.fibaro.deviceController"] = QuickAppBase.iconProviders.single,
    ["com.fibaro.genericDevice"] = QuickAppBase.iconProviders.single

     

    Sample usage:

    Please login or register to see this code.

     

     

    @m.roszak Michal thats great..but as far as i see, there is no possibility to assign the icon right to a device type?? it will alway assaign the icon to the type of the calling quickapp???
     

    • 0
    Posted

    Yeah, its designed to pull the icons to the type you are currently using.

    We can thing about something more generic.

    • Thanks 1

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