Philips Hue Dimmer Switch V2

It's the native button controller app from hubitat. Thus, I have no idea what's in line 561 of that code.

I find it just suspicious that the device page does not give me the button response anymore. As it would have lost connection to the thing again.

I'll have to play with the button controller a little to see if I can replicate using a virtual. In the mean time, I made a small change to the Dimmer code to use an interpretation of the ST Child Button instead of the Hubitat Virtual Button.

To use it you'll also need to add the child driver at:
https://raw.githubusercontent.com/thebearmay/hubitat/main/development/stChildButton.groovy

Edit:Hold off for a minute... Found a bug.

Okay, this is a new approach. With this code I don't get a button response on the device page.
Also the button controller keeps blinking orange after pairing with the hub is already done.
No error (or pushed button) in the Log, though.

I must be missing a response event (or two...)

I've added a release event to the Child, and added a couple of capabilities to both drivers. Hoping that's the issue...

Also made most of the logging optional.

Now I get the correct response in the device page. In the button control app, I still get "Cannot invoke method tokenize() on null object" error after selecting the new device in an already created button controller (what I mean with this: the old hue device as a configured item in this app). When I create a new button controller, chose the new device I do not get this error, but the device still does not work.

I was/am wondering if this is due to an old issue which excisted in ST already. As far as I remeber there was a problem with up/down/... The one button controller app used 1,2,3,4. I changed the button names in your code. On the device page the return is 1-4 now instead of up/down/... . I am not sure if the App needs another variable type or sth. though? Because the hubitat integrated "old" controller gives back 1-4 :slight_smile:

EDIT: When I use the push function on the device page it works! Not with the device itself. But also the "pushed" info, which changes with the push function does not change with the device itself. Only the "lastbuttonname" does.

Added code to both to use/process the result of sendButton at the child level; also allows for the push/hold/release commands in the dimmer driver to create sendButton requests.

Not sure if this will solve the tokenize issue or not, but it seems to close a logic loop for my thought process.

Did not solve the problem. But good for your thoughts! :smiley:

