Philips Hue Smart Button help

I have purchased one, however I don’t own a hue bridge, just a ST hub. I have had a go at a couple of custom device handlers buy not getting anywhere. Does anyone have any advice or a solution? Many thanks in advance

Others may need to confirm however I’m fairly sure that the Hue Smart Button (the little puck of a device) can’t currently be linked to the SmartThings ecosystem.

I have a few of the buttons and they are very nice but in order for them to work you need to have a Hue Bridge.

I brought one to to hard wire the switch behind because no neutral, what I did find is the basic zigbee button handler works for battery and for a press it’s just the hold that doesn’t work. As I’m not a coder I did try loads of stuff but went all over my head, but if anyone is I did find this thread that may help to adapt it?

1 Like

Update: I assigned it a basic ZigBee button device handler, which allowed it to register the battery percentage and click on/off within smartthings. I order to then get it to turn on and off a group of lights, I then used multiple IFTTT commands (individual on/off for each of the 4 lights) and it works as desired for my use.

If you are looking to do the same, I would advise you to add it to the ‘room’ group within your voice controller, which in my case is Google home, so that if you ask Google to turn on or off the ‘room’ group that the button controlls, the button will be in the same state as the lights, meaning you won’t have the lights on and the switch off within smartthings.

Have you tried using trend setter to group your lights so that you don’t need IFTTT?

I am controlling Hue lights with a SmartThings button. It works that way around

1 Like

I do this in 2 rooms as well. As long as your hue account is accessible though ST, there’s no issue.

You don’t even need a Hue account for this. I don’t have one. It seems to work offline.

You mean you have your hue bulbs added directly into ST?

I am really not sure. I paired the bulbs to the Hue hub, then in SmartThings I added the Hue hub as a device which didn’t automatically show the bulbs through to SmartThings. So I also added the bulbs in SmartThings. Now I don’t know if ST hub is talking to Hue hub or going direct to the bulbs. I can probably find out in one second by trying to switch them off via the Hue hub…

One moment later: The hue app is controlling the lights and they can’t really be paired to both hubs so I guess ST is talking to them via the hue hub

Yep and also they react quicker to the Hue app, so I guess that is the extra hop making the difference

Yeah, having your ST hub controlling your hue devices through the hue bridge keeps everything local. If you add the hue devices directly into ST, it’ll then be controlled c2c.

1 Like

I got one of these.
It does work with the zigbee button driver, but it only registers every other button press. I’m wondering if this has something to do with the way the driver waits for held actions.

@orangebucket how much do you know about Zigbee buttons?

Not a great deal to be honest. I’m not really in my comfort zone until the device handler has finished with the Zigbee bits.

