[Release] Virtual Container Driver

You would need to manually edit that section.
Say you want to be able to easily create a custom driver you created called "My Driver" to be included in a Container. You would uncomment the first line and edit accordingly.

def custom1 = [ namespace: "halfrican", driver: "My Driver", ref: "MD"]

Now you can create an instance of your driver in the virtual container. Under the Create Virtual Device button....The NAME would be whatever you wish to call the device. The TYPE would be "MD" because that's what you chose to reference your device type in the custom1 above.

Make sense?

1 Like

Got ya, thanks

I just have to chime in that this is brilliant. Thank you @stephack

Making it easy to add in our own drivers was very kind....

1 Like

Yeah. I see @stephack had added custom device types. With my recent discovery with triggering Alexa to speak without a raspberry pi I'll be needing to make a bunch of virtual motion sensors.

2 Likes

Please elaborate.

2 Likes

Haha I'm going to make a clean post about it when I have it working 100% in practice but I've proved it out to work.

Basically taking advantage of SmartThings updated Alexa skill that allows motion sensors to be used as triggers of routines. Also using Other Hub SmartThings Integration:

Basically the flow will be:

Life360 Presence home-> Hubitat rule switches custom motion sensor with switch capability (reset somehow) -> Other SmartThings Hub Integration changes mirrored motion sensor to activated -> Alexa fires pre-configured routine -> routine has Alexa says function.

That simple! lol

1 Like

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