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

Tried that and still got the same result. I thought that all bulbs would be using the same (or close to same) color temperatures? Is there a way to find all of the color temperatures for a particular bulb (along with hue and saturation)?

Unfortunately there are many differences between the Smart Bulbs that are available. Particularly the color ones. What device handler are you using for the Osram bulbs and what model are they? I don’t have any experience with the Osram devices. I can look at the code and see what it is expecting. I’m sure any changes I make will break it for some other Smart Bulb, LOL.

With the “color temperature” commented out I am passing the same values as what the SmartThings Smart Lighting app would pass. If I can find the source for the device handler you are using I can probably figure it out.

I’m not sure that I’m using any special device handler with the Osram bulbs. I’m guessing it’s just a default one that’s applied when adding it to ST as I didn’t enter in a custom one and associate it to the bulbs in IDE. The bulbs are the Osram LIGHTIFY A19 RGBW that I bought from Amazon here http://www.amazon.com/dimmable-LIGHTIFY-CLASSIC-Equivalent-Daylight/dp/B019WVBIEY?ie=UTF8&psc=1&redirect=true&ref_=oh_aui_detailpage_o05_s02.

One question I do have is, right now it shows the Current State in IDE as -
switch: off
• level: 100
• hue: 27
• saturation: 100
• colorTemperature: 2703

Could I just switch it to each state and replace the code in your app to match each color? I know that one problem will be that of course this will throw off my Lifx bulbs I’m sure (which is what you’re eluding to already…fixing for certain bulbs will probably break others).

Just figured how to see the actual device handler. Its the Zigbee RGBW Bulb device handler.

Alright, I looked at the source and think I have a fix in place. The latest code has been committed to my github. It doesn’t appear to break any other of my color devices, but let me know how it goes.

Looks like the changes you made definitely did the trick! The proper “whites” are being applied when powering on now.

There is one oddity that it appears is popping up now though. Every other time I cycle the lights on (so turn them off, then back on again) it turns on to a weird white color (like daylight with a green tint). If I turn them back off, then on again it then fixes itself and turns on to my set warm white color. As well, every now and then when I turn off the lights (when they’re set at my default warm white), it won’t turn off with the button press and will instead turn to that same weird white color. If I press the button again it will turn off though.

@erocm1231 Hi sir, just checking in to see if you had a chance to check into the last minor “bug” I indicated above after you made the last changes? No rush, just wanted to check. The other minor thing that I just discovered is that if you choose the “Random” Hue color option, it doesn’t randomly cycle through colors of your bulb. It just turns on to the blueish white.

Thanks again!

I’m sorry, I really have tested this code until blue in the face and can’t reproduce the problems you are seeing. The only color devices that I have to test with at this time are Philips Hue, Aeon RGBW bulb, Mipow Bulbs, and a wifi RGBW controller of my making. They all work great. In fact, I have been using 7 instances of this SmartApp with different lighting configs and button devices for several months and it has been flawless.

It honestly sounds like you have another SmartApp or automation that is conflicting with the config in this app. If you go to one of the bulbs that is giving you problems and click on the “SmartApps” tab, are there any other apps listed there besides mine? Is there anything else unique about your setup that might be causing issues?

I completely understand and I really do appreciate you trying to dig into it further. I checked and the only other things controlling the lights are the built in “Routines” functions and it’s associated to the Smart Home Monitor “Alert with Lights” function. Is it possible that remnants of these lights being previously associated with the previous Button Controller app could be effecting it? Maybe I should try completely removing the lights, repairing and then only using this app to control them initially.

So, I took an alternate route to solving the problem. I just went ahead and sent the Osram lights back and got some more LIFX bulbs. :smile: No more worries from color issues and all is well. Once again, I really appreciate you making this app! It’s perfect!

Well I’m glad you got things figured out one way or another. Sorry for not being able to troubleshoot the Osram issue, but life has been extremely busy as of late. :wink: Thanks for understanding.

2 Likes

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?