Hello Home, I'm Back - Set different modes based on time?

I’m trying to figure out how to get the “I’m Back” Hello Home action to set the correct mode when someone returns to the house. We currently have 4 house modes (Home, Away, Night, and Evening). I have other Hello Home actions which are changing the modes automatically as follows:
Good Night - changes to night mode at 10 PM and not Away
Good Evening - changes to evening mode at sunset and not Away
Good Morning - changes to home at sunrise and not Away
Goodbye - changes to away

The problem I’m having is with the “I’m Back” action. Preferably the I’m Back action would change to the correct mode depending on the time/time of day criteria we’ve defined with the other actions. Currently it appears the I’m Back action would only allow me to set a single mode (e.g. home) but that wouldn’t necessarily be the desired mode depending on the time of day the first person returned home. For Example, if I’m Back is set to change the mode to Home but the first returning person came after 10PM then the mode would be incorrectly set to Home instead of Night.

-Jason

1 Like

I am afraid this is one of those instances where SmartThings is not very smart. We all want different behavior when we are away, but upon returning, we want our homes behavior restored to NOT away behavior, and any settings that are appropriate for being “not away” at any given time that may occur.

For now, you’ll need to abandon the ‘stock’ apps for one that supplies this additional conditional. Don’t know if one exists already so you’ll want to peruse all of the samples in the IDE.

Thank you kind sir for the share…I will learn much from your code example and will share my learnings with the community.

Ok… a bit too much I know… But, thank you (SMILE)

Hello,

I tried installing this smartapp today, but it’s not working. I had a version of your app installed, but I messed around with some things and wound up deleting it. When I tried to reinstall it using the code copied from this post, I can’t make it through the settings. When I go through it in the SmartThings app on my phone, I get “an unexpected error occurred” banner in red when I try to click “Done” on the second settings screen (where you set the zip, push notifications, etc).

When I try to configure it in the IDE, I get the following error:

groovy.lang.MissingMethodException: No signature of method: physicalgraph.notification.NotificationService.sendPush() is applicable for argument types: (physicalgraph.app.InstalledSmartApp, java.lang.String, null) values: [Magic Home, Performing "Home (Night)" for you as requested., ...]
Possible solutions: sendPush(physicalgraph.device.cache.InstalledSmartAppDTO, java.lang.String), sendPush(physicalgraph.device.cache.InstalledSmartAppDTO, java.lang.String, java.util.Map), sendSms(java.lang.String, java.lang.String), sendSms(java.lang.String, java.lang.String, java.util.Map) @ line 278

I can find line 278, but I’m not really sure how to interpret the error message or proposed solution. Any help you can give would be much appreciated.

Thanks,
Tamara

Did some testing and I don’t think its my code. Seems the send push stuff is broken. I’ll get back to you after I hear back from support. For now if you disable notifications the app will run just fine.

Updated my github. Push notifications are broken right now best I can tell. Added sms feature as an interim. Get the new code from my git hub. It’s called magic home.

GitHub.com/tslagle13

I did wonder if it might be an ST issue.

I pasted the new code from Github into the SmartApp, but I can’t seem to get the SMS option to show up in the settings for the app. (from the code, it looks like there should be a spot for my phone number?) I don’t know if I’m missing some step needed to get the app to refresh, but setting push notifications to No does seem to allow the app to work, so that’s good.

I could have sworn I tried setting the push notifications to no last night, but there had been times where I was getting a different error that I was not authorized, so it might have been during one of those times.

Thanks for looking into this, and thanks for the great app!

@tamaracks No problem! Make sure you “publish” the app when you grab the new code just saving it won’t push the changes to the smart app

I think maybe I didn’t save the new code last time. I could have sworn that I did, but apparently not. I just tried updating the code again (and published again, which I know I did before) and this time it worked.

Just curious, do you know if the push notifications are still down? It seems that it is to me, because if I try to change the push setting in Magic Home to yes, I get the unexpected error again. I guess I keep fearing it’s just me.

Looks to be broken still. I’ll see if I can get an update from support

Good to know, thanks.

Seems good. I updated the code and I was then able to go into the settings and turn push notifications on without error. I’ll keep an eye on it next time I leave the house to see if it notifies.

Glad to hear about the other change too! It’ll be nice not to get two notifications in a row when my husband and I arrive home together. Of course he’s traveling and then I’m traveling, so we won’t both be home together for a little while, but I’ll let you know if I see any issues once we are.

Thanks again!

@tslagle13 I have a quick question here. I noticed you’re asking for the modes explicitly.

When I write an app, even if I don’t ask for a mode input the app presents with me an option to select the mode(s). I was under the impression that the app only works during the scheduled mode. However while testing I noted that the apps works (e.g. scheduling and changing temp) no matter what what mode I select.

Do I need to handle the modes myself? If so what’s the purpose of the default modes? Also - how does one get the default modes that the user selected ?

@minollo would like your thoughts also on your experience.

Thanks

Okay I’m going to try to answer my own question, apparently it does work but ONLY when not a Installed or Update command. IE it will run when installed or updated but subsequent schedules and notifications only happen when it is within the user select mode (default options). So one doesn’t really need to handle the modes unless you need to address it in install or update.

Which still bring me to the question - how does one programatically access those default user selections?

Im not sure I understand the question here. What default selections are you talking about?

Maybe a little background would help, what exactly are you trying to do?

Are you talking about the “Only when mode is” setting, which is used for all apps? My understanding that’s something that the framework itself handles, and it will prevent the application from receiving/processing events unless the mode is what is set in that configuration. I rarely use it, other than for temporarily disabling an app (for which I use a “Never” mode which I created ad-hoc, and never set).

That’s correct @minollo, the Only when mode is settings is something all the apps have. That’s what I was commenting about. Apparently it always invokes install and update but doesn’t seem to invoke schedules and subscriptions if the modes don’t match.

But my question is how do I access that setting/variable?

I’m not aware of any way to access it; and, considering your app won’t fire anyway when not in the right more, I’m not sure I understand the reason for trying to access it; it’s a “framework level” setting.

Reason being like I had said the Install and Update methods, check the mode before setting the temperature for example.

if you wanted an app to change a temp on install you’d have to write that logic into the code.