Help combining three shades as one

I have three shades in the same room. I would like to create a device that controls all three shades as if they are one. I have experimented with scenes, groups, and rules but can't seem to get it right. Can someone give me some pointers? Thanks.

How do you want to control them?

Thanks for responding. I was trying to get it to work with a virtual shade device. I am using Sharptools and I want it to show as a shade. Then when I select Open or Close it works on all three shades?

1 Like

It's a simple little Groovy app. Give me a few minutes, will post it for you. You can either use a virtual shade as the controller, or one of the three.

1 Like
definition(
	name: "Shade Control",
	namespace: "hubitat",
	author: "Bruce Ravenel",
	description: "Multi-shade control",
	category: "Convenience",
	iconUrl: "",
	iconX2Url: ""
)

preferences {
	page(name: "mainPage")
}

def mainPage() {
	dynamicPage(name: "mainPage", title: "Multi-Shade Controller", uninstall: true, install: true) {
		section {
			input "master", "capability.windowShade", title: "Select control shade", submitOnChange: true
			input "shades", "capability.windowShade", title: "Select shades to control", submitOnChange: true, multiple: true
		}
	}
}

def updated() {
	unsubscribe()
	initialize()
}

def installed() {
	initialize()
}

void initialize() {
	subscribe(master, "windowShade", "handler")
	subscribe(master, "position", "phandler")
}

def handler(evt) {
	log.info "$evt.name:$evt.value"
	switch(evt.value) {
		case "opening": shades.open(); break
		case "closing": shades.close(); break
	}
}

def phandler(evt) {
	log.info "$evt.name:$evt.value"
	shades.setPosition(evt.value)
}
12 Likes

Hijacking because this is exactly what I was looking for. Thanks for sharing!

Coming from SmartThings, I used an app called "Shady" where it would auto-create a virtual device with selected shades to group. [Release] Shady - Group your shades & blinds and control as a single device - Community Created SmartApps - SmartThings Community

I tried your app, created a virtual shade, and am running into some strange issues with "position." I'm using the generic Z-Wave Shade Device with Bali/Graber/Springs shades.

If I set position 0-100 on the actual shade device, it will act as a 0-100% position closed-to-open (so position 50 would be half-way open). If I set the virtual device to position 20, it fully opened/raised my shades. Thinking it was just an error, I then set to position 10 and it fully closed the shades. Any thoughts on what I may have done wrong?

Thanks!

Thanks. I just got around to installing this, although I am remote at present. It says it is raising and lowering the shades, and I am sure it is, but will confirm when I get home!

1 Like

Okay, that counts as really brave. Hope it worked out well!

One small thing that I found when I went searching for control mechanisms for a group of shades and found @bravenel's code...

I kept getting a null when trying to set position, and then my former engineer brain kicked in and I realized that Bruce accidentally forgot to cast the value in 'phandler' to an Integer:

shades.setPosition((evt.value as Integer))

I know, a small thing, but I turned to my wife and said 'I may be a manager now, but I still know how to debug'. :laughing:

1 Like

Thanks had been using groups forever until I ran across this app. Groups simply is not a good match for shade control. I wonder why this was never incorporated directly into Hubitat release?

2 Likes

This is working well for me with a couple of small modifications. How can I convert this into parent/child structure? I want to add more than one group and I can't figure out how to do it with the current app version/code.

Two steps:

First you have to create a parent app. Let's assume you call it Shade Controls. Each child will be a Shade Control. Here is the source for that.

/*  Shade Controls
 *
 *  Copyright 2021 Hubitat Inc.  All Rights Reserved
 *
 */
definition(
	name: "Shade Controls",
	singleInstance: true,
	namespace: "hubitat",
	author: "Bruce Ravenel",
	description: "Create shade automations",
	category: "Convenience",
	iconUrl: "",
	iconX2Url: "",
	installOnOpen: true
)

preferences {
	page(name: "mainPage")
  	page(name: "removePage")
}

def mainPage() {
	dynamicPage(name: "mainPage", title: " ", install: true, uninstall: false) {
		section {
			app(name: "childShade", appName: "Shade Control", namespace: "hubitat", title: "Create New Shade Control", multiple: true, displayChildApps: true)
			paragraph " "
			href "removePage", title: "Remove Shade Controls", description: ""
		}
	}
}

def removePage() {
	dynamicPage(name: "removePage", title: "Remove all Shade Controls", install: false, uninstall: true) {
		section ("WARNING!\n\nRemoving removes all Shade Controls\n") {
		}
	}
}

def installed() {
}

def updated() {
}

Then, you need to add this line to the Shade Control app definition section. You must create the parent app source before saving this changed child app source.

parent: "hubitat:Shade Controls",

The namespaces of the two apps should be the same, and this parent assumes the child is called Shade Control.

Yes that works thank you. Just one more thing. Is there a way to name each child app after the shade controller? Otherwise I'll have a list of shade groups and can't tell heads or tails from any of them on the apps page:

image

Thank you! The Name field pre-populates with "true" and stays that way when I save but I can manually update it to the desired name and it will save fine.

To the child add these two lines of code at the beginning of the section on the main page, just before input "master":

input "origLabel", "text", title: "Name this Shade Control", submitOnChange: true
if(origLabel) app.updateLabel(origLabel)

Thank you! An unnamed child app defaults to "Shade Control". App is perfect for me now. Appreciate you and the help of this community.

1 Like

Here is a video of a grouping in action. These are actually Bali shades that I brought in from Smartthings using HubConnect and then grouped them using this app by @bravenel

Very happy with how well they synchronize.

Would you mind sharing your updated parent/child app code @alexcapone ?

If you use Alexa it's super easy. Just put them in a group.

"Alexa, open the shades." Or, "close" or even "set shades to 25%".

@Hal3 What's your secret? That's never worked for me.

I put 2 shades (Bedroom Left Shade and Bedroom Right Shade) into a group called "Bedroom shades". If I say, "Alexa, set bedroom shades to 50%," the response I get is: "Sorry, bedroom shades can't do that."

I've tried nested groups (group: "shades" inside of group "bedroom"), renaming the shades, etc. It's never worked for me... Tried this custom code before but it didn't work for me... hoping someone who has tweaked it may get me over the finish line!