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

That’s the reason why i think HUE is not a good motion sensor for openhab. If you want to monitor temperature,humidity and lux then just get the cheaper miflora

Well, if you depend on the polling - probably yes. But if you use it in combination with the native zigbee binding of @chris, the HUE motion sensors work quite well:

Presence is reported immediately.

I know, abandon the HUE bridge and switch to the native zigbee binding suits not everyones use case or requirements. But if it does, it’s worth a try :wink:

Some drawbacks though: Temperature reporting is quite inaccurate (probably the same in @cweitkamp’s solution?) and battery level is not working. AND: the LED is flashing red when movement is detected. This is different to the behaviour when paired with a HUE bridge IIRC.

This requires a different HUB, any recommendations on this. Also I can not find any discussion on the HUE motion sensor in here with native zigbee binding, do you have a link to how to implement it?

Search for Zigbee binding.

Sure:

:wink:

Hi Christoph.
After updating to milestone M5 i get this error every 6-8 hours.

2018-11-04 02:08:31.716 [ERROR] [org.openhab.io.net.http.HttpUtil    ] - Fatal transport error: java.net.SocketException: Too many open files
2018-11-04 02:08:31.717 [ERROR] [ab.binding.http.internal.HttpBinding] - No response received from 'http://192.168.1.118/api/***/s$2Fmp/sensors/11'
2018-11-04 02:08:32.224 [hingStatusInfoChangedEvent] - 'hue:bridge:0017****' changed from ONLINE to OFFLINE: Verbindung zur Hue Bridge unterbrochen.

I have wrote a new topic for this, but now i see that sensor11 is a motion sensor which works with your code. The refresh intervall ist 750. Before updating to M5 all runs okay. Now the system makes a restart. And the cpu load increases up to 6% in the middle from 2% before.

Switch   HueMotion1           "HueMotion1"               {http="<[http://192.168.1.118/api/***/sensors/11:750:JS(getHueMotion.js)]"}

(function(i) {
     var json = JSON.parse(i);
     return ((json['state']['presence'])) == true ? "ON" : "OFF";
             })(input)

Has there something changed to stable 2.3?
Thanks and greetings,
Markus

Hi Markus,

I am pretty sure a lot of stuff has changed since OH2.3 :wink: but I cannot imagine something which is related to the HTTP binding. I do not poll my sensors with such a high frequency. And the HttpUtil uses a default timeout of 5 seconds. Maybe you have to look deeper into that to solve your issue.

Hi @cweitkamp

I saw in github that you are taking over to implement motion sensor support into the hue binding itself. Is the plan to only support motion sensor or is the dimmer switch also in the todo list? One other thing that I saw was the internal scenes of hue api. See this thread. Would a scene selector also be something to implement in the binding?

P.S. Looking forward for your work and to test the new features of the binding

Hi Miika,

Yes, that is true. I already put some code together to make it stable and usable for others. I would love to provide a test version for everyone who is interested. The current solution will support the Hue Motion Sensor - splitted up into three different things (motion sensor, temperature sensor and illumination sensor) - and the Dimmer Switch as well.

I agree with you that scene support will be a great feature too. But first I will focus on the sensor support.

1 Like

I am very interested un testing out your binding,

Wouldn’t it be more logical to implement the physical thing as a thing and that the thing has channels such as motion,time,temperature and lux?

Then it would have multiple “last updated” channels for example. I think separate things are much better. Even every lightbulb is its own thing under hue bridge.

I will prepare a test version later this day and link it here.

Yes and No. See this discussion why we split it up.

1 Like

You can download a test version here. Please play around with the new sensors, discover all features and let me know if some thing went wrong. Have fun.

// EDIT: I changed the link.

Err, just out of curiosity: How did you manage to get that commit into the ESH repo…?

Hm… interesting. I will PM you.

Hi @cweitkamp

Appears to be working ok so far. Tested adding Things/Items via Paper UI and manually via my Things/Items file and both ways were fine and data is being reported back.

Will monitor it over the weekend.

Nice. May I ask you to watch for the performance / load of your CPU beside the new features? The default polling interval is high (500ms) to havr a reliable motion detection.

Will do. Any particular command etc you want me to use?

Dear Christoph,

wow, that was quick! I’m really looking forward to use your latest additions.
I have no IDE set up yet and I’m on stable 2.3, so I guess I can’t use it yet, but I’ll see to that when I have a bit more time at hand.

No, nothing special.

Yes, that is right. You need at least OH2.4.M5 milestone.