One more time....

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:10:08.559 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:10:07.518 [debug](http://192.168.50.92/device/edit/164)D4FD:3 : Hue Dimmer Switch v23 Ported Down button is pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:10:07.514 [debug](http://192.168.50.92/device/edit/164)Down button was pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:10:07.510 [debug](http://192.168.50.92/device/edit/164)Button data : button=3 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:10:07.411 [debug](http://192.168.50.92/device/edit/164)Button data : button=3 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:26.263 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:25.223 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:25.218 [debug](http://192.168.50.92/device/edit/164)Off button was pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:25.216 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:25.094 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:07.914 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:06.867 [debug](http://192.168.50.92/device/edit/164)D4FD:3 : Hue Dimmer Switch v23 Ported Down button is pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:06.864 [debug](http://192.168.50.92/device/edit/164)Down button was pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:06.862 [debug](http://192.168.50.92/device/edit/164)Button data : button=3 buttonState=02 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:06.821 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:06.812 [debug](http://192.168.50.92/device/edit/164)Button data : button=3 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:05.786 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:05.783 [debug](http://192.168.50.92/device/edit/164)Off button was pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:05.781 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:05.684 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:05.647 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:04.661 [debug](http://192.168.50.92/device/edit/164)D4FD:1 : Hue Dimmer Switch v23 Ported On button is pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:04.657 [debug](http://192.168.50.92/device/edit/164)On button was pushed

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:04.655 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:09:04.578 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:08:55.588 [debug](http://192.168.50.92/device/edit/164)updated() called

[dev:164](http://192.168.50.92/logs#pastdev164)2021-05-18 20:06:58.631 [debug](http://192.168.50.92/device/edit/164)Battery rawData: 29 Percent: 88

Thanks for your effort! It seems alright in the log, but the Button Controller app does not work. The error there still excistis, log says:
[app:21](http://192.168.50.92/logs#pastapp21)2021-05-18 20:12:15.494 [error](http://192.168.50.92/installedapp/configure/21)java.lang.NullPointerException: Cannot invoke method tokenize() on null object on line 561 (selectActions)

Furthermore, on the device page the current state "pushed" does only show the correct button when I use the device page interface for pushed (which then works). Not with the device itself.

If you run out of ideas, no problem. I hoped to install the box of controllers. But if this causes trouble, I will have to wait for the new firmware :confused:

Reworked the driver a little - mayappears to work better, but will need to ask HE staff what line 561 is looking for.

Edit: Sounds like line 561 shouldn’t be erroring out unless the “rule” has gotten corrupted. What happens if you create a new controller?

Just updated the code with your newst work. What can I say? You are the man! Thank you so much for your time and effort :slight_smile: Lights turn on/off! One is lagging turning off a bit or just one of the two bulbs is going out, which I did not experience with the old controller, but I think this is not an issue with the device code and will have to create a new button controller to check it out.

Edit:
Alright, I caused the lagging/problem probably because in my try out sessions I put in the child devices into the controller as well, which caused an overload apperently.
It works now, but one thing I realized after kicking the child devices out and looking into the log:
dev:12021-05-20 12:24:43.783 infoEsstisch 1 was set to 50%

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:36.088 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is released

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:36.082 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:35.444 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned off

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:35.428 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was turned off

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:35.183 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned off

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:35.000 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:34.996 [debug](http://192.168.50.92/device/edit/164)Off button was pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:34.991 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:34.842 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:34.134 [debug](http://192.168.50.92/device/edit/164)D4FD:1 : Hue Dimmer Switch v23 Ported On button is released

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:34.130 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:33.660 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was set to 30%

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:33.503 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned on

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:33.488 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was turned on

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:33.224 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned on

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:33.057 [debug](http://192.168.50.92/device/edit/164)D4FD:1 : Hue Dimmer Switch v23 Ported On button is pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:33.054 [debug](http://192.168.50.92/device/edit/164)On button was pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:33.050 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:32.957 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:32.040 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is released

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:32.036 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:31.425 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned off

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:31.385 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was turned off

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:31.120 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned off

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:30.972 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:30.959 [debug](http://192.168.50.92/device/edit/164)Off button was pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:30.955 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=02 buttonHoldTime=02

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:30.774 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=00 buttonHoldTime=00

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:23.643 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was set to 50%

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:20.450 [debug](http://192.168.50.92/device/edit/164)D4FD:1 : Hue Dimmer Switch v23 Ported On button is released

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:20.447 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:19.875 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned on

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:19.863 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was turned on

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:19.549 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned on

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:19.393 [debug](http://192.168.50.92/device/edit/164)D4FD:1 : Hue Dimmer Switch v23 Ported On button is pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:19.389 [debug](http://192.168.50.92/device/edit/164)On button was pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:19.385 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:19.280 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:13.690 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is released

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:13.685 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:13.483 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was set to 4%

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:13.102 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was turned off

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:13.074 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned off

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:12.847 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned off

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:12.626 [debug](http://192.168.50.92/device/edit/164)D4FD:4 : Hue Dimmer Switch v23 Ported Off button is pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:12.622 [debug](http://192.168.50.92/device/edit/164)Off button was pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:12.618 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:12.495 [debug](http://192.168.50.92/device/edit/164)Button data : button=4 buttonState=00 buttonHoldTime=00

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:05.996 [debug](http://192.168.50.92/device/edit/164)D4FD:1 : Hue Dimmer Switch v23 Ported On button is released

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:05.992 [debug](http://192.168.50.92/device/edit/164)setReleased()

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:05.521 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned on

[dev:1](http://192.168.50.92/logs#dev1)2021-05-20 12:24:05.327 [info](http://192.168.50.92/device/edit/1)Esstisch 1 was turned on

[dev:2](http://192.168.50.92/logs#dev2)2021-05-20 12:24:05.050 [info](http://192.168.50.92/device/edit/2)Esstisch 2 was turned on

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:04.907 [debug](http://192.168.50.92/device/edit/164)D4FD:1 : Hue Dimmer Switch v23 Ported On button is pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:04.892 [debug](http://192.168.50.92/device/edit/164)On button was pushed

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:04.889 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=02 buttonHoldTime=01

[dev:164](http://192.168.50.92/logs#dev164)2021-05-20 12:24:04.811 [debug](http://192.168.50.92/device/edit/164)Button data : button=1 buttonState=00 buttonHoldTime=00

I have no idea where the "dimming to x% comes from" (I only have one controller, which is configured to off or /on) and also why the bulb sometimes gets 2 signals? I will look into it / create a new controller and check out if this is better :slight_smile:

1 Like

Glad to hear, finally wrapped my head around what the code was trying to do vs. just making the code compile and send messages. Can't look at the code right now, but from what I remember if you hold the Up or Down button it may be generating a Dimmer request (that I don't remember handling - so something to look at if it's an issue, just need to add the switchLevel capability to the child devices) through the setReleased method.

Howdy, apologies if this is easily solvable. I've got this switch and installed the driver and I can see in the device events that button presses are registering. However, I can't actually use any of the buttons in Button Controller. What do I need to do to make these buttons useable? Thanks for helping out a newb who's spent hours googling!!

In Devices, once I click on the device under current states, this is what is listed:

Current States

  • battery : 77
  • lastButtonName : On
  • lastButtonState : released
  • lastCheckin : 08-17 18:04:05

That's all! Shouldn't it also list the buttons that are available? Thanks again for the help!

Hi,
you should not be compelled to use this custom driver anymore, since the Dimmer Switch v2 is natively supported with the new firmware 2.2.8. Anyways, if you want to use it: For me it sounds like you have not installed the cild driver.

For anyone that has used the V2 and V1 with Hubitat, are there any differences once connected or are they both the same, eg in terms of features and response time

Since I assign the buttons in hubitat as I like, I do not see any differences in features. Response time feels the same. I do prefere the V2 due to haptic and the bigger plate covering the German switch outlets, though.

1 Like