plugin subcategory number

Hi Everybody and Happy New Year 2012!!

I want to programmatically set the subcategory number of my device plugin. Can it be set using luup.variable_set ?

What serviceID would it have ? I tried urn:micasaverde-com:serviceId:HaDevice1 but it created a new variable ???

Thanks.

To my knowledge it cannot be setup by the Plugin, it’s a [static] mapping of the [tt]DeviceType[/tt] you declare in your Plugin’s files.

If it were possible to set, you’d have to use this:
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_attr_set

but it’s not clearly documented what attributes can be changed this way, and what “values” should be used.

Alternatively, you’d have use “raw” modifications of the JSON, but there’s no guarantee that it wouldn’t be over-written by some internal MiOS codepath.

thanks a lot guessed,

“attr_set” worked! I put it in the startup function of the plugin.

I will monitor it for some time now to see if it gets reset again.

I wish there were more documentation about these variables as they can be very handy in plugin development.

Cheers,
Roy.

Which attribute name did you use to make the change?

I used the below syntax:

luup.attr_set('subcategory_num', 100, lul_device)

Let me just add that a restart was needed for the changes to appear in json file (data_request?id=lu_status)…

It’s possible that there’s just a delay. A bunch of writes to the JSON are cached to avoid burning up the Flash memory. Over time, these are flushed out of memory… it’s just that they’re not written instantly. Not sure if that’s the cases here or not, but it sounds like it.