HI there,
i?ve got a question according the categories and subcategories. I want to set the subcategory of a device to a specific value. I found this thread where the author describes how to do this ([url=http://forum.micasaverde.com/index.php?topic=9601.0]http://forum.micasaverde.com/index.php?topic=9601.0[/url]).
So i put the to lines in my device file:
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<Category_Num>99</Category_Num>
<SubCategory_Num>99</SubCategory_Num>
<deviceType>xxx</deviceType>
<staticJson>xxx</staticJson>
<serviceList>
<service>
<serviceType>xxx</serviceType>
<serviceId>xxx</serviceId>
<SCPDURL>xxx</SCPDURL>
</service>
</serviceList>
<implementationList>
<implementationFile>xxx</implementationFile>
</implementationList>
</device>
</root>
If i request user_data i can see that category_num and subcategory_num is set to 99. But if if request sdata category is set to 0 and subcategory is set to -1.
Did i something wrong? Is the place of the two line in the D_xxx file correct. Is there another way to do this?
Thank you very much
Thank you for your reply
but i dont think this is the matter. After I set category_num=1 and subcategory_num=0 in the plugin and after reloading the luup engine the new values are visible in user_data but sdata didnt update immediately.
Did you restart LUA ?
Not all changes are instantaneous.
Perhaps i have to describe to whole situation:
I?m developing a plugin which creates one parent device and for example four child devices. The child devices have their own device file (D_XXX.xml) and should have subcategory_num=0. In the device file I added the line “<SubCategory_Num>0</SubCategory_Num>”.
After some testing i figured out some strange behavior:
- copied all files to my vera
- created the parent device (Apps->Develop Apps->create device:“D_ParentDeviceFile.xml”)
- restarted the lua engine
- sdata showed subcategory=-1
- for testing i changed the value in the child device file to 1 “<SubCategory_Num>1</SubCategory_Num>”
- copied all files to my vera
- restarted the lua engine
- sdata showed subcategory=0 (the old value for subcategory)
- restarted the lua engine again
- sdata showed subcategory=1
So do i have to restart lua engine twice for updating the subcategory of the child devices?
Thank you
Looks like you answered your own questions …
Because Vera has some data it considers Static it does not like, or expect this data to change.
This is also why there are LOTS of restarts when you install plugins, create devices, …
Hi Richard,
i?m still wondering why i have to restart lua twice to update the subcategory. After the first restart sdata shows the statevaribles of the childdevices. so luup has to parse the child device file for these variables but ignores the set subcategory. is this the expected behavior?
Thank you
Did you refresh the browser after restarting the luup engine? I bet it was cached in the browser.
Hi Garret,
yes i did refresh the browser not only once. but the subcategory didnt change its value till i restart luup for a second time.
I do not know the answer … I have seen the behavior before.
This sounds like it’s something MCV does NOT expect you to change …
Is this something you expect to make dynamic ?
If so, you might have to make your own double restart routine, using a persistent variable to count the number of restarts … be careful not to get into an infinite loop!
If not, why does it matter that you have to restart twice ?
Hi Richard,
in this link [url=http://forum.micasaverde.com/index.php?topic=9601.0]http://forum.micasaverde.com/index.php?topic=9601.0[/url] an admin describes how to change these values. I only want to set these values once so not dynamically.
It doesn?t matter to restart twice but if it is necessary i have to know it that i can implement it the correct way 
I agree with u and the solution must be:
- add the subcategory_num line to the device file
- copy files to vera
- create the device
- restart luup twice
- DONE
Thank u very much