[Release] Virtual Container Driver

OMG @stephack I think you undersold how easy it is to include custom drivers and how automagically you do it!
I was expecting your instructions to tell me to make a new section in the Virtual Container code with the driver that I wanted to instantiate, but you literally only have to have that driver in your Driver Code library and fill in 3 pieces of information in the Virtual Container code...
Now that's smart... Thanks a lot!

2 Likes

Is something like this possible with apps?

Yes, it was the app parent/child structure that inspired me to create the virtual container.

This is how RM and most apps that create many "children" work already.

2 Likes

Hmm I will have to see if I can figure out how to make this work I suppose. There are few apps I am running that I would like to see grouped together like this. Eventghost, your boot me up scotty app and likely a few others.

One more question. How do you have so much space in the name column in your list it in the OP? Mine seems teeny and makes the device names wrap.

Screen resolution maybe...not sure.

Wow...didn't realize anyone was using that. I never made it parent/child because I only have 2 devices that use it. It can be easily converted but would then require you to install 2 separate apps (1 parent and 1 child) in the IDE. I'll try to slap it together for you this afternoon. You can then look at the existing code and compare it to the new one and that should help clarify how easy it is to change the app type.

1 Like

Dead easy!
You just need to create a new master ‘parent’ app and make the parents of your apps children of the master app.

I am about to release ‘Cobra Apps’ which will be a master parent containing my parent/child apps like Message Central, Presence Central etc.

It will look like this...

Andy

1 Like

I'm having a really stupid day it seems (no change there). But I just don't get how I can create one device and have my others kind of linked. I've tried and tried, but this stupidity seems to be lasting longer than normal. Any steps for stupids like me? Thx.

So below I posted the code for the new Parent/Child Boot Me Up Scottie app.

You first have to create the parent which is essentially a template for the the actual child app that does the heavy lifting. On line 34 of the parent you need to reference the name of the child app under "appName:"

You will notice that he child app is identical to the original single app you currently have installed except for one line...Line 7 that reference the parent app.

parent: "stephack:Boot Me Up Manager"

Parent App

Hubitat/apps/Boot Me Up Scottie/Boot Me Up Scottie.groovy at master · stephack/Hubitat · GitHub

Child App:

Hubitat/apps/Boot Me Up Scottie/Boot Me Up Child.groovy at master · stephack/Hubitat · GitHub

1 Like

Now if we could do a virtual container for Apps...

There are a lot of nuances to what you are asking. Please specify in detail what you are trying to accomplish.
If you want to link 2 existing , then that is not really possible unless you use a smartApp to tie them together.
Otherwise, you need to have one device create the other device (i.e. the child device is a component of the parent device that created it). This is what my Virtual Container driver does.

If you have a smartthings account, this link might be helpful (ignore all the tile stuff..it doesnt apply).

https://docs.smartthings.com/en/latest/composite-devices/index.html

See also...scroll down to the addChildDevice() section
https://docs.smartthings.com/en/latest/ref-docs/device-handler-ref.html

1 Like

Fantastic. Thank you @stephack. And as you say this all seems simple enough I may be able to figure out how to do it myself...

1 Like

See @Cobras post a few posts up

Right, I'm thinking even a little higher, where I could have a container for bedroom, and I could automagically add any user app I have as a child:
Bedroom
-Heater Control My HeaterApp
-Fan Control MyFanApp
Outside
-Xmas Lights MyXmasApp
-PoolConteol MyPoolControl

etc.
Might be a bridge too far, we'd need to be able to get a list of apps that can be installed.

It still comes down to all of us want better organization.

Craig

I used the same system in ST
I included the relevant apps into ‘groups’ ( mostly rooms)

It worked quite well at the time

Andy

This is what my 'Cobra Apps' container is looking like at the moment..

And when they are installed (the same app)...

And in the apps list...

Maybe not the 'final' version... but you get the idea?

EDIT: I almost forgot... @bravenel
Bruce.. this is the next thing on my road-map :rofl:

For those of you not 'in' on the joke...

Andy

4 Likes

I'm paying VERY close attention. :nerd_face:

4 Likes

RAFLMAO @bravenel

Thanks @stephack, it wasnt so much of the logic, rather than the method I was missing.
I noted all my Zigbee Id's, then removed them all. Created the VC devices, and created the devices again, after updating the code with the driver details. Then re-paired each device. So now I have them :slight_smile: And very happy!! :slight_smile:

Cheers
Roy

3 Likes

Holy Cow!! That's NOT what this was designed to do, but it's fantastic if it actually works. This was designed for Virtual devices and never considered trying physical devices with it. Let us know how well it works and I might give it a shot as well.

@mike.maxwell do you see any pitfals to assigning physical devices this way. I cant think of any myself.

2 Likes

:smiley: Going back to the ST days, I added most my Xiaomi devices via the catchall method, so I made sure I kept the Zigbee ID and dni, I added them using your method and added the Zigbee ID (not the dni) to each device I was adding, then performed a search on each. All were picked up without issue, and added to the VC I had created. I've tested them since adding and all functioning fine. So fingers crossed there is no potential issue to be caused :+1:

1 Like