[Release] Virtual Container Driver

Wouldn't changing "isComponent" to true in the driver solve this problem? I am waiting to update to 2.0 until at least one more hotfix for the low hanging fruit issues to be solved.

case builtInTypes():
        	def newType = vType
        	if (vType == "Momentary") newType = "Switch"
        	log.info "Creating Virtual ${vType} Device: ${vName}"
			childDevice = addChildDevice("hubitat", "Virtual ${newType}", "VS-${device.deviceNetworkId}-${state.vsIndex}", [label: "${vName}", isComponent: true])
        	if (vType == "Momentary") childDevice.updateSetting("autoOff",[type:"enum", value: "500"])
    		updateSize()
        break
        case customDevices():
        def devInfo = state.customDevices.find{it.ref == vType}
        	log.info "Creating Custom Virtual Device (${devInfo.driver}): ${vName}"
        	childDevice = addChildDevice(devInfo.namespace, devInfo.driver, "VS-${device.deviceNetworkId}-${state.vsIndex}", [label: "${vName}", isComponent: true])
    		updateSize()

Yes, I noticed that as well. @patrick @bravenel any particular reason why child grouping was "fixed"? This was one of the only real benefits of the web based device list.

Are there any hidden alternatives that replace this?

Please say yes, because this update has made my device list a hot mess of virtual devices...I suspect the same for others that used the virtual container driver to organize their list.

1 Like

Each device is now its own row. You can drill into your component driver and view the list of drivers in the table at the bottom.

Each device will be its own row or card going forward.

The "isComponent" function would not change that?

We also have some other things planned that will remove the reliance on using the Device list as a daily interaction point.

Having each device on its own means that search and sorting now work as expected.

There is also the ability to search / filter the list using the search box or outside the search box you can use the keyboard to jump to the first letter of any devices.

But virtual container also allowed you to cycle through the component devices. Will that functionality still work if they are not displayed together?

Component devices will show up here:

and each component device has a link back to its parent

image

I have Fibaro UBS devices and they would have 2 contacts and up to 4 temperature probes and the tree formation to that was great but now its scattered as the names are different. Is there a way to do a sort and list them as parents and then childs at the bottom?

There were other benefits to the grouping that alphabetizing would not solve. For instance, I used my virtContainers to group the presets for my various Sonos speakers together. I guess I could rename them all but they would be unnecessarily wordy and would then have to be changed again in the Alexa again. A bit of a pita. I'm hoping there are some real world benefits that we just can't see yet. I know you guys have a vision and I am hopeful it will all make sense...but in the meantime...I'm very disappointed with this change.:disappointed:

You can now go into the parent device and view the list of component devices as pictured above.

This should not be affected by the visual changes. Please let me know if you see any quirks regarding that.

1 Like

In a future update, could we have this work similarly to ST where the isComponent=true hid the devices from the main device list. At least this way I could keep my devList clean. They would only be accessible from the parent device as your picture displays.

1 Like

yes but the parent isn't necessarily obvious unless you go into the device, so if they STUCK out or if you were able to organise the to be on another page or at the top?

We understand some people want to be able to group or filter their devices. We do have plans to address this down the road.

This is possible, will need to consider how we would implement. Another thought would be to have an option to show/hide component devices as a preference.

3 Likes

yes this is what I'm after something like that

:+1:

2 Likes

Update: 11/17/18
Virtual Container v1.1
v1.1.20181115

What's new:

CreateVirtualDevice command has now been split in 2

  1. Quick Create - This allows you to create a device based on a selected template. The templates are avaiable in a dropdown list under Preferences (don't forget to hit Save after selecting). Once the template is selected you only need to enter the Label and click QuickCreate.

  2. CreateDevice - This allows you to install any driver installed on your hub. Simply enter the corresponding namespace, driver type and device label and click CreateDevice.

With these 2 options you should no longer need add any custom driver to the customDevices() section (which has now been removed). You can still add these drivers to the dropdown for your convenience in the new preloaded() section at the bottom of the driver code.

The Template Dropdown includes the following:
Additional preloaded drivers:

  • Virtual Switch
  • Virtual Momentary (Switch with autoOff set to 500ms)
  • Virtual Dimmer
  • Virtual Button
  • Virtual Presence
  • Virtual Motion Sensor
  • Virtual Contact Sensor

@Cobra custom drivers are also available if the option is chosen in Preferences

  • Average All Device
  • Custom WU Driver
  • Switch Timer
  • Virtual Presence Plus
  • Weewx Weather Driver - With External Forecasting

Added update check code:
I "borrowed" the idea of using an external json file to allow you to check for updated versions of the driver code in github. It is not as advanced as @Cobra implementation but it gets the job done.

Click the "Check For Update" button and refresh the webpage.
If you have the latest code you will see:

If the driver is out of date you will see:

The "Update Notes" link will open the top of this thread in a new window with my latest update notes.
The "Raw Code" link is a direct link to the raw text version of this driver. Clicking on it will open in a new window where you can copy and paste as needed. Alternatively, you can Right Click on the link and select "Copy link address". Then paste directly into the new Import option.

SmartApp usage:
All drivers in the template list can be manually created with the createDevice() command except for the Virtual Momentary Switch. This is why it's the default option when a Virtual Container is created. If a smartApp creates a VC it can then generate Momentary switches by using the quickCreate() command. All other devices can be generated using the createDevice() command.

The apiCreateDevice() method was designed specifically for use in smartApps that need bidirectional communication with the child devices in a container.
See documentation on how to use here:

PLEASE NOTE THAT CODE IS IN A NEW LOCATION (SEE BELOW)
https://github.com/stephack/Hubitat/blob/master/drivers/Virtual%20Container/Virtual%20Container.groovy

3 Likes

Looks brilliant!
Love the update section and images
Well done!

Andy

1 Like

Thanks for the update json and dropdown ideas. I think it makes using this a lot simpler and intuitive.

2 Likes

I updated the OP with new screenshots and documentation. Also included 2 important notices.