Hello Home Actions - "I'm Back"


#1

Hi All. I have a rule set that when my presence is found, it automatically updates my mode from Away to Home. My question is, is there a way to configure to turn my lights on a certain time when my mode updates automatically to Home and also have another rule to just change my mode to Home without turning the lights on? I would like to use this option so I can have my lights turn on when I come home from work at night…
I’ve originally set my 2 rules to perform

Automatically perform “I’m Back”(change mode to Home) No Lights - when “someone arrives” and also “At sunrise or sunset” set @ “Sunset” using the “Before” option
Automatically perform “I’m Back”(change mode to Home) with Lights -when “someone arrives” and also “At sunrise or sunset” set @ “Sunset” using the “After” option

But i kinda figured out that it didn’t work this way because I am assuming these are actual actions to trigger the rule and not an actual time setting for a certain time duration similar to when you set a motion detector to trigger an action during a certain window.

Any ideas?


(Calvin Robertson) #2

I ended up creating a separate modes for evening away and evening. I then used an action to change from away to evening away at sunset and vice versa at sunrise. I then set the “I’m back” action to occur only when the mode is away and a separate “back late” action to occur during the evening away mode. The back late action turns on some lights.


#3

ahhh. thanks! makes sense. thanks Calvin!


#4

actually… that wouldn’t work i think… how could I set my lights to turn on lets say between 5 pm - 10 pm using the new mode?


#5

Basically I want to use my presence to perform Im back automatically during a certain time window. Which it does not give as an option, only certain days of the week. Perhaps there is a code I can add to this?


(Calvin Robertson) #6

It appears that you can set the presence option of a hello home action for certain days of the week. As for lighting schedules I have a set of lamps in our living room connected to ST. Using the lights and switches smart app, I’ve grouped them and set them to turn on at sunset and then turn off after 8:00 when my motion sensor doesn’t see any more motion for 10 minutes.


#7

Yes, you can set the presence option when someone arrives from the hello home action for certain days of the week to turn the lights on, but not during a certain time window which I am looking for.


(Calvin Robertson) #8

I’m trying to envision your application. Are you trying to set it so a light turns on when you arrive at night but not during the day?


(Andy Kim) #9

I’m interested in this as well. To reiterate, you’d like lights to turn on when you come home, but only when it’s dark outside. Right? Please let me know if you have a solution.


(Calvin Robertson) #10

So I have created two new modes evening and evening-away. I then created 5 new actions. Switch to evening away, switch to away, back late, leaving late, and switch to evening. Switch to evening away occurs if the mode is away at sunset. Switch to away occurs if the mode is evening away at sunrise. I’m back late occurs if the mode is evening away and my presence or my wife’s presence is detected. That action at the same time also puts my thermostat to my evening preferences and turns on a light. Leaving late occurs if the mode is evening and both me and my wife have left, and it sets the mode to evening-away. Switch to evening occurs if the mode up is home at sunset. Since I still use the goodnight action, the good morning action restores the mode to home. Hopefully this gives you some ideas.


#11

Hi Calvin,

I understand your actions. But it does not give me the answer on using the Helo Home “I’m back” action using my phone as the presence device so when I get home, depending on the time, I would like to either have my kitchen lights automatically go on or not go on along with putting my mode automatically from “away” to “Home”


(Andrew Cockburn) #12

Sounds like an obvious thing to want to do right? Problem is that the existing systems of modes and hello home actions won’t allow you to do this - you need to use a SmartApp. There have been several variants posted on the forum at different times. Here is mine, it is a modified version of “Honey I’m Home”. It uses 2 Hello Home Phrasees that you can set to turn lights on or off, and optionally change modes. You enter an offset from sunrise and sunset and give it a list of presence sensors to monitor and it does the rest. Its been working great for me.

/**
* Honey, I'm Home!
*
* Author: oneaccttorulethehouse@gmail.com
* Date: 2014-01-26
*
* Heavily borrowed from Night Light/Sunrise/Sunset and Greetings Earthling.
*
*	Will turn on lights and change the mode when someone arrives home and it is dark outside.
*
*
*/


