HowTo: Use Philips Hue sensors (Motion Sensor / Dimmer Switch)

If you followed my instructions in the initial post you will probably use 5 seconds. You can find the value in this line of code

hueMotionSensorPresence.updateInterval=5000

OK, got it.
Yes exactly 5 sec.
Should I decrease it?

If you want to have faster updates from the sensor, Yes.

1 Like

Fair warning The Hue binding now supports sensor integration. This tutorial is deprecated.

4 Likes

Is there any documentation on how to try this. I’m running openhab2.4 m7.

The new feature has been merged today. You will have to wait for the next snapshot or milestone build. A preview on the documentation.

1 Like

Thanks Christoph. I went a head and tried you test version.

Seems to be working very well on my self-up (22 lamps/ 5 motion sensor). I’ve only configured this manually through item/things files so I haven’t played with the auto side through paperui.

In terms of documentation I was more looking at changing poling settings etc. For example I believe the presence sensor update at 500ms intervals and I can see that. But what frequency do other other sensors update at e.g. temp/light? For instance if I switch on a light in front of the the sensor it does take some time to update (many seconds).

Thanks for the hard work here… working well.

Sounds good. I am happy to hear, that it is working.

Nice catch. Indeed it is not mentioned in the docs. Do you have time to add it? The polling interval for all sensors is by default 500ms (expected value in milliseconds, min. = 50ms). The polling interval for lights is by default 10s (expected value in seconds, min. = 1s). You are able to adjust both values for your needs like this:

Bridge hue:bridge:1 [ ipAddress="192.168.0.64", userName="qwertzuiopasdfghjklyxcvbnm1234", pollingInterval=5, sensorPollingInterval=250 ]
1 Like

Thanks christoph!! Been waiting for this one!

Hello,

I bought myself a Hue motion sensor, for the measurement of the ambiant light.
Unfortunatly Openhab is unable to find the sensor.

When I look on the Openhab Docs it states it is supported and this tutorial confirms this.

I am running OH2.3 Stable and updated the system through the openhabian-config tool.
Unfortunatly it didn’t help.
I’ve got the feeling the binding should be version 2.4 but is still 2.4, did the update fail or aren’t bindings updated until there is a new 2.4.0 stable version?

I found and testen a 0.10.0.jar version downloaded via a link somewhere in this thread.
But this is a test version, if I.m correct and doesn’t work with my version.

If I need version 2.4.0 binding, where can I find the update file and is it correct that it is just a drop of a .jar file into the addons folder?

Thank you for your help.

Regards,
Edwin

Hi Edwin,

The new feature will be part of OH 2.4 which will be released in a few days (December 17th). The linked version (.jar file) will not work with OH2.3. If you cannot wait any longer I recommend to update to a milestone or snapshot version.

This is a great thread that helped me to use my Hue sensors in openhab 2.3.

Now with openhab 2.4 the Hue sensors are supported by the Hue binding and sensors are auto-discovered.

Maybe this should be added to the start of the main post.

@cweitkamp

Hello Christoph, thank you for this awesome enhancement. :slightly_smiling_face: I’ve installed snapshot version 0.10.0.201812160950 yesterday.

Everything works great. I have two “Hue Motion Sensors” and one “Hue Dimmer Switch”.

Unfortunately there is a little error in Documentation

demo.items:

DateTime MotionSensorLastUpdate   { channel="hue:0107:motion-sensor:last_update" }

You missed a “d” in the word “last_updated”, so it should be:

DateTime MotionSensorLastUpdate   { channel="hue:0107:motion-sensor:last_updated" }

One hint for “Hue Dimmer Switch”:

I’ve created a hue.map transformation, with the following content:

1000=Button(ON) INITIAL_PRESSED
1001=Button(ON) HOLD
1002=Button(ON) SHORT RELEASED
1003=Button(ON) LONG RELEASED
2000=Button(DIM UP) INITIAL_PRESSED
2001=Button(DIM UP) HOLD
2002=Button(DIM UP) SHORT RELEASED
2003=Button(DIM UP) LONG RELEASED
3000=Button(DIM DOWN) INITIAL_PRESSED
3001=Button(DIM DOWN) HOLD
3002=Button(DIM DOWN) SHORT RELEASED
3003=Button(DIM DOWN) LONG RELEASED
4000=Button(OFF) INITIAL_PRESSED
4001=Button(OFF) HOLD
4002=Button(OFF) SHORT RELEASED
4003=Button(OFF) LONG RELEASED

