07-22-2023 01:36 AM
I have created an automation that turns on certain lights when I come home in the dark (between sunset and sunrise). I used the following starter:
starters:
type: home.state.HomePresence
state: homePresenceMode
is: HOME
It works fine, but I have only one problem: when my wife is at home and already went to bed, her phone is also home and the automation doesn't start, because home state is already 'home', based on my wife's phone. So when I come home in this situation, I still come home in a dark house.
Is there a possibility to use the state of only my phone (home/away), to start this automation?
Answered! Go to the Recommended Answer.
11-11-2023 03:36 AM
Thanks for your reply, Sandawg,
I didn't know yet that the Google home app could have a starter based just on the location of a cell phone. Maybe I never looked well enough or maybe it's not so long available (in Europe)? I don't know. But that knowledge set me on the right track to solve the problem for me.
First I defined an outlet in the Google Home Playground (https://home-playground.withgoogle.com/) which I named TriggerPhoneIsHome.
Then I made an automation in Google Home on my cell phone based on the location of that cell phone coming home, which turns on that dummy outlet.
Finally I made a YAML script with a starter based on that dummy outlet turning on. And here you have the conditions available to do this only between sunset and sunrise. At the end of this script I switch off the dummy outlet.
I still have to think when I want to turn off the dummy outlet if I come home during daylight. In Google Home on my cell phone I made a second automation that turns the dummy outlet off, when I leave my house. That should do the trick, but I noticed that sometimes my phone leaving isn't picked up by Google. So maybe I define another automation that switches the outlet off every sunset. But first I am going to see if it works like this.
I hope this helps you too.
07-22-2023 07:54 AM
Well, one solution I had was to create a virtual switch on Smartthings, for example: me at home. And in Smartthings I created the location routine and whenever I'm getting home the switch turn on and run the routine I created on Google Home, even if Google Home is home activated. It's a solution.
08-28-2023 11:08 AM
Have you figured out a solution to this
08-29-2023 12:42 AM
No, not yet.
08-30-2023 08:52 AM
I'm trying to find a way to do this as well. My nest keeps going to Eco when I'm home because we have it in a hallway that I don't walk past while I'm working in my office. Trying to create an automation to check if my phone is home and it will kick it back to On.
11-10-2023 08:33 PM
I am having the Same problem. I am trying to write a Google home script that turns on my bedroom scene (specific color brightness) when ONLY I get home and ONLY when it is dark (between sunset and sunrise).
I want the script to know My position based on my cell phone/. not home or away status, from home.state.Homepresence. My wife, son is already home so the state is already set to "home". The home.presnce starter depends on multiple devices such as my wife and son's cell phone and also motion sensors on Nest thermostats, cameras, and smoke alarm.
Interestingly Google Home app on the Phone allows starters to based on individual device, but it then cannot allow conditions like After sunset and before sunrise. Conversely Google home script on the web allows conditions, but does not allow the location status of individual devices like my cell phone.
I wrote a IFTT script that does the same thing (turn on my bedroom scene based on my cell phone's location data entering a radius close to my house, and it is after sunset), it works perfectly. But it costs 5 dollars a month to use IFTT beyond basic (that is where you have to write a personal script) and not too keen giving data to 3rd person.
Let me know if you understand my problem and hasve a simple elegant solution (no third party like IFTT, Smart things or Home assistant etc)
11-10-2023 08:36 PM
I can share my IFTT script which does the same thing if you want. It will trigger your lights when you get home based on your cell phone data and only after dark.
11-11-2023 03:36 AM
Thanks for your reply, Sandawg,
I didn't know yet that the Google home app could have a starter based just on the location of a cell phone. Maybe I never looked well enough or maybe it's not so long available (in Europe)? I don't know. But that knowledge set me on the right track to solve the problem for me.
First I defined an outlet in the Google Home Playground (https://home-playground.withgoogle.com/) which I named TriggerPhoneIsHome.
Then I made an automation in Google Home on my cell phone based on the location of that cell phone coming home, which turns on that dummy outlet.
Finally I made a YAML script with a starter based on that dummy outlet turning on. And here you have the conditions available to do this only between sunset and sunrise. At the end of this script I switch off the dummy outlet.
I still have to think when I want to turn off the dummy outlet if I come home during daylight. In Google Home on my cell phone I made a second automation that turns the dummy outlet off, when I leave my house. That should do the trick, but I noticed that sometimes my phone leaving isn't picked up by Google. So maybe I define another automation that switches the outlet off every sunset. But first I am going to see if it works like this.
I hope this helps you too.
11-18-2023 06:46 PM
I did what you suggested. I created a outlet on google playground (I did not know that existed and you can create virtual outlets) and called it DummyOutlet. However when I go to write hte YAML script on teh script editor it does not recognize the "Dummy Outlet" shows as error. Thank you. Scipt below:
metadata:
name: Evening scene turns on if arriving after Sunet
description: Turn on evening scene when the dummy switch is on.
automations:
- starters:
- type: device.state.OnOff # The basic on and off functionality for any device that has binary on and off, including plugs and switches as well as many future devices.
device: DummyOutlet
state: on
is: true
condition:
type: time.between
after: SUNRISE
before: SUNSET
actions:
- type: device.command.ActivateScene
devices:
- EveningScene
activate: true
- type: device.command.OnOff
devices:
- DummyOutlet
on: false
11-18-2023 10:33 PM
Do you see the dummy outlet in Google Home? Have you connected the playground to Google Home? Like all other third party devices the playground has to be connected to Google Home.
11-19-2023 09:41 PM - edited 11-19-2023 09:47 PM
Thank you! I figured it out . Dummy outlet is connected to google home and I can view the device in the script editor. I tested the routine by manually turning on the Dummy outlet (instead of Dummy outlet turned on by being triggered by me returning home), and it did activate the scene in my bedroom, but only if it is after sunset (just as I wanted)!
Now I have to see if the action of coming home triggers the dummy outlet to turn on as I set up that routine as well, and if the state transition of off to one, triggers the above script. Now I want to do a reverse of that which is to switch OFF my bedroom lights when I leave hte house but only if it is daytime (i.e before sunset). I will just create a Dummy outlet 2, and reverse this. Just have to be careful if there are days I leave the house AFTER sunset, i.e at evening. I don't want the routine to turn off the lights in my bedroom in that circumstance.
Any idea how to automatically turn off my Nest Hub Max camera in my bedroom On when I leave the house, and OFF when I return? Again Google has an inbuilt HOME and AWAY routine that does that but that depends on the location of multiple people (i.e AWAY is triggered when everyone is away, and HOME is triggered when first person not necessarily me comes home). Unlike lights or scenes there is no option in Google home to control the camera on the nest hub max, except within the inbuilt home/away routines.
This is a workaround, but google should build an interface in the Home app where people can add conditions like time of day (Home Android app already has phone location based starters) Or modify the scripting language where there is Phone.location can be allowed as a starter, in addition to Home.presence. This script is really easy to write in IFTT, can't believe it took so many steps for such a simple thing.
Did you figure out the method using dummy outlet yourself?
11-12-2023 04:11 PM
I am trying to do something similar, which I can kind of already do with the Google Home app using the Personal Routines, since it lets you trigger on locations "When the user arrives at". However, I wanted to add some more to it that isn't currently possible in the app so I was wondering if it is maybe possible to convert a Google Home app routine into a script?
Here is a screenshot of the Google Home app version:
05-18-2024 01:06 AM
There is another way to this something Google.assistant. command. You can write a script and get a Google Home or Nest Mini or one of those speakers/displays to run any command you want via the Google.assistant.command in the script.