Please help a brain that struggles with logic!

Hello, I’ve managed to get some basic bits and pieces created with Reactor, but my mind collapses into fragments when I try and do anything remotely complex (I’ve always struggled with logic conditions). What I’d like to do is automate my hallway lights thus:

Only come on with movement sensor triggered
Only come on during hours of darkness ( either dusk-dawn or when below certain lux level)
If the light switch is triggered, turn on the light, monitor for movement, then turn off again if no movement is sensed after a few minutes.

I would also love it if the hallway light could be made to come on at a lower brightness setting if the house is in Night mode, and a higher brightness setting if it is in Home mode.

If anyone can point me in the right direction of how to structure all of this I would be very grateful.

Thanks so much!

So your first group would look like this

(AND) Group Motion on Light on

  -Motion is detected
  -LUX > # (if you’re using a light sensor)

Then under the chevron / for your conditions group “Group Motion on Light On” set the delay reset to however long you’d like the light to stay on after motion has been detected.

If you’re ever confused about Reactor look through the well written docs and videos, they have solutions to these problems documented :slight_smile:

DISCLAIMER: The following should be considered “Advanced Usage” of Reactor and is therefore not the first nor best approach for a new user. You can get the same results by building a routine with the customary (non-Expressions-based) blocks, such as the built-in [HOUSE MODE] [is…] []Home []Away, etc.

I just whipped up an Expression you may find helpful, one which yields different brightness values (which you certainly can modify - I just typed in random whole numbers) depending on the current House Mode. Since this is the kind of thing Reactor can easily do, but which a novice might not think to construct, here goes:

hallLevel :== choose(tonumber(getstate( 175 , "urn:toggledbits-com:serviceId:Reactor" , "HouseMode" )),20,40,75,100)

Let me deconstruct this so it makes sense, and you can then copy and paste the right-hand portion into your Reactor’s “Expressions” section. I named the variable ‘hallLevel’ so that’s self-explanatory. The “choose” function is a LuaXP function which returns a value based on an index number. (Since there are only four House Modes – Home, Away, Night and Vacation, which Reactor numbers internally as 1, 2, 3, and 4 – this serves as an easy index!) The function is of the form CHOOSE(index, var1, var2, …).

NOTE: I had to wrap CHOOSE inside of a TONUMBER() so that its output – which looks like a number but is technically text, i.e. “1”, “2”, “3” or “4” – is forced to become numeric.

In the ‘index’ slot, I’ve inserted yet another Reactor-specific command, “GET”, which extracts the value of a specified variable (in this case, “HouseMode”) directly from a given device (#175 – replace this number with that of your own Master Reactor!).

For the other slots, I’ve typed four ‘brightness values’ which you can also modify to suit your needs. Granted, you may only care about the number in the 3rd ‘var’ slot (since that corresponds with ‘Night’ mode), but keep all four slots filled to prevent errors.

Lastly, you would use the output of this variable expression within your Reactor “Activities”, such as the Device Action which turns on the hallway light, by typing {hallLevel} in the ‘newLoadLevel’ field. (Pro tip: By first deleting any existing numbers from that field, it becomes a clickable drop-down list of all available Expression variables, and you could just pick {hallLevel} using your mouse.)

Hope this takes you to the next level! Reactor is the best, but we all know there’s a bit of a learning curve to become proficient.

1 Like

Thank you gentlemen, this will be something for me to look at over this weekend. My hope is to get one working correctly then use that as a template across the house.

I would also suggest you watch the Reactor Videos, work a bit on what you want to accomplish, and if you get stuck watch the videos again.

1 Like