and the corresponding item looks like:

Number 		HueDimmerSwitchButton		"Hue Dimmer Switch Button pressed [MAP(hue.map):%s]"	{ channel="hue:0820:xxxxxxxxxxxx:15:dimmer_switch" }

.
.
Now button state is “readable”.

image

1 Like

Thanks for the hint. I will take care of that.

Great map. Just in case: here you can find an example on how to use the dimmer_switch_event in a rule.

1 Like

I’m trying to get rid of the “.0” behind the events received from the Tap and Dimmer switches. (@cweitkamp: may I suggest to fix that in the binding? :smiley:)

This is my first attempt at using a profile to transform a value received, so I may have misinterpreted the OH2 documentation here.

The hue.map file content:

16=Button TopLeft
17=Button BottomLeft
34=Button TopRight
18=Button BottomRight

The Item with a transform profile:

String TS_Kitchen "Tap kitchen" (gKitchen) {channel="hue:0830:xxxxxxxxxxxx:tap_kitchen:tap_switch" [profile="transform:MAP", function="hue.map", sourceFormat="%.0f"]}

To be sure, I’ve also tried with sourceFormat="%d", but it always generates an error stating it cannot transform:

[al.profiles.MapTransformationProfile] - Could not transform state '16.0' with function 'hue.map' and format '%.0f'

It looks like the map transform function is called before the source format function. Or… what am I missing here?

Yes, of course. Unfortunately this is part of OH2.4 stable thus it will be a breaking change.

Personally I would omit the “sourceFormat” in this case.

Indeed, it works without sourceFormat parameter and a transform of for instance ‘16.0=xxx’. It makes me wonder how sourceFormat is supposed to work, but that’s no topic for this Philips Hue sensors thread.

I get that, but I hope it can become part of 2.5 (and of course you could introduce a ‘legacy’ parameter if you want to go all fancy… :sunglasses:).

I just noticed: when starting OH the last Dimmer and Tap events are fired again, just like the button was pressed.

:10.356 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - HUE Dimmer switch event hue:0820:xxxxxxxxxxxx:dim_hall:dimmer_switch_event triggered 4003.0
:10.356 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - HUE Dimmer switch event hue:0820:xxxxxxxxxxxx:dim_bedright:dimmer_switch_event triggered 4002.0
:10.357 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - Dimmer Button 4 short released
:10.357 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - Dimmer Button 4 long released
:10.357 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - Dimmer Button 4 short released
:10.358 [INFO ] [model.script.HUErule.TapSwitch.Event] - HUE Tap Remote switch event hue:0830:xxxxxxxxxxxx:tap_kitchen:tap_switch_event triggered 17.0
:10.359 [INFO ] [model.script.HUErule.TapSwitch.Event] - Tap Button 2 triggered
:10.359 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - HUE Dimmer switch event hue:0820:xxxxxxxxxxxx:dim_toilet:dimmer_switch_event triggered 4002.0
:10.360 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - Dimmer Button 4 short released
:10.360 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - HUE Dimmer switch event hue:0820:xxxxxxxxxxxx:dim_outdoor:dimmer_switch_event triggered 4003.0
:10.363 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - Dimmer Button 4 long released
:10.359 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - HUE Dimmer switch event hue:0820:xxxxxxxxxxxx:dim_bedleft:dimmer_switch_event triggered 4002.0
:10.365 [INFO ] [el.script.HUErule.DimmerSwitch.Event] - Dimmer Button 4 short released
:10.364 [INFO ] [model.script.HUErule.TapSwitch.Event] - HUE Tap Remote switch event hue:0830:xxxxxxxxxxxx:tap_dining:tap_switch_event triggered 34.0
:10.370 [INFO ] [model.script.HUErule.TapSwitch.Event] - Tap Button 1 triggered

This could lead to unexpected behaviour, for instance when a button was pressed last night and another event/trigger changed the lights in the mean time.

My dimmer switch items are type number and not string…