[Migrated to Custom Capabilities] Rooms Manager: Smarter Rooms: Personalized rules based home automation with rooms Occupancy sensing from devices you already have in your home

Firstly, thanks for working on this. It’s a great concept that can go in a thousand directions. I’m still trying to wrap my head around what all your options are designed to accomplish, so I’ve been testing a few things to see how they function with my office.

In any case, I found a minor bug with the setLevel code (specifically line 1277) where it applies to the lighting rules. I seems like the thisRule.level is not passing an integer and throwing the following error on all my configured lights:
error java.lang.ClassCastException

The lights turn on but they keep the last level. If I manually change the code to a value…it works. If I change “thisRule.setLevel” to “thisRule.setLevel.toInteger()” it also works. In both case I also see some strange null values in your debug logs.

1 Like

thank you. thats sort of the plan but driven by users need is the hope :smiley:

thank you for reporting this and going the extra mile to debug it. much appreciated. havent seen similar exceptions in my own logs but something must not be right. will fix.

yeah those are my debug messages. should have turned off debug before merging. will set a reminder for myself to do so in the future.

thanks again.

1 Like

All of this smart stuff is breaking the bank so I have a question regarding motion sensors. I have about 6 rooms I am trying to setup. What would be a small number of sensors per room to get this app headed in the right direction. (1 master bedroom, 2 kids room, living room, hearth room, and a bonus room, and any other room you may suggest such as hallway or something like that)?

heres a practical approach just for motion sensors (assuming here you already have smart lights, smart switches, …)

  1. on a per room basis add up the number of times each smart device (switches / lights / etc) gets switched on in a day
  2. sort this per room count in descending order
  3. as you buy motion sensors install them in order of #2

at some point you will want to do the hallways, landings, bathrooms, garage and entryways as well. just depends on your priorities.

BTW, i highly recommend xiaomi motion sensors. they are unobtrusive, small and cheap. they dont seem to work well when one is sitting there watching it work and fretting over motion and motion timeout and counting seconds etc. but in real world usage pattern they work well. in fact for the price you can probably put a couple of them per “room” and get redundancy as well.

my other favorite is the ecolink motion sensor. i set it to test mode so it has a fast 15 second motion timeout. this works well in high traffic areas.

Ok…thanks. I didn’t see the Xiaomi motion sensors in the Smartthings motion sensors list. I did see Ecolink PIR motion detector with pet immunity in the list.

sure thing. here is the thread on xiaomi sensors. if you like to set it and forget it ecolink is a great choice.

Thanks again. Ill get started

1 Like

do you think I can get away with using Samsung motion sensors?

totally. at the end of the day if you are not counting seconds most motion sensors will work. just dont get hyper focused on seconds to timeout etc when testing this stuff initially. set it up to work for your usage pattern and you will find it works fine no matter the brand of hardware.

@bangali, I know that we talked about this but is there not a simple setting that says:

If Motion changes to active
Contact is closed
Occupied (Leave Occupied until contacts opens again)

I shouldn’t have to specify a timeout period if the above statement is true. This is assuming that there is only one way in/out of the room.


believe there is. so there is a need to differentiate between occupied and engaged. occupied is transient occupancy. engaged is persisted occupancy. so the app know how to distinguish between those two.

in engaged settings please specify the contact sensor and it should put the room in engaged state and leave everything on till contact opens again.

So if I specify a contact sensor, then should I leave the “Require motion within how many seconds when room is ‘Engaged’” blank?

If so, then I’d imagine that it would need to evaluate motion within X amount of seconds “After” the contact closes?

if you leave it blank the room will remain engaged while the contact stays closed and not be reevaluated for motion. if you set it to a value of say 3600 seconds it will check for motion at least once an hour and move it to vacant if there is no motion in the previous hour.


1 Like

K one more question, for now! :rofl:

If the door is open, and I have “When room is busy?” Medium Traffic…

I am guessing it will use the contact status first but if door is open then it reverts to “When room is busy?” setting?

correct. if the contact is open so the room is not in engaged set it will revert to the when room is busy setting to decide whether the room should be set to engaged.

heres one scenario i use this for - to turn on my outdoor lights between a time range but only when lux level is low enough. heres the settings for that:

    1. define outdoor as a “room”
    1. nothing in motion sensor and dimming settings.
    1. a) in lux and time settings pick a lux sensor and set a lux value. (i use an outdoor lux sensor via smartweather tiles 2.0 and lux value of 10)
    1. b) set turn off last switches to on
    1. create a lighting rule from time sunset to time 10:30 pm and turn on switch as the holiday light switch and save the settings.

thats it. the light will turn on at sunset or after sunset when lux drops to 10. and the lights will turn off at 10:30 pm everyday.

considering adding rules/ranges for dates as well. so you can pick the dates when these rules are run or not. any feedback on this new feature would be very helpful:

  • Add date ranges to existing rules
  • Add date ranges to global settings so they work globally for all lighting rules
  • Dont add date to ranges or rules

0 voters

So I updated I believe the child app earlier this week. Now all my rooms are not responding to motion, etc.

I tried seeing if there were additional settings that I needed to fill out with all the new features, but couldn’t see any.

All I have is 2 rooms set up in the following way:

Room 1:

Dimmer Switch 1 on/off based on last motion of 900 seconds
Motion Sensor 1 to trigger Vacant/Occupied
Lux Sensor 1 to turn on/off based off outside light level

