Rooms Manager: Smarter Rooms: Personalized home automation with Occupancy


another sample for a landing area with 4 rules and one light fixture. 166 ms from handler receiving event to exiting app.

device or app epoch type message comment
dev:376 00:38:28.269 info dW LN LI was turned on
app:216 00:38:27.991 debug motion exit: Tue Nov 20 00:38:27 PST 2018 app exits
app:216 00:38:27.976 debug engaged rooms occupancy device state updated
app:216 00:38:27.943 debug perf turnSwitchesOn: 29 ms switches are processed and all commands sent to devices
app:216 00:38:27.916 debug turnon: Tue Nov 20 00:38:27 PST 2018
app:216 00:38:27.915 debug switches: Tue Nov 20 00:38:27 PST 2018
app:216 00:38:27.913 debug execute: Tue Nov 20 00:38:27 PST 2018
app:216 00:38:27.902 debug process: Tue Nov 20 00:38:27 PST 2018
app:216 00:38:27.884 debug handle: Tue Nov 20 00:38:27 PST 2018
app:216 00:38:27.825 debug motion entry: Tue Nov 20 00:38:27 PST 2018 app receives motion event
dev:377 00:38:27.738 info dW LN MS is active motion event that is passed to app handler


here is the data from ST. this is a room with 4 rules and 2 switches. the log data does not have the same granularity. but from the device data … from the time the device registered and logged motion event to the switches getting set it was 486 ms.

device or app timestamp type message comment
device 1:26:30.377 PM COMMAND off light off
device 1:26:30.288 PM COMMAND on fan on
app 1:26:30 PM debug motion exit: Tue Nov 20 21:26:30 UTC 2018 app exits
app 1:26:30 PM debug occupied rooms occupancy device state updated
app 1:26:30 PM debug perf turnSwitchesOn: 18 ms switches are processed and all commands sent to devices
app 1:26:30 PM debug turnon: Tue Nov 20 21:26:30 UTC 2018
app 1:26:30 PM debug switches: Tue Nov 20 21:26:30 UTC 2018
app 1:26:30 PM debug execute: Tue Nov 20 21:26:30 UTC 2018
app 1:26:30 PM debug process: Tue Nov 20 21:26:30 UTC 2018
app 1:26:30 PM debug handle: Tue Nov 20 21:26:30 UTC 2018
app 1:26:30 PM debug motion entry: Tue Nov 20 21:26:30 UTC 2018 app receives motion event
device 1:26:29.891 PM DEVICE motion active motion event that is passed to app handler


in rooms anyone using these 2 features:

  1. use music player playing to set room to engaged?
  1. set window shade position using rules?

if not … I am thinking of deprecating these.

thank you.


Nope i'm not using those.


I don’t know how your apps works but, if you are seeing hub slowdowns, did you consider splitting it to make it more modular?
So people can chose which bits to install?
I don’t seem to have problems with Message Central (although it takes a while to save) and that’s up to about 5000 lines of code now.
Maybe above that is the issue?



unfortunately I am not seeing hub slowdowns. if i was it would be easier to at least triage though without visibility to logs it would be limited.

I have heard of hub slowdowns specially after updating/rebooting the hub. when the hub starts up there may be a flood of competing resource demands causing contention resulting in these slowdowns. but this is speculation based on observation not from data.

I have and have done some of it. Like over last weekend I was able to bring down the rooms child app from 6100 lines to 5500 lines by spinning of a helper app within rooms. however kind of limited in how much modularzation I can do since device objects are not serializable and are only stored in input settings of app the user entered them in and not in their parent, peer or child. which means at runtime every module every time it’s instantiated would need to call another app likely its parent to get the device objects thus limiting the benefits of modularity.

thinking about what else might be possible. open to other suggestions.



You’ve probably heard this before but I would add lots of additional logging
Maybe think about adding some try/catch routines around chunks of your code.
Sometimes this shows errors that don’t show up in normal logging.

If I have issues I’m having problems finding, I add additional logging to every method for a short while.

Not much help, I know. But as I didn’t write your code it’s difficult to know exactly how it works.



thanks for the suggestion. to clarify a bit more:

  1. I have only seen one error that was shared with me from the platform log. it was because user had updated the code but not gone thru and saved the settings so subscriptions were still referring to functions that were deprecated. this error would have shown in the user logs think the user just didn’t realize they had to go to the app and save settings after updating the code as specified in forum notes with the code release.
  2. exactly the same code runs on ST. ST logs are pretty good about logging any app errors. there are no errors in the ST logs.

as someone else mentioned earlier think it’s more to do with size of the app and the app having to be loaded every time there is a triggering event subscribed to by the app.

I am off course thinking about how else I could modify the app to work within the constrains here for every user. there are off course other platform strategies that would also mitigate dealing with large apps.

thanks again. please keep the suggestions coming.


As we discussed in our private messages.. ST has unlimited resources for running apps in the cloud.
Not sure what you can do here

Does the app slowdown at a particular point?
when a specific routine is run?

For example.. "everything was ok until I walked into the room"
I would target a helpful informed user and get them to test each scenario individually to try and narrow your search parameters.


I will figure something out. :slight_smile:

no it doesn’t.

you know @mjw-tan who started that private thread and has contributed code to the app has done that as have I. we can’t find any user scenario that slows down the hub.



not yet but as i'm about to install blinds and don't have power plugs only speakers I may have used them.


Just to maybe add a little additional info. I use the custom app HousePanel pretty heavily. The other day while messing with it I started noticing slowdowns. Through the HP dashboard and through device pages.

To make a long story short. I had a custom driver authorized in HP. After many adds and deletes and resetting up the app. I realized JP just did not like this device. No errors showed. However deauthorizing this one device out of fifty restored hub function to normal.

So my question is could the uses experiencing issues possibly be authorizing devices that are themselves causing issues with RM?


just when you think … no one is going to use that feature … its safe to remove :slight_smile:

couple of questions:

  1. you will need something other than speakers to keep the room engaged … you dont plan on having speakers play 24x7 yes?
  2. for the blinds you could always use the any device any command option available based on rules to set the blinds to certain presets?


entirely possible. just needs a bit of triaging to figure out like you did.


To be honest I haven't looked into it, as I have only just started fitting motion detectors and stuff. So if its not there I won't miss it :smile:

I have contacts on every door so this should do this?

Don't have any idea how i'm even going to make them work! there is currently no DH for the device as it brand spanking new (not even officially out)


yeah between the motion sensors and contact sensors you are good. removing the engaged with music. its only about 100 lines of code but with the hub every little bit seems to help.

ok. once there is a supported driver we can get this figured out. but any device any command that is already built in to rooms and will help with this. a lot of the window shade drivers also support levels so you should also be able to levels on rules to set this.

i will go ahead and remove this also. another 100 lines of code. :slight_smile:

btw … this will also remove the music action from the rule not from rooms manager or announcement. guessing no one uses that … but if you do just switch to using the any device any command on those rules.


down to ~5300 lines from ~6100 lines. size wise ~275 MB to ~232 MB. so -13% by line count and -16% by size.

about 100 lines each saved from removing music player for room engaged / music action and removing window shades from rules. rest from code reuse.

let me see what else i can do.


heres another feature that i dont think anyone is using. so going to deprecate this unless i hear back otherwise. :slight_smile:

rooms occupancy device lets you setup an alarm for the room and play from a selection of sounds at alarm time with the rooms music player.

if you are using this feature please ping back here.

thank you.


now down to about ~5000 lines and ~215 MB. so no longer a large app anymore. :wink:


Has it been released?