set subcategory_num for a preconfigured device to change icon

Hi Everyone,

I have a Aeotec ZW116 device that controls a light bulb. Ideally, I’d like the icon to show as a light bulb. (right now it shows as a receptacle)

I’ve learned I can change this by manually setting the subcategory_num to a “0” instead of it’s default value of “3”

Problem is, every time luup reloads, it resets to “3”. Vera tech support told me pre-configured devices always have their default values resent every time luup reloads.

I know the serviceid for this device is “urn:schemas-upnp-org:device:BinaryLight:1”
and the deviceId is 21

How can I setup some luup code that would automatically set the sub_category of this device to a “0” every time luup reloads.? Anyone done something like this?

Try placing this line in Lua Startup…

luup.attr_set ("subcategory_num", 3, 21)

[quote=“akbooer, post:2, topic:200486”]Try placing this line in Lua Startup…

luup.attr_set ("subcategory_num", 3, 21) [/quote]


I love the way you masters can super simplify stuff for a newbie ;D. I put this into the “Edit Startup Lua” section and now the device shows a light bulb, and seems to be surviving luup reloads as intended.

luup.attr_set ("subcategory_num", 0, 21)

Thanks akbooer!

It does so, because it is, of course, run after every restart!

Thanks akbooer!

You’re welcome.

How can I do this for all philio pan 06 devices?

If you know the device type, it’s easy to loop through the device list and set the subcategory_num, or anything else that you wish…

for i,d in pairs (luup.devices) do
  if d.device_type == "whatever-device-type-you-need" then
    luup.attr_set ("subcategory_num", 0, i)  -- perhaps some other value than 0

The proper device type will look something like: