Advanced rules for kitchen motion sensor lighting

I have been trying to wrap my mind around how to do the lighting rules for my small kitchenette area, but I am having a hard time getting into RM 4 and the logic behind what I want to achieve.

Therefore I am wondering if anyone of you would be able to review and suggest how to do this.

As mentioned, I have a small kitchenette area with 3 lights. I have 2 ceiling lights and 1 under cabinet light. These are currently controlled by a motion sensor (Xiaomi) that turns the lights on if illuminance is under 150. This works well, but not quite to the level I want it.

What I do want is the following:

  1. The cabinet lights should turn on if illuminance is under 600, and ceiling lights only under 150.
  2. At a set illuminance level, I would like to turn on one of the ceiling lights at a certain level (50%), and leave it on, but once I enter the kitchenette, I want this light to raise to 80% and when leaving go back to 50%, but not turn off.
  3. The lights should turn off as epected, except if one of the ceiling lights has been turned on manually (as stated above).
  4. I have some scenes on the lights (full spectrum), for instance I will sometimes set it to full white, which I would like to have until I leave the kitchenette and then the motion sensor should turn it off and next time use the standard scene.

I have started to dabble with RM 4, but even this simple beginning is posing problems and I am sure it is totally wrong. I also find it difficult to understand how to edit my actions and I simply fumble around until I reach the correct dialog. I simply don´t fully understand the logic behind the interface.

Anyone willing to take a stab at this ?

This is what I have, and is not working:

I would suggest putting two ENDIF's before the ELSE.

Because currently you have all lights turning off only if the following occurs

  1. Kitchen motion sensor changed AND
  2. Kitchen motion sensor active AND
  3. Illumiance <600 and also > 150
    at the same time

Also, I'd suggest putting illuminance as a trigger, otherwise, illuminance will not trigger the running of this rule - say for example, you are already in the kitchen (so movement is active), and whilst cooking the illuminace drops below either 600 or 150, then the lights will NOT turn on. You need illumiance as a trigger.

1 Like

Here is a rule of mine. It's very different, but may give you an idea of how to structure the rules in RM4.

2 Likes

Thanks for the example. I will digest it and see if I can figure this out. One main gripe is how the rule editing (and action editing) is done. Any hints or advice on best practices there?

Yes, as suggested above, insert two ENDIFs before the ELSE.

It will take you 30 seconds to do that now and resolve a lot of your issues.

1 Like

Everything @mike said. I thought I'd give you another couple of samples to chew over that may or may not be helpful. I set my kitchen lights based on the lux average from several inputs. I have one rule that determines the lux and sets the level I want the kitchen to be set at, and a second rule that actually automates the kitchen.

Here's the rule that sets the level:

And this is the rule that automates the lights:

3 Likes

Thank you. I will mull this over as well. I actually discovered motion lighting yesterday and I am trying to work with that, but I might go back to a custom rule if it won´t work for me.

So, I have been tinkering away and it is sort of there, but not quite. What seems to happen now is that the timer takes over and shuts off the lights, even though there is activity in front of the sensor. It will turn off the lights, but a slight movement will turn them on again, however, only for short period (5-10 seconds) before turning them off again.

Any idea what I can do to fix this as the WAF is nearing rock bottom now :wink:

If you look at my post that's up a couple where I pasted a pic of my kitchen lights automation, you'll see under the active motion sensor part a
Stop Actions: **This Rule**.

It should stop the fade out and return the lights to 100%.

ETA: I stand corrected. I updated the hub to the latest release and now it's working fine again.

Thanks. I will add that to mine and see if it works for me. Regarding your experience with it not working today, did you update to the newest HE version ?

see my edit to my post. Yes it works fine now.

1 Like

I have now edited and tested the rule and it is working as required. Wifey is happy again and I have learnt quite a bit of Rule 4.0.

One thing I am curious about is how one would go about enabling a scene and not have it overwritten by the motion sensor settings, unless when the lights should turn off. Any idea on that front ?

I'm not sure exactly what you're asking. Why would a scene be overridden? Or are you asking what happens if you set one scene in a different way, but then your rule runs and sets a different scene?

I'm going to give this a try, just in case this might help.

Here's my kitchen rule again. There are three different scenes that the kitchen lights might have: daylight, warm, and nightlight. Lights (at least my Hue lights) will remember the last temperature/color they were set at. So, if I have daylight set and the lights go off, the next time they come on daylight will still be set.

My lights use Daylight during the day, Warm from sunset to bedtime, and Nightlight from bedtime until I get up. The only time I need to set the scene is the first time each scene is used. The other variable in the mix is whether I want the lights to be automated. The switch "Kitchen Auto Lights" is used for this. It's set to on or off in other rules based on time of day and lux level.

I use Private Boolean in this rule to determine if the scene is set the way I want, or if I need to change it back. At night the lights will always be in Nightlight mode. My "I'm getting up in the morning now" rule sets the Private Boolean rule to True. So when I walk out to the kitchen, "Daylight" is set; and the Private Boolean is then set to False. The next time the lights come on, Private Boolean is False, so the rule just sets the dimmer level because Daylight is already set.

In the Evening, the lights are always Warm and are not automated. That's set in a different rule.

Hope this helped. If not, please keep asking questions. I want everyone to be happy. :wink:

Thanks for being willing to spend your time to assist me.

I had studied your rule and indeed seen your scenes. It might even be something that I will implement in a similar way later on.

But right now the main challenge for me is to be able to do the following:

  1. Walk into the kitchen and the lights turn on (Already done and working well)
  2. Be able to enable a scene with pure white (6000 Kelvin) and 100% level for when I need that extra bit of light. This I am able to do with a scene and Google Home voice (or button), but a few seconds later after I have enabled this, the rule will detect a movement and change the lights to the setting I have set there (similar to if you would do this during the day and the lights would be reset to your day scene).

The lights are then supposed to shut off when the sensor is inactive.

I tried to do some IF magic that if I had set a scene manually, the rule would stop, but it seems I cannot get the syntax right for this as the rule just stops working again.

OK I see what you're trying to do.

I'm really not an expert here, so I'm hoping others will chime in, too.

I use Alexa sometimes to change the temperature of the lights. When I'm done, I usually just tell her to change it back. Not ideal, but it works OK.

You could add an "IF" statement to check to see if the lights are already on and not change them if they are. Something like:

IF motion
  IF lights are off
    turn lights on
  END-IF
ELSE
  turn lights off
END-IF

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.