SmartThings Community

[BETA] Hue Motion Sensor (beta) (no hue bridge)

I have just finished building a Device Handler for the Hue Motion sensor and thought I would share it with the community.

Note that this is very much beta and rather potatoe quality code as its my first device handler but it is working for me. I will happilly entertain suggestions and improvements.

Motion

  • Detects motion and illuminates a red LED on the device
  • Sleeps for about 60 seconds before sending a no motion response

Temperature

  • Seems Accurate

Battery

  • Works but likely not calibrated very well

Illuminance Measurement

  • Returns a value that changes based on lighting, However I am not familiar with lux measurements and have nothing to compare it to for calibration. I get around 160 with normal indoor lighting and about 40 in my dimly lit bedroom, but I think that is wrong
14 Likes

Hi Stephen,
Well done for producing this DH.
I’ve been playing and can confirm the following for from the logs.

Temperature
This is reporting every 10 minutes and seems accurate in comparison to my ST Motion Sensor in the same room.

Motion
When it detects motion (under 1 second), motion stays active for 30 seconds. It does not report motion for another 30 seconds after it reports no motion.
If motion is detected within the 30 second window after it reports no motion, I think a timer starts. Then 30 seconds after no motion, if motion has been reported in that time span, it reports motion.e.g.
Motion active 0-30 secs.
No motion. 30-60. It will not report.
20 secs into 30-60 window. Motion happens.
After 60 secs. Reports motion.
After another 10 secs. No motion reported.
Hope that all makes sense. :wink:

Illuminance Measurement
I’m not sure this is working properly yet. I’m not seeing anything in the logs.

Just thought I would report my findings for you.

TBH I think you have done a great job. I wouldn’t know where to start.

It also shows what a great platform this is when guys like you seem able to knock up some code very quickly, that lets guys like me use all the devices that are available out there.

Again, well done and much appreciated.

EDIT. If you hit the refresh button, then the lux value does update.

1 Like

Tagging @erocm1231 @Sticks18 @pstuart @JohnR @mitchp @tpmanley @Tyler @aaron @slagle @jody.albritton

This is cool. :sunglasses: The OP has the new hue motion sensor paired directly to the SmartThings hub and working with a custom DTH. Apparently it has two fingerprints, one as a ZLL device and one as a ZHA occupancy sensor. If you can get it to pair as the ZHA device, you can use it with SmartThings. And this Device is available in both the US and the EU.

1 Like

Wow I am sure glad I currently live in Canada, that is almost a $20.00 premium over what I paid for mine. Interestingly I paid 39.99 CAD for mine so it looks like for once we get something cheaper than everyone else.

1 Like

I have set up pollster to refresh the device every 5 minutes and this does the trick for getting the lux reading updated.

As a heads up, Pollster has it’s uses but can also be taxing on the system. If you are running a dedicated Pollster instance for Lux, you may want to scale it back for less frequent than 5 min. If you have the instance tied to a bunch of devices, then feel free to ignore me (or shoot me a DM and we can kick around ways to limit the use of polling smartapps)

I agree. Cool!

3 Likes

Hi Aaron,
Thanks for the info.
I will scale it back to every 15mins as I have a Fibaro Motion Sensor that I use for lux level triggers.
Just a follow-up question, are you recommending that we do not set pollster to less than 5 minutes to keep the load on the system down.

Hi @Stephen_McLaughlin
Is there any way you can get the DTH to automatically update the lux value every x minutes?
If this could be configurable by the user that would be even better.
Thanks.

Right now the dth should be binding to that cluster and getting changes as they happen. But its not working I will check the code later today perhaps I mistyped something.

1 Like

Rather than having the DTH update for every change, consider making the DTH update if Lux changes by X%. I think @ady624 had done something similar with power outlets (see here) to make sure they didn’t go crazy when loads fluctuated.

2 Likes

Aaron,

You are very right, Currently (if I recall correctly) I ask the device for updates between 30 and 600 seconds whenever there has been a change of 10 or more. This may actually be the problem or I could be misunderstanding the zigbee function I am using. I am at working right now but I will check when I get home.

That sounds about right actually…
Some rather typical ranges here:
http://www.engineeringtoolbox.com/light-level-rooms-d_708.html

1 Like

Thanks for this DH!
Wanted to check if this DH allows enabling/disabling the motion sensor?

The native Hue App allows this feature which i found extremely useful. (Eg:- Disabling Motion during movie time etc)

Thanks again!
Shashank

Currently it does not, I have never used this sensor on a hue hub (I am not entirely sure where my hue hub is).

I understand your use case but I think in the SmartThings ecosystem that functionality is supposed to be achieved with modes. I would love to hear opinions from others though.

1 Like

Hue bridge, not Hue hub.. Just sayin’, :wink:

1 Like

I have just update github with a version that improves the lux readings. I still have no idea if its calibrated but turning the lights on or off in the room is now updating the value,

Max update time is once per minute, requires a value change of at least 20, Otherwise it will update after 10 minutes.

Correct, in the SmartThings paradigm individual devices are not disabled as they are in some other home automation systems. Instead, individual rules determine what to do with device reports, including whether or not to ignore them. This can be accomplished through modes, through the time of day when a rule runs, or, if you are using core, through many other conditionals.

For example, at my house there is a motion sensor in the bedroom. During the day, it is ignored. In the evening, and event from the motion sensor will turn on the overhead light. Late at night, an event for the motion sensor will not turn on the overhead light – – it will turn on a soft night light on the wall. But these decisions are made in the rule, not in the device type handler. :sunglasses:

1 Like

Thanks Stephen and JD for your responses!

Yes, currently my setup has become so complex that it may require a dedicated operations team to support it :slight_smile:
I do have many modes and rules setup running some other use cases.

Currently the use case I am struggling with is to disable the motion sensor which triggers a GE Z Wave Light Switch and 2 Hue Bulbs ONLY when I am watching a Movie (Currently Apps in Roku).

Hopefully, I will get an Android TV or OpenElec setup so that I can try the below integration which can help me

Thanks

Hi Stephen.
Just some feedback for you.

Lux seems to be reporting OK and although it is giving a slightly different reading to my Fibaro one it is not that far away and I suppose its all relative anyway. If the lux value is used to trigger stuff then the level is set accordingly in the rule.
What i have done is added the bold italic bit in line 64. See below.
state(“illuminance”, label:’${currentValue} Lux’, unit:"lux"
This puts the word Lux in the Lux reading circle. Just my take. :wink:
Temperature seems to be reporting accurately too.
Motion seems to be quicker to react than my Fibaro or ST motion sensors.

The ony thing I have noticed is that under the live logging is the folllowing:-
Lux value appears OK in live logging as it does in the ‘Recently’ tab.
Motion does not appear in live logging. Does appear in recently tab.
Temperature does not appear in live logging. Does appear in recently tab.

As said above these are my observations on your DTH and are not meant in any way to be a criticism.
What I will also say is that you have done a brilliant job and you get my vote for ‘Ninja of the Week’. :turtle:

Thanks again.

1 Like