[OBSOLETE] Control lighting in great detail with button devices (Aeon Minimote, Enerwave ZWN-SC7)

I absolutely understand, and I always appreciate very greatly when people spend their own personal time to better things for everyone. Thank you again very much. As you said, I got it worked out, and I’m glad for that.

Looks like you have dug into a rather complex system and made it work. Would you be able to describe in a few words how this little scene control system works?

There seem to be plenty of possibilities. The ZWN-SC7 is not a scene controller, of course. As far as I can infer, it generates a signal on a button press. So where is the intelligence which the scene control action? Do the dimmer devices detect the signal directly but have to be set up using the device app? Or does the app have the intelligence? Or does the app give the instructions to some other part of the smart things infrastructure, like the hub?

@erocm1231 thanks so much for developing this. When I saw this app, it actually convinced me to try smartthings. I am using it to control 11 LIFX bulbs in my kitchen and living room. Do you know if there is a way to control the bulbs either by their cloud group or maybe over the LAN instead of cloud? Reason I ask is that trying to set this many bulbs has them turning on one by one, a few seconds apart. Any help is appreciated, I’m brand new to this ecosystem :slight_smile:

SmartThings isn’t really intended to handle device to device communication via Z-wave association. It is possible, but not easy to implement in SmartThings. You would have create custom device handlers to do so.

The Enerwave sends the button press to the SmartThings Hub, the device handler parses it (in the cloud for the Enerwave), and sends events based on how the handler is written. Any SmartApp that is subscribed to these “events” can then handle them accordingly. So, when SmartThings gets the button press from the controller, my SmartApp executes its configuration based on which button is pressed. Does that make sense?

@H4xdaplanet This is the reason that lights come on one at a time. That is the way SmartThings handles things. It may be possible for things to process faster and give the illusion that all lights are coming on at the same time (through local processing), but SmartThings has strict guidelines regarding which device handlers and smartapps execute on the hub vs the cloud. For LAN processing, the SmartApp and all Device handlers being used by the app have to be run locally. Community SmartApps unfortunately don’t run locally unless they are published by SmartThings and then pushed down via hub firmware upgrade.

You might want to search the forums to see if there is a way to tie in LIFX groups to SmartThings. There might be a virtual switch configuration or something like that.

Eric,

Thank you for a terrifically helpful and thoughtful reply. I understand, and it strikes me as a plausible architecture for a “soft” implementation of a scene controller using the ZWN-SC7. Keeps the SmartHub dumb and avoids a software maintenance nightmare on it.

But, just for completeness, it appears I have created my own instance of your code as a Smart App. Where is that executing: on my phone or in the cloud? Though I infer from your reply that is also in the cloud, so just checking.

Would you do me the kindness of considering a resolution of my problem? I posted it here, as new post: Integration of ZWN-SC7 with SmartHub

I hope it is self explanatory. The error message appears as I try to associate my SC7 with your app, so it is unclear who the actors are at this point.

(I now realize I have assumed I should use the device handler from Matt Frank here:ZWN-SC7 Enerwave 7 Button Scene Controller. Correct?)

There are a couple of additional things I need to do - I think I used the device handler code from Enerwave site, which could be out of date, and the MF thread gives me some additional diagnostics I haven’t checked out. But any comments would be useful,l I am sure.

BTW I am trying to command 9 Leviton DZMX1 dimmers with the SC7, mainly because the Leviton z-wave controllers have a pitifully small set of buttons. Would have hoped there was an easier way to do it!!

