Hello, Home Phrase Director - Control modes (through hello home phrases) based on occupancy and "sun state"

Tim, can you expand on the logic behind setting the app up appropriately?

You didn’t answer my question: How does the app know to switch to “Home-Night” in particular and not some other mode like Evening-At-Home?

You set that up in the phrase you use for each of those “modes”

The confusion here is coming from people thinking the app is directly changing modes… it isn’t. it is merely running a hello home phrase you specify when certain parameters are met. IE. If the sun is up and on one is home run XYS phrase… when someone is home and the sun is up run XYZ phrase.

This app will not directly change a mode.

The input you are talking about for the modes is purely for logic. what mode are you in when you home status is “home day” what mode are you in when you home status is "home night.

Ya’all are over thinking this…

Setup a hello home phrase that will run on each of the condisitons

  1. home day
  2. Home Night
  3. Away Day
  4. Away Night
    (Name these what ever you want as long as it makes sense to you.)
    Also… you don’t need 4… you can have all 4 conditions run the same phrase. its what YOU want. take some time and figure out what you want your home do be doing. No one here but you can figure this out. Once you know what you want your home to do during those times then come up with something that will work for you.

After that just setup the phrases to do whatever you want them to do. fill out the rest of the app with the required info… done.

Here is what i do.

Hello Home Phrases

  1. Home Day (Sets mode to home day when it runs)
  2. Home Night (Sets mode to home night when it runs
  3. Away Day (Sets mode to away day when it runs)
  4. Away Night (Sets mode to Away night when it runs)

I have a “goodnight” phrase that turns the mode to goodnight and does the other things i want it to do. (Home Magic is not allowed to run during this mode)

My home runs on 5 phrases and 5 modes.

Then just setup each phase to set therm, turn on/off lights, etc as you see fit.


I was one of the confused too, so thank you very much for this last set of posts. I didn’t realize I needed modes AND phrases to set those modes. I think I started to go awry when I saw examples that had phrases and modes with the same names, and didn’t realize what I was looking at. I had it all set up wrong, and was wondering why my mode didn’t change automatically :slight_smile: Fixing now! This app will be awesome for my needs once I get it going correctly, so THANK YOU for it!

Tim, first, Merry Christmas and thanks for the great app. Quick question. I want do do something similar to your ‘goodnight’ function, but then I want to retrigger the presence and sun state after a configurable period of time.

For example, I have my locks set up such that if user code 2 is used, I am notified that the Cleaners have arrived. This sets my Mode to “Authorized Guest Present”. I don’t want to give them presence devices or any access to smartthings. I can predict that these kinds of authorized guests are usually only in the house an hour or less. So I would like to set things up such that if the house goes into “Authorized Guest Mode”, Magic Home sets everything back to the proper state after an hour.

Any way to do that without having to tackle my own app? Not ready for that at this time.

Thanks for the app. If it switches modes do other smartapp that have sunset\rise dependencies run?

For example, if I have a Day away and Night Away. I have a smartapp associated with Night Away that has a sunset rule. When sunset happens and the mode switch happens, sunset has passed. Will the sunset app still trigger it’s sunset action?

If this helps anyone else out, I wanted to provide a tutorial for getting started with Magic Home in SmartThings.

The reason why is that I have just started out using ST and I am waaaay far behind all you guys with the terms and setting up phrases/actions/modes that I got very lost when I was referenced to this thread to give Magic Home a try!

It’s just a basic tutorial, not very detailed but hopefully it helps someone else who is new hehe…

Step 1 - Create Your Home Actions

Note: In this step, you will be creating the actions ran by Magic Home which are used to activate your different home modes.

  1. Open the SmartThings app on your phone
  2. At the Dashboard, click the chat bubble icon at the top-right corner
  3. Click the gear icon at the bottom-right corner
  4. Click the Add an action button at the bottom and give it a name such as Home Night like Tim mentioned
  5. Click Next at the top, then select the option Change the mode to
  6. Select a mode (I used the default Night mode) and click Done
  7. Make any other configurations if needed
  8. Click Done again to finish the action
  9. Repeat steps 1 through 7 again if you want additional actions like Tim mentioned such as Home Day, Away Night, and Away Day. See Tip below.

Tip: In step 9, just to get started, what I did was use the default modes SmartThings provided so Home Night and Away Night both used the Night mode and Home Day and Away Day both used the Home mode. Of course you will want to change this and further add/customize your modes (which will be triggered by your created actions) based on your requirements but it is just used as a starting point for now.

Step 2 - Install the Magic Home App

Note: Magic Home is a SmartApp not a Device Type

  1. Copy the code at the following link… Magic Home Raw Code
  2. Go to… My IDE SmartApps
  3. Click the + New SmartApp button at the right end of the screen
  4. Click the From Code tab then paste in the code from step 1
  5. Click the Create button at the bottom
  6. Once created, click the Save button
  7. Once saved, click the Publish button and in the drop-down menu select For Me
  8. If the SmartThings app is already opened on your phone, force close it to refresh
  9. Reopen the SmartThings app
  10. At the Dashboard, click the (+) button at the bottom
  11. Scroll through the categories to the far right end to reach My Apps
  12. If installed correctly, you should see Magic Home listed

Step 3 - Setup the Magic Home App

  1. At the Dashboard in the SmartThings app, click the (+) button at the bottom
  2. Scroll through the categories to the far right end to reach My Apps
  3. Click the Magic Home app that is listed
  4. Select Monitor These Presences and select the phones/sensors to be used, then click Done
  5. For each of the 4 phrases, select the associated home action (that you created in step 1) that you want to be ran. As an example, for the phrase At Least One Person Is Home And It’s Night, I selected the action Home Night that I created from step 1, then clicked Done.
  6. I got confused on this part, but at the bottom for the select modes section, just reassign the modes for your actions
  7. Click Next then fill out your zip code so the app knows when to handle sunset and sunrise
  8. Fill out any other settings such as push notifications, etc.
  9. Click Done
  10. Once back at the Dashboard, you will now have a My Apps tile if not already
  11. Click the My Apps tile and you should see the Magic Home app

Step 4 - Add Devices to a Mode

Note: For this step, I am showing how I added a MotionSensor/Lightbulb combo to my Night mode such that when sunset was reached and I was home, Magic Home would run my Home Night action which would trigger the Night mode which would then trigger the light to turn on everytime I walked by the motion sensor!

  1. At the Dashboard in the SmartThings app, click the (+) button, and scroll through the categories until you reach Actions, then select Lighting
  2. Select the option Turn on when there is motion., then select Add new light/switch
  3. Give the light a name then click Next
  4. Select the motion sensor to be used, then scroll to the bottom to expand More options
  5. Select Only when mode is and pick your mode such as Night
  6. Click Done, then Next, then Done

Tip: For me, step 5 above was the final piece towards getting the whole system working how I wanted it as I needed to tell each device action which mode it could be triggered in.


As a quick summary, I highly recommend you first create/customize your SmartThings home modes and home actions before starting with Magic Home as once you finished customizing your home modes/actions, they are simply just plug/play into Magic Home which makes it really nice to use.

Also if this helps out, the main reason I am using Magic Home is because (correct me if I’m wrong) it detects on sunset/sunrise if you are already home and under the actions in SmartThings all I could find was when leaving or arriving during those times whereas I wanted when I’m already home, not leaving or arriving.

Great app, very nice work! :smile:


Thanks for writing this and thanks to @mxrugg for the newbie tutorial.

I have this setup with the 4 modes and it work great. I want to turn on the hallway lights when someone arrives home and it’s dark.

I don’t necessarily want the lights to come on when the mode changes to Home Night since it will do that at sunset automatically.

I guess where I am confused is I know how to make it switch modes and I know how to trigger a light using mobile presence but not able to wrap my brain around combining these.
Can someone walk me thru it or should I not be using this smartapp for this?
Would setting it for “turn on when people arrive” and “only when mode is” “Home Night” work? My Mobile Presence back home will switch the mode from “Away Night” to “Home Night” and at the same time try to trigger the lights depending on the mode. What gets set first the mode or the light trigger? Couldn’t that cause a problem? Maybe I am over thinking this.

@swindmiller, I think you’re on the right track in logic. Essentially, the way to combine the two is as you said: while setting up the light to turn on with presence you simply need to select the Modes you’d like this to occur under.

Regarding the issue you mentioned at the end of your post, you might as well just select both Away Night and Home Night. That way if the system triggered the light to turn on before it was able to switch from Away to Home then it will still work.

Hope this helps…

1 Like

Thanks for chiming in :smile:

I have it set to Away Night and it has worked every time so far. So it looks like it triggers before the mode changes. I know there may be a hiccup here and there but so far it’s been fine.


Glad its working for everyone. Thanks to everyone who chimed in to help with the logic behind the app. :smile:

@mxrugg especially. I am going to include your writeup in the OP. Thanks for that!!!

Hi guys,

I have been trying to find a way to trigger night mode when everyone is home at night. so something like this:
Trigger Nigh mode when:

  • Key people are home
  • Between 9pm and 1am

Can anyone help?

Use a hello home phrase to do this. Set it up to only run in a “Home Night” mode at a certain time.

This is hands down the most useful and stable application I use. It’s makes setting up the core foundation of my automated tasks a breeze. Tim and all involved behind the scenes, thanks for taking the time to put this together! Much appreciated!!


Hey @tslagle13, I’ve been trying to bypass the Magic Home app from auto switching between my modes but am having some difficulty. First, I’ll explain why. The reason is because my fiance leaves her presence sensor in one of her purses but decided to switch purses recently and so when I leave in the mornings SmartThings doesn’t know she is still home and it switches to “Away” after I’ve left.

Here’s what I’ve tried to do to bypass it. I created a 5th mode, called Bypass, and then went into Magic Home’s settings and at the bottom of the second page where it says “Only when mode is” I selected only the 4 main modes (Home Day, Home Night, Away Day, Away Night). In other words, I set it so that the app should not run any auto switching when I have the system manually set to Bypass mode.

I tried it out and it did not work. The app still switched the system over to Away when I left the next morning. Thoughts?

This works for me. I just tested… do you have my latest code?

Good question. Just copied the code from here. That the correct code? I’ll reinstall with it and try it out when I get home tonight.


Thats the latest :smile:

Tim, in the latest Magic Home code did you add “Don’t automatically do this if I am in one of these modes_”?

The reason I stopped using Magic Home was because of this missing feature. For the last two months I have been using the long hand version of Magic Home that Triggertact mentioned in another post and it has been working great ever since.

Been there since day one.