"Working From Home" mode?

I’m trying to figure out how to do the following

If after time of day on certain days AND certain presence sensor/iPhone is present
Then trigger Working From Home mode.

My wife works from home a lot and I would like to trigger a work from home mode when she is home after a certain time.

Interesting idea, I’ll try writing a SmartApp tomorrow.

Here’s my first attempt (not really tested yet, but it might give you some ideas, if you write code): https://github.com/sudarkoff/smarttings/blob/master/WorkingFromHome.groovy


Wow…can you do that a little faster next time? :wink: Thanks! This is awesome.

This should be added to the labs and then converted into a standard app. Hopefully this process will start speeding up!

Well, I haven’t really tested it and typing that much text takes me just a few minutes. :slight_smile:

I’ll definitely clean it up, add a few things (Push/SMS notification, etc.) and publish.

When a published app is updated (one that is in the labs, etc), does everyone get the updated version? If so, does it indicate when it was updated in case new functionality is added?

@sudarkoff OK, I have done some testing with this and ran into issues…not that I should really complain since you made this for me in literally minutes, but I also think this might be useful for others.

Issue 1 - I selected both myself and my wife under “When these people”. My wife is working from home today and it never triggered. The other settings were weekdays, after 8:15, only when mode is Home (which it currently is). It is set to perform the Hello, Home action “Working from Home”.

I think this issue might be related to both of us being selected. Is it looking for both of us to be there or only one of the people selected (which is what it should be looking for, in my opinion).

Issue 2 - There is only a"Still at home after" option, there is not a time range. For example, If this is an app to convert modes “when people don’t leave”, but it will potentially make changes if someone has left (say me today with my wife at home) and then I return that may conflict. When I return, it should switch to “I’m Back” and unlock our door. But, If I’m part of the SmartApp, will it conflict and try to set to “Working from Home”? Will adding a stop time help with that? Is there a way to prioritize the mode change so that I’m Back takes precedence over Working from Home?

Obviously, these are the complexities I did not think of when I asked for the app. I should have thought it out more clearly. Sorry about that!


Sorry, I should have been clearer - this app has not been tested at all. I just typed it up and went to sleep. I will let you know when it’s working.

  1. You’re right, the code expects ALL selected people to be absent to trigger the mode change. I think it would be easier to install an instance of an app per person as you theoretically might want to have different actions for different people. I’ll update the app accordingly (not allow multiple selection, add some text explaining why, and add a field for a custom name).

  2. The “Still at home after” time is triggered exactly once per day. So say, you choose 9:30AM. At 9:30AM each day (and only once) the app will check whether the specified person is still present and trigger the WFH action. If you’re gone at 9:30AM and come back 5 minutes later, the WFH mode will never get triggered. Looks like it’s not what you were looking for. I’ll have to think more about how to avoid conflicts with the “I’m back” action.

I thought I was the test! :smile:

Everything sounds good.

Updated (and now also tested :)) version at the same URL above. You can install more than one instance, but I’m not sure yet how to allow a custom name.

OK, it executed today, but at 10am. The app is set for 8:15am. I originally set the app to 10am when I first installed it. I then updated the code to your code above and set it to 8:15am. But, it still seems to keep the 10am. Not sure where to look. But, I love that it works!!!

Do you have a My Apps section on the Dashboard in the mobile app? (I think there is a bug, one of my phones did not have that section until I reinstalled the app). Check that section to see if maybe you have more than one instance of the app? If not, maybe uninstalling and reinstalling would help?

Just curious, what kind of actions do you trigger with the app?

BTW, I’m trying to figure out how to allow customizing the app’s tile label and once I do, I’ll publish the app so you won’t have to do this copy-pasting dance.

I do have the My apps section. I had to logout and log back in to get it. As for the actions I trigger, it is just the “Working from Home” Hello action. All that action does, at the moment, is lock the doors.

Do you still see the issue?

My “Working From Home” action turns on the “Daddy Needs to Focus” mode. Which causes my desk lamp to turn on if there’s motion in my office and the door is closed.

Don’t know yet. Won’t know until Tuesday. I’ll shift the time earlier so I know my wife is still home before she leaves for work to simulate it.

I had the same issue today, but I deleted and reinstalled the apps on my phone…so let me start there.

One more request (if I may be so bold!) - is it possible to offer an option to name the app when it is saved? I have two installed, one for me and one for my wife. However, I can’t tell which is which in the ST app. :frowning:

I had the same issue the other day - debugging it now. I think I know what the problem is, but don’t know how to properly solve it yet.

As for renaming, I’m working on that as well. I have another app - Double Tap Mode Switch - of which I have six instances installed. It’s very annoying not being able to tell which one is which. I’m gonna make it possible to give a custom title and maybe even assign an icon.

I love the app, by the way. So far, since I deleted and reinstalled, it works fine. It has triggered the past two days without fail.

OK, I’m curious: why aren’t you just using the Hello, Home automation for this?

Mine is set up to change the house to “Away” mode only after everyone leaves the house - so if someone stays home, it stays in “Home” mode. This would seem a far simpler solution.