Thanks for the explanation! I was able to find a handler that can act on the LIFX Groups. However, when triggering through the remote app, there is a second color shift command issued for some reason. I posted this log in the “LIFX group of groups” thread as well.

 6:27:11 PM: debug Response: [results:[[id:d073d512b640, status:ok, label:LivingRm_LFlrLamp1], [id:d073d513364e, status:ok, label:LivingRm_RFlLamp1], [id:d073d51346db, status:ok, label:LivingRm_RFlrLamp2], [id:d073d5135055, status:ok, label:LivingRm_LFlrLamp2], [id:d073d51388a6, status:ok, label:LivingRm_CXLamp]]]
 6:27:09 PM: debug PUT Http Params ([uri:https://api.lifx.com, path:/v1/lights/group_id:b1de7b5cc3e46d69c57769c78dc75ae0/state.json, headers:[Content-Type:application/x-www-form-urlencoded, Authorization:Bearer ********], body:[color:saturation:0.56+hue:82.8, power:on]])
 6:27:09 PM: debug setColor: [hue:23, saturation:56, level:100, colorTemperature:3200]
 6:27:08 PM: debug Results: [id:d073d512b640, status:ok, label:LivingRm_LFlrLamp1]
 6:27:08 PM: debug Response: [results:[[id:d073d512b640, status:ok, label:LivingRm_LFlrLamp1], [id:d073d513364e, status:ok, label:LivingRm_RFlLamp1], [id:d073d51346db, status:ok, label:LivingRm_RFlrLamp2], [id:d073d5135055, status:ok, label:LivingRm_LFlrLamp2], [id:d073d51388a6, status:ok, label:LivingRm_CXLamp]]]
 6:27:07 PM: debug PUT Http Params ([uri:https://api.lifx.com, path:/v1/lights/group_id:b1de7b5cc3e46d69c57769c78dc75ae0/state.json, headers:[Content-Type:application/x-www-form-urlencoded, Authorization:Bearer ********], body:[brightness:1.0, power:on]])
 6:27:07 PM: debug generic name is : Warm White
 6:27:07 PM: debug Results: [id:d073d512b640, status:ok, label:LivingRm_LFlrLamp1]
 6:27:07 PM: debug Response: [results:[[id:d073d512b640, status:ok, label:LivingRm_LFlrLamp1], [id:d073d513364e, status:ok, label:LivingRm_RFlLamp1], [id:d073d51346db, status:ok, label:LivingRm_RFlrLamp2], [id:d073d5135055, status:ok, label:LivingRm_LFlrLamp2], [id:d073d51388a6, status:ok, label:LivingRm_CXLamp]]]
 6:27:05 PM: debug PUT Http Params ([uri:https://api.lifx.com, path:/v1/lights/group_id:b1de7b5cc3e46d69c57769c78dc75ae0/state.json, headers:[Content-Type:application/x-www-form-urlencoded, Authorization:Bearer ********], body:[color:kelvin:3200, power:on]])
 6:27:05 PM: debug Executing 'setColorTemperature' to 3200

EDIT: It seems that maybe the color profiles are doing this. I am assuming these are maybe set up for Hue and I am using LIFX. I could probably comment out the hueColor and saturation for the Whites (or maybe vice versa?) and it would fix my problem… am I reading this correctly?

 case "Soft White":
                    hueColor = 23
                    saturation = 56
                    colorTemperature = 3200

Group of groups? Interesting . . . :slight_smile: I’m not sure if that is what you are going for, but from that thread I saw this:

Seems like what you wanted from your original post in this thread. Have you tried that out or are you trying to control groups of groups? Just want to make sure before digging deeper.

@peterfp You install / configure the SmartApp from a phone and it executes in the cloud or locally on the hub in your house. Most likely in the cloud because the stars need to align for things to execute locally.

As for the message “You can’t currently add this”, you are getting this message when you try to go through the SmartThings Marketplace, clicking + My Apps, and then select Button Controller Enhanced Lighting? Is there anything on the screen other than the error message? A screen shot might be helpful.

So to get it working with the LIFX Group of Groups handler, I had to comment out the section that fired the hue and saturation when setting color temp. I am not sure why it wouldn’t work with the handler, but it seems happier this way.

if (colorTemperature != null) {
                    // Changing the amount of data that is sent because of hue device handler change
                	// colorValue = [alpha: 1.0, red: rgbValue[0], green: rgbValue[1], blue: rgbValue[2], hex: hexValue, hue: hueColor as double, saturation: saturation, level: level as Integer ?: 100, colorTemperature: colorTemperature]
                    colorValue = [hue: hueColor as Integer, saturation: saturation, level: level as Integer ?: 100, colorTemperature: colorTemperature]
                    //try{
                       delayBetween(light.setColorTemperature(colorTemperature),
                       light.setLevel(level as Integer ?: 100), 1000)
                    //}catch(e){
                     // light.setColor(colorValue)
                    //}
                } 
                else {
                     //Changing the amount of data that is sent because of hue device handler change
                	 //colorValue = [alpha: 1.0, red: rgbValue[0], green: rgbValue[1], blue: rgbValue[2], hex: hexValue, hue: hueColor as double, saturation: saturation, level: level as Integer ?: 100]
                    colorValue = [hue: hueColor as Integer, saturation: saturation, level: level as Integer ?: 100]
                    light.setColor(colorValue)
                }

However, now when setting colors (blue, for example), I don’t have control over the level. It sets the brightness to 100. It seems that the handler is not sending the brightness level to the LIFX api when setColor() is used and same with setColorTemperature(). Shouldn’t the handler grab the brightness and pass it along on both setColor() and setColorTemperature() functions, and not need a second setLevel() command?

EDIT:

Did some experimenting in both the handler and smartapp:

if (colorTemperature != null) {
                    // Changing the amount of data that is sent because of hue device handler change
                	// colorValue = [alpha: 1.0, red: rgbValue[0], green: rgbValue[1], blue: rgbValue[2], hex: hexValue, hue: hueColor as double, saturation: saturation, level: level as Integer ?: 100, colorTemperature: colorTemperature]
                    colorValue = [level: level as Integer ?: 100, colorTemperature: colorTemperature]
                    //try{
                       //light.setColorTemperature(colorTemperature)
                       light.setColorTemperature(colorValue)
                       //light.setLevel(level as Integer ?: 100)
                       //light.setColor(colorValue)
                    //}catch(e){
                     // light.setColor(colorValue)
                    //}
                } 
                else {
                     //Changing the amount of data that is sent because of hue device handler change
                	 //colorValue = [alpha: 1.0, red: rgbValue[0], green: rgbValue[1], blue: rgbValue[2], hex: hexValue, hue: hueColor as double, saturation: saturation, level: level as Integer ?: 100]
                    colorValue = [hue: hueColor as Integer, saturation: saturation, level: level as Integer ?: 100]
                    light.setColor(colorValue)
                    //light.setLevel(level as Integer ?: 100)
                }

Of course now the setcolorTemperature function is broken in the stock smartthings handler :laughing:
And in the handler:

def setColor(value) {
	log("Begin setting groups color to ${value}.", "DEBUG")
    
    def data = [:]
    data.hue = value.hue
    data.saturation = value.saturation
    data.level = value.level
       
   if (data.level < 1 && data.level > 0) {
		data.level = 1
	}
	if (data.level == 0) {
		sendEvent(name: "level", value: 0)
		return off()
	}
    
    def brightness = data.level / 100
    
    buildGroupList()
    sendMessageToLIFX("lights/" + state.groupsList + "/state", "PUT", [color: "saturation:${data.saturation / 100}+hue:${data.hue * 3.6}","brightness": brightness,"duration": "2.0", "power": "on"])
    
    sendEvent(name: "hue", value: value.hue)
    sendEvent(name: "saturation", value: value.saturation)
    sendEvent(name: "color", value: value.hex)
    sendEvent(name: "switch", value: "on")
    
    
    log("End setting groups color to ${value}.", "DEBUG")
}

def setColorTemperature(value) {
	log("Begin setting groups to ${value}.", "DEBUG")
    
    def data = [:]
    data.level = value.level
    data.colorTemperature = value.colorTemperature
       
   if (data.level < 1 && data.level > 0) {
		data.level = 1
	}
	if (data.level == 0) {
		sendEvent(name: "level", value: 0)
		return off()
	}
    
    def brightness = data.level / 100
    
    buildGroupList()
    sendMessageToLIFX("lights/" + state.groupsList + "/state", "PUT", [color: "kelvin:${data.colorTemperature}","brightness": brightness,"duration": "2.0",power: "on"])
            
	sendEvent(name: "colorTemperature", value: value.colorTemperature)
	sendEvent(name: "color", value: "#ffffff")
	sendEvent(name: "saturation", value: 0)
    
    log("End setting groups color temperature to ${value}.", "DEBUG")
}

Now it works as I had hoped. Hope this helps someone in the future - sorry for the massive amounts of edits :slight_smile:

One other question for you @erocm1231 - I have a Dresden fls pp controller for a rgbw led strip. I am able to control the colors of the strip but not the white function. Do you have any suggestions on how to achieve that with the button controller?

Is it connected directly to the smartthings hub or is it connected to a Hue bridge? Also, what device handler is it using?

It is connected directly to the smartthings hub. I am using this device handler:

So the color options of “White, Daylight, Soft White, and Warm White” don’t do anything or they adjust the RGB colors?

They set the RGB correctly, but don’t touch the W LEDs. If I have the W turned on and set the device to off, it doesn’t turn off the white either. Maybe a handler problem?

Looking at the handler, it seems like there are separate methods to handle control of the W LEDs. “whiteOn(), whiteOff(), and setWhiteLevel()”. They seem to be completely separate from how the RGB colors are controlled. This isn’t typically how SmartThings color devices function. It looks like that handler needs to be reworked. From the looks of it, if the white LEDs are on and you have any automation in SmartThings send the off() command, they won’t turn off. Also, it looks like they wouldn’t work properly with things such as “Smart Lighting”. Are there any other device handlers out there you could try?

Thanks very much - was able to get my Enerwave ZWN-SC7 working with this! Had trouble with the other Smart App I found in the forum… Have posted an issue in the other thread.

Quick question. Can anyone help me with a wiring diagram for using this device in a fan canopy controlled by a single switch? I’m wondering if I need to connect something to aux 1 and 2.

Thanks in advance!

@erocm1231 I installed this groovy code as a device handler for Aeon Minimote. The device then disappears from my iPhone SmartThings App -> MyHome -> Things screen. The Minimote shows up when I change device handler back to the standard ST handler. Thoughts on how to fix?

This should be installed as a SmartApp. You can then choose the Aeon Minimote in the SmartApp and assign lights to its buttons.

I’ve been using this with my minimotes since the day I got them and it worked great but I wasn’t sure what it’s benefit was vs other smart apps. Recently in a bid to run things locally, I changed from using this smart app to using smart lighting to program button presses on my minimotes and it took all of 2 minutes to discover the big advantage that your smartapp has over smart lighting. With smart lighting I can program a button to toggle on and off my light, but it doesn’t check the state before doing so.

If I turn my light on using Alexa on my echo dot, smart lighting doesn’t check if the light is on, it just knows the last state of the toggle was off, so pressing the button on the minimote simply toggles the light on, even though it’s already on. This is HUGELY annoying as I’ll press the button and be a step and a half away before realising it didn’t work. The same is true for turning the light off. If I turned it on with smart lighting and turn it off with Alexa, smart lighting will assume its on and if I press the button hoping to turn the light on, it just stays off for the first press. This also happens if the light is turned on by motion or an open/close sensor. This smart app however checks the state before it executes. So if the light is on, no matter what turned it on, a button press will turn it off which makes perfect sense!

I wanted to run locally, not for speed as my system runs super fast as it is, my lights turn on in under a second of pressing a button on the minimote, but in case I lose Internet connection especially if I’m not home and the fiance is home by herself. So, to get the best of both worlds, I use this smart app to toggle lights on and off with a push, and I use smart lighting to toggle on and off the same lights but with a long press or hold instead. So if I lose Internet, a long press will allow the lights to work still with local processing. I tested it and it works great. I just wish ST staff would allow more stuff to run locally and also that they would learn from all the innovation that goes on here because more thought was put into the logic of this smart app made by you in your free time vs official smart apps which ST employees were paid to make.

Long post, I apologize but keep up the good work! You’ve made my ST experience so much better.

2 Likes

Thanks, I appreciate it. Glad it has helped you out. :slight_smile: