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

Cant change deviceicon anymore from API?


Question

Posted

Hi

Anyone has any infi why this doesn't work? Role and Categroy got changed, but the icon never.

It was working for me so far

 

 

Please login or register to see this code.

 

4 answers to this question

Recommended Posts

  • 0
Posted (edited)

@Neo Andersson

this works for me:
 

api.put("/devices/" .. self.id, {properties = {  deviceIcon = 1002 } })

But not yours with categories and devicerole 

But the categories or devicerole dosent work either for me🤔

 

ill use this to update them:

  self:updateProperty("deviceRole", "Other")
  self:updateProperty("categories",{"other"})

 

 

Aha :D
this is the syntax for it to work :D
 

 

api.put("/devices/" .. self.id, {properties = { categories = {"other"}, deviceRole = "Other", deviceIcon = 1001 } })

 

brackets at the categories since it is multiselect :D

 

Edited by Brors94
  • Thanks 1
  • 0
  • Inquirer
  • Posted

    Dont you know by chance, how can i set using api call, that the device will use the old view and not the new one?

     

    Please login or register to see this image.

    /monthly_2025_09/image.png.6db8bc0642af51dfbedb03289c03e9d8.png" />

    • 0
    Posted
    2 hours ago, Neo Andersson said:

    Dont you know by chance, how can i set using api call, that the device will use the old view and not the new one?

     

    Please login or register to see this link.

     

    I used to use this:

      self:updateProperty("useUiView",false)
      self:updateProperty("hasUIView",false)

     

    But this is bugged now it seems like...

    But this works now :D  (It restart the QA!) 
     

      local ui_view = api.get("/devices/"..self.id.."")
      print("hasUIView: ",json.encode(ui_view.hasUIView))
      print("useUiView: ",json.encode(ui_view.properties.useUiView))
      if ui_view.properties.useUiView == true then
      api.put("/devices/" .. self.id, {properties = {  useUiView = false } })
      end

     

     

     

     

    • Thanks 1
    • 0
    Posted

    Thanks @Brors94 for this, I will update my QA's to ensure Web and App view compatibility thanks to you.

    Just wanted to point out that "ui_view.hasUIView" is of no use (it's a read-only property and cannot be changed anyway), so I was wondering why you output it with print() ?

    Only "ui_view.properties.useUiView" can be changed.

     

    I modified it to fit my need like this :

     

    Please login or register to see this code.

     

    Now it will debug any case, and even handle the absence of the property (as I am unsure whether it's available or can be modified by api.get() on Z-Box Hub or Venture WISE).

    This makes it compatible with all HC3-like boxes as well.

     

    Hope it's of any use to other users 😃

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