It seems that the device alternates between sending command 01 and 00 on cluster 0006. I don’t understand WHY it’s doing this though. And the default code for that handler assigns 00 to button two. Bypassing this if statement fixes the issue.
if (descMap.clusterInt == 0x0006) {
buttonState = “pushed”
if (descMap.command == “01”) {
buttonNumber = 1
}
else if (descMap.command == “00”) {
buttonNumber = 2

@johnconstantelo any ideas why this device would alternate sending 01 and 00 every other button press? I thought it was to keep track of a triple press but seeing the hue app it only actually supports pressed or held…

edit: well I sort of figured it out, but implementing held presses as groovy will be a different story:

If they’re following the spec, here are the command ID’s for cluster 0x0006:

image

I’d be curious to run just a basic handler that just takes the raw data in from the device and dumps it out to Live Logging for every button press and held press, or any other combination of presses.

Yeah, but it’s a single button. It doesn’t have any obvious on or off state. It seems they’re distinguishing between long and short held presses too which ST can’t do. I’m going to play around with it and make a handler that does pressed and held.

@johnconstantelo @orangebucket
With a single press, it’s sending
raw:0104 0006 01 01 0000 00 93D0 01 00 0000 01 00
That’s command 01 on cluster 0x0006 (on)

Press it again and it sends
raw:0104 0006 01 01 0000 00 93D0 01 00 0000 40 00 0000
That’s command 40 on cluster 0x0006 (off with effect)

So, that’s simple enough. I can just change the handler so that both command 01 and command 40 are recognized as button presses.

The issue is the “held” part. It uses cluster 0x0008 command 02 while held (step) to continuously dim a connected light. When released it sends 0x0008 03 which is stop.

Ideally, I would like to give the user the choice of having the held event registered on “held” or “released”, however if I set the hold event to happen on command 02 it will keep happening infinitely because it keeps sending the command as long as it is held.

Is there some clever way I can have it ignore any events after the first command is sent?
This is my code right now, it just keeps sending the held event forever (which means if you set held to, say, turn a light on or off it just keeps power cycling the thing).

private Map parseNonIasButtonMessage(Map descMap){
    def buttonState = ""
    def buttonNumber = 1
    if (descMap.clusterInt == 0x0006) {
        if (descMap.command == "01") {
            buttonState = "pushed"
		}
        else if (descMap.command == "40") {
            buttonState = "pushed"
       }
    }
    else if (descMap.clusterInt == 0x0008) {
        if (descMap.command == "02") {
			buttonState = "held"
        } else if (descMap.command == "03") {
        	buttonState = "released"
		}
    } 
    if (buttonState == "pushed" || "held" ) {
    	def descriptionText = "$device.displayName button $buttonNumber was $buttonState"
        return createEvent(name: "button", value: buttonState, data: [buttonNumber: buttonNumber], descriptionText: descriptionText, isStateChange: true)
    }
    else {
        log.debug "$device.displayName button $buttonNumber was $buttonState"
    	return [:]
    }
}

@johnconstantelo @orangebucket @nayelyz

ok in order to get around the problem I tried adding a counter

def initialize() {
	def holdCount = 0 
    log.debug "Initializing holdCount..."

and

private Map parseNonIasButtonMessage(Map descMap){
    def buttonState = ""
    def buttonNumber = 1
    if (descMap.clusterInt == 0x0006) {
        if (descMap.command == "01") {
            buttonState = "pushed"
		}
        else if (descMap.command == "40") {
            buttonState = "pushed"
       }
    }
    else if (descMap.clusterInt == 0x0008) {
        if (descMap.command == "02") {
        	if (holdCount == 0){
			buttonState = "held"
            } else {
            log.debug "Blocking additional holds..."
            }
            holdCount = holdCount + 1
            log.debug "Hold count is $holdCount"
		} else if (descMap.command == "03") {
        	buttonState = "released"
            holdCount = 0
            log.debug "Hold count has been reset to $holdCount"
		}
    } 
    if (buttonState){
   	def descriptionText = "$device.displayName button $buttonNumber was $buttonState"
    return createEvent(name: "button", value: buttonState, data: [buttonNumber: buttonNumber], descriptionText: descriptionText, isStateChange: true)
    } else {
    	return [:]
    }
}

However this does not work, I get

java.lang.NullPointerException: Cannot execute null+1 @line 106 (parseNonIasButtonMessage)

Is this because the function parseNonIasButtonMessage is private? I thought groovy variables were global.

Groovy variables aren’t global and you can’t make them global in a ST context (that’s why you see methods defined to return constant values in DTHs). More to the point, I haven’t checked what you are doing exactly but aren’t you trying to preserve variables over different instances? I think you need to use ‘state’.

Because the device sends cluster 0x0008 command 02 as long as the button is held, I am trying to make a counter to ignore any commands after the first “held” event is sent, to prevent the automation assigned to “held” from continuously firing over and over again. The counter should reset to zero again when the command 0x0008 03 (release) is sent, signaling that the button is no longer being pressed.

I’d appreciate it if you could take a look at the handler here:

2 Likes