How to use Hue motion sensor

Hi all,
what is the simplest mode to use a Hue motion sensor? I read a deprecated tutorial but new hue binding recognize all the function of my sensors.
Now, have I to use a rule or is it possible to link it with my knx light by the cms?
I make a rule and it work for motion sensor but I’d like to activate it only with a low lux quantity.
I write my rule:

rule “sensore corridoio corto”
when
Item MovimemtoCorridoio_Motion changed
then
Relay8Uscite_CorridoioCorto.sendCommand(if(MovimemtoCorridoio_Motion.state == ON) ON else OFF)
end

Did you check the binding documentation? There you find the channels to use and link to an item for the light level. You can use illuminance, light_level, or the dark switch as item. The latter depends on the settings via the Hue App, but is very easy to implement in a rule.
What you can do for example:

  1. Create a Switch Item that links to the dark channel of the Hue motion sensor; let’s call it ItIsDark.
  2. Set the appropriate light level and times in the Hue App.
  3. Change your rule to deal with the light or dark condition:
rule “sensore corridoio corto”
    when
        Item MovimemtoCorridoio_Motion changed
    then
        if (ItIsDark.state == ON) {
            Relay8Uscite_CorridoioCorto.sendCommand(if(MovimemtoCorridoio_Motion.state == ON) ON else OFF)
        }
    end

If you want to deal with the edge case of detecting motion right before it turns to daylight, you can do the check for dark state inside the existing if, like ..._Motion.state == ON && ItIsDark.state == ON) ...
The light level gets update every 10 seconds by default, which can be changed with the binding configuration parameter pollingInterval as stated in the binding documentation.

Alternatively, you can create an item for the light level linked to the illuminance channel and compare the reported level to a self-defined threshold in the rule, like:

if (MovimemtoCorridoio_Illuminance.state < 5) {
  ...

BTW, did you notice that the Hue motion sensor triggers the OFF state about 10-15 seconds after the last motion is detected? This means your rule will switch the light off within 15 seconds after the last motion is detected. If that is not what you want you can resort to a timer or switch with expire option to prolong the period.

thank you for help Ron.
I made a rule like you suggest:
rule “sensore corridoio corto”

when
Item MovimemtoCorridoio_Motion changed
then
if (LuminositCorridoio_Dark.state == ON) {
Relay8Uscite_CorridoioCorto.sendCommand(if(MovimemtoCorridoio_Motion.state == ON) ON else OFF)
}
end

but when the light starts, the switch DARK go off and the rule don’t work to shout off the light…
maybe I can create two rules:
one to start the light with the dark condition and another one to shout off the light without the dark condition.
what do you think about?

EDIT:
Here my rule. I think it work fine, but I have to test it!

rule “sensore corridoio corto accende”
when
Item MovimemtoCorridoio_Motion changed
then
if (LuminositCorridoio_Dark.state == ON) {
Relay8Uscite_CorridoioCorto.sendCommand(if(MovimemtoCorridoio_Motion.state == ON) ON )
}
end

rule “sensore corridoio corto spegne”
when
Item MovimemtoCorridoio_Motion changed
then
if (MovimemtoCorridoio_Motion.state == OFF) {
Relay8Uscite_CorridoioCorto.sendCommand(OFF)
}
end

Maybe someone could join both in a unique rule

Edit 2

@noppes123 was right, I made this rule:

rule "sens corr corto"
   when
        Item MovimemtoCorridoio_Motion changed
   then

            Relay8Uscite_CorridoioCorto.sendCommand(if (LuminositCorridoio_Dark.state == ON && MovimemtoCorridoio_Motion.state == ON )ON else OFF)

   end

It should be ok but I have a problem.
When motion sensor update his status from ON to OFF, the light go off but the dark switch (and the lux status) don’t update his status. Then the dark switch still in OFF status and the rule don’t work the second time.
Someone know how to fix it? :open_mouth:

Hi,

one q: how did you get this if (MovimemtoCorridoio_Illuminance.state < 5) { working? I use a similar rule, but it never get activated.

if ((HUEambientlightsensorWohnzimmer_Beleuchtungsstarke.state) < 50.0) {

The Illuminance state, when I log it, is e.g. 3.145 lx. Did the rule work with your condition?

br
a

That has units, so you need to compare that with a quantity with units too.
(Fewer Items had units three years ago)

If you are using DSL rules, the | pipe character works magic for us

if (HUEambientlightsensorWohnzimmer_Beleuchtungsstarke.state < 50.0 | lx) {

More detail