Room 2:

Switch 2 on/off based on last motion of 5 seconds (motion sensor detects motion for 4 minutes)
Motion Sensor 2 to trigger Vacant/Occupied
Lux Sensor 1 to turn on/off based off outside light level

I have tried:

  1. Re-selecting the sensors for the rooms - Did not resolve it
  2. Deleting the existing rooms - I get an error, “An unexpected Error Occurred.”

I do like some of the new features, but this is the second time now that an update broke my rooms. I can also understand that regression testing can be very difficult (I am a software consultant :slight_smile: ), but do we see the app stabilizing soon. I travel for work during the week and it’s not fun to have the spouse message me saying the lights don’t work anymore. Sometimes I can fix thing quickly, but this, I had to wait 2 days until I could come home.

To clearify for everyone:

1. Motion Sensor Settings.
You can choose a motion sensor that will be used to change from different states in the room.
The timeout is so the state wont reset to vacant imediatly when there is no motion.
The event sets when the event is triggered, so when it switches to motion or switches to no motion.

2. Dimming settings.
This allow you to dim the lights to a level in a specified time when the room state will change to vacant.

3. Lux & time settings.
Here you can set the lux threshold for the WHOLE room, the rules cant go above this setting. The name should be changed because we moved the time setting.

4.Lighting rules.
This is probably the thing you are experiencing the most confusion with. In the rules it will specify what actions there should be when the state of the room changes to the state configured in the rule. All the setting can be left blank but they also can be all used.

So when you make a new rule, you specify a name for yourself. Lets say “occupied”. Then you set the mode you want to configure, this case “occupied”. Then you have different settings:

Which days of the week:
here you can specify what days this rule should be active. (can be left blank if wanted)

What lux value?: (can be set blank if wanted)
Here you can specify on what the luxthreshold is for this rule BUT cant go above the global set lux threshold.

Choose from time type?: (can be left blank if wanted)
Here you can choose from a time or sunrise/sunset when this rule should be active.

Choose to time type?: (can be left blank if wanted)
Here you can choose to a time or sunrise/sunset when this rule should be active.

Turn ON which switches?: (can be left blank if wanted)
Choose which switches should be turned on when this rule is active.

Set level when turning on?: (can be left blank if wanted)
Sets the level of the choosen switches (only when they have this capability).

Set color when turning on?: (can be left blank if wanted)
Sets the color of the choosen switches (only when they have this capability).

Set color temperature when turning on?: can be left blank if wanted)
Sets temperature of the choosen switches (only when they have this capability). (

Turn off which switches?: (can be left blank if wanted)
Switches off specified switches when this rule is active.

So that are all the settings that a rule can have. For now when you have multiple rules for one mode, it will choose the first one. In the future it will be possible to configure multiple rules for one mode so you can be even more flexible.

5. Engaged settings.
When room is busy?
This setting will change the room from occupied to engaged when a room gets busy. So when there is alot of movement, depending on this setting it will change when there is little motion or alot of motion.

Button is pushed?
Select a button, when this button is pushed it will switch the room to engaged.

Precence sensor?
Use a precense sensor for the next setting.

Arrival or departure or both?
Set state to engaged on arrival, state to vacant on departure or do both depending on the previous set presence sensor.

Switch turns on?
When this switch turns on it changes the room to engaged.

Contact sensor closes?
When this contact sensor (good place is on a door) closes it will change the room to engaged.

Require motion winthin how many seconds when room is engaged?
After the the state changes to engaged select how many seconds after the change there needs to be motion.

When resetting room from engaged directly move to vacant state?
Should be obvious what this does.

6. Asleep settings.
Sleep sensor to change room state to asleep?:
Here you can use a sleep sensor to switch to asleep state when sensor is asleep, or go to checking state when awake. A great sleep sensor for this is the WebCore sensor.

Timeout asleep state after how many hours?
After this set of time, the state of the room will change to checking. This can happen when you forget to change the state of the room.

Turn on which switches when room state is asleep and there is motion?
When there is motion and the state is asleep it’s possible to turn on switches. It will use the same motion sensor configured before.

Button to toggle asleep state switches?
When the lights are because there was motion while state is asleep, its possible to turn them off with this button. Or you can manually toggle them on and off with this button.

7. Adjacent rooms settings.
Adjacent rooms?
Choose the rooms that are adjacent to the current room.

If motion in adjacent room check if person is still in this room?
When there is motion in one of the adjacent rooms, the current room will change to checking state. Here it will wait till there is motion to keep the state at occupied or engaged or change to vacant when there is no motion.

If moving through room turn on switches in adjacent rooms?
When this room changes to occupied it will turn on the switches in the adjacent rooms.

8. Mode and day of week settings.
Away modes to set room to vacant?
Choose modes to set room to vacant.

Modes in which to pause automation?
Choose modes where the automations of this room will be paused.

Which days of the week?
Run the automations on these set of days of the week. Can be left blank for all week.


heres a simple way to share settings with out typing all details. no device names are actually displayed so privacy is maintained. coming tomorrow? :slightly_smiling_face:

Thank you VERY MUCH! That’s what I needed to see. An actual example because sometimes these IF, WHEN, BUT ONLY THIS, AND NOT THAT ELSE stuff can kind of be confusing.

1 Like