We have moved at community.getvera.com

Author Topic: set subcategory_num for a preconfigured device to change icon  (Read 293 times)

Offline connormacleod

  • Sr. Newbie
  • *
  • Posts: 28
  • Karma: +2/-0
set subcategory_num for a preconfigured device to change icon
« on: January 24, 2019, 10:38:21 am »
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?


Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: set subcategory_num for a preconfigured device to change icon
« Reply #1 on: January 24, 2019, 10:53:24 am »
Try placing this line in Lua Startup...

Code: [Select]
luup.attr_set ("subcategory_num", 3, 21)
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline connormacleod

  • Sr. Newbie
  • *
  • Posts: 28
  • Karma: +2/-0
Re: set subcategory_num for a preconfigured device to change icon
« Reply #2 on: January 24, 2019, 11:20:26 am »
Try placing this line in Lua Startup...

Code: [Select]
luup.attr_set ("subcategory_num", 3, 21)

Nice!!!

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.

Code: [Select]
luup.attr_set ("subcategory_num", 0, 21)

Thanks akbooer!


Offline akbooer

  • Beta Testers
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: set subcategory_num for a preconfigured device to change icon
« Reply #3 on: January 24, 2019, 11:25:39 am »
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.

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

Quote
Thanks akbooer!

You're welcome.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.