// Automatically generated. Make future change here.
definition(
    name: "Honey I'm Home",
    namespace: "aimc",
    author: "Andrew Cockburn",
    description: "asd",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
    iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")

preferences 
{
	page( name:"Settings", title:"Settings", nextPage:"selectPhrases", uninstall: true )
    {
        section("When one of these people arrive at home") 
        {
            input "people", "capability.presenceSensor", multiple: true
        }
        section ("Sunrise offset (optional)...") 
        {
            input "sunriseOffsetValue", "text", title: "HH:MM", required: false
            input "sunriseOffsetDir", "enum", title: "Before or After", required: false, metadata: [values: ["Before","After"]]
        }
        section ("Sunset offset (optional)...") 
        {
            input "sunsetOffsetValue", "text", title: "HH:MM", required: false
            input "sunsetOffsetDir", "enum", title: "Before or After", required: false, metadata: [values: ["Before","After"]]
        }
        section ("Zip code (optional, defaults to location coordinates)...") 
        {
            input "zipCode", "text", required: false
        }
        section( "Notifications" ) 
        {
            input "sendPushMessage", "enum", title: "Send a push notification?", metadata:[values:["Yes","No"]], required:false
            input "phone", "phone", title: "Send a Text Message?", required: false
        }
        section([mobileOnly:true]) 
        {
                label title: "Assign a name", required: false
                mode title: "Set for specific mode(s)", required: false
        }
    }
    page(name: "selectPhrases")
}

def selectPhrases() {
    dynamicPage(name: "selectPhrases", title: "Configure", uninstall:true, install:true) {        
    	def phrases = location.helloHome?.getPhrases()*.label
    	if (phrases) {
        	phrases.sort()
        	section("Run This Phrase When...") {
            	log.trace phrases
            	input "lightPhrase", "enum", title: "It's light", required: true, options: phrases,  refreshAfterSelection:true
            	input "darkPhrase", "enum", title: "It's dark", required: true, options: phrases,  refreshAfterSelection:true
            }
        }
    }
}


def installed() 
{
    log.debug "Installed with settings: ${settings}"
    log.debug "Current mode = ${location.mode}, people = ${people.collect{it.label + ': ' + it.currentPresence}}"
    subscribe(people, "presence", presence)
}

def updated() 
{
    log.debug "Updated with settings: ${settings}"
    log.debug "Current mode = ${location.mode}, people = ${people.collect{it.label + ': ' + it.currentPresence}}"
    unsubscribe()
    subscribe(people, "presence", presence)
}

private isDark(rt, st) 
{
    def dark
    def t = now()
    dark = t < rt || t > st
    dark
}

def presence(evt)
{
	log.debug "evt.name: $evt.value"

	if (evt.value == "present")
    {
        def s = getSunriseAndSunset(zipCode: zipCode, sunriseOffset: sunriseOffset, sunsetOffset: sunsetOffset)
        def riseTime = s.sunrise
        def setTime = s.sunset
        log.debug "riseTime: $riseTime"
        log.debug "setTime: $setTime"

        def Phrase

        if (isDark(riseTime.time, setTime.time))
        {
            Phrase = darkPhrase
        }
        else
        {
            Phrase = lightPhrase
        }

        def person = getPerson(evt)

        def message = "${person.displayName} arrived at home, executing '${Phrase}'"
        log.info message
        send(message)
        location.helloHome.execute(Phrase)
	}
}

private send(msg) 
{
    if ( sendPushMessage != "No" ) 
    {
	    log.debug( "sending push message" )
    	sendPush( msg )
	}

	if ( phone ) 
	{
		log.debug( "sending text message" )
		sendSms( phone, msg )
	}

	log.debug msg
}

private getPerson(evt)
{
	people.find{evt.deviceId == it.id}
}

private getSunriseOffset() 
{
	sunriseOffsetValue ? (sunriseOffsetDir == "Before" ? "-$sunriseOffsetValue" : sunriseOffsetValue) : null
}

private getSunsetOffset() 
{
	sunsetOffsetValue ? (sunsetOffsetDir == "Before" ? "-$sunsetOffsetValue" : sunsetOffsetValue) : null
}

(Calvin Robertson) #13

That’s what the back late action does. You set the I’m back action to the response you want during the day. And then set the “I’m back late” action to the response for when you come home in the evening. Depending on whether you are in away or evening away mode will determine whether I’m back or I’m back late executes.


#14

Hi Calvin,

Can I ask you what the setting is for your “I’m Back” and “I’m Back late” actions under when Someone arrives using their phones are presence? I just don’t see a way to discern Time and days to nights. only option is Days of the week.


#15

Hi Andrew,

Great. But do you know why i am getting this error?

startup failed: script14206570112202022769767.groovy: 1: unexpected token: ** @ line 1, column 1. ** ^ 1 error


(Andrew Cockburn) #16

Looks like you may not have pasted the initial “/” character?


#17

yap figured that one out! thanks. i’ll see if this APP does the job.


#18

Andrew. Ok, now its installed. now how do I incoorporate this to my hello Home action? and how do I set it to turn my lights on a certain time when a presence device is located? I don’t see option for switches to configure?


(Andrew Cockburn) #19

You let Hello Home do all the hard work! This is why I coded it this way, Hello Home is like a complete set of things you want the system to do. You can make a hello home action to turn on certain lights, but you are not limited to just that. You could also turn your thermostat up when you come home, and even unlock your doors or open your garage. Just create a hello home action for what you want to happen - one for when it is dark and one for when it is light. If you are just interested in lighting, the light hello home action doesn’t need to do anything at all.


(Calvin Robertson) #20

So I use set to away/set to evening away actions to determine the time of day. At sunset the set to evening away action changes the mode to evening. At sunrise set the mode to away changes the mode back to away. The I’m back action is set to only execute if the mode is away. The I’m back late is set to only execute if the mode is evening away