Can we create child devices?

doing that now

I just went through this today.

I noticed this when creating my HubDuino Service Manager App + Child Drivers. For me, I just saw the errors in the Logs which annoyed me enough to simply add an empty installed(){} routine in every child. I havenā€™t had any issues with my Parent App / Child Devices.

It created without an errorā€¦but the ā€œIn use byā€ is blank for the child device.
parent.childOn() generates:
errornull on line 36

It still seems like the link between parent and child is not fully formed.

hmmmā€¦Iā€™ll take a look at your code and see whats different.

Whatā€™s on line 36 of the app; is there a line 36 in the driver?

My code auto creates child devices based on data received from the Arduino/ESP8266ā€¦ So it always checks for the existence of a child to decide if is needs to create one. Not the prettiest code, but it seems to work well-enough.

if the link was not there, i would expect to see a null pointer exceptionā€¦ can you try adding a try catch around your call to parent and see what exception you get? I just tried creating a child device and then calling parent from there and it seemed fine. what does parent.childOn() do? can you add a logger to it at the beginning to see if it is truly being called?

So just to clear up any confusionā€¦

Apps can have child apps

Apps can have child devices

Devices can NOT have child devices (yet)

1 Like

I commented out everything and just have it log.debug. Iā€™ll try your suggestions and see what I get.
@bravenel, line 36 simply does ā€œparent.childOn()ā€

can you post your child device and parent app code?

So I got it working by changing

childDevice = addChildDevice("stephack", "Http Switch", "HC_${app.id}", null,[completedSetup: true,
        label: app.label]) 

TO

childDevice = addChildDevice("stephack", "Http Switch", "HC_${app.id}")

Getting rid of the trailer code seems to work now. Thank you @ogiewon. I used your HubDuino as a template.
@bravenel, @chuck.schwer adding the empty installed method also removed the error in the logsā€¦let me know if you need me to test anything furtherā€¦but I think Iā€™m good for now. Thanks for all the feedback guys.

2 Likes

Youā€™re welcome! By any chance, are you working on an improved Harmony Hub integration? :wink:

yupā€¦I was going to PM you once I had it working somewhat. Probably tomorrow because Iā€™m pretty much done for the night.

2 Likes

I tried your:
childDevice = addChildDevice(ā€œstephackā€, ā€œHttp Switchā€, ā€œHC_${app.id}ā€, null,[completedSetup: true, label: app.label])

and iā€™m not seeing the problemā€¦ can you post an example of the failure?

@patrick are there plans to allow this functionality in the near future. I was about to create a smartapp as a workaround for my fan driver...but you guys always seem to release an update that negates the need for my workarounds right after I create them.
Never had this "problem" on the ST platform :wink:

2 Likes

Its in the works, but with anything software, it will be out when its ready.

I hate that problem, we will work hard to fix it :slight_smile:

2 Likes

Good enough for me. I understand you got a lot on your plate. I think Iā€™ll wait a bit since itā€™s a ā€œwork in progressā€ and not a ā€œlast on the list of prioritiesā€ item.

any update on this yet? I have a driver that i have brought across from ST for the Fibaro UBS that creates the devices children. The DH used to grab the virtual DH from ST and use them as the children.

Looks like Hubitat Firmware v 1.0.9 adds support for Composite Device Handlers! Thank you Hubitat team!

4 Likes