Hi, I am struggling to find correct way to setup my home/away automation based on the location of cellphones of my wife and I. What we have “smart” in the home is our door lock, a few lights, a Nest and a Harmony Hub as well as location awareness from CloudMQTT and bluetooth and notify from iOS app. All controllable at present from the Hassio State interface.
My mind can’t quite get around the different things but all in all, I would like to have the TV shut off, lights out, and Nest set to away if we both are leaving house. Except evening when I would like the outside lights to turn on or stay on. As well the opposite to happen when we arrive home… tv on lights etc. I read about groups and input_booleans, and apart from creating a boolean for home and away (which seems not to be registered with any action, but the switch shows up in the main page.) I am no closer to achieving this automation.
I am sure there is a way, but I am a bit overwhelmed when trying piece it all together. help… ha
It can be overwhelming in the beginning. Start simple, break it down into simple rules that you can start automating. Over time, you will have what you need.
Look at other people’s code for inspiration. Most people have automations for home/away.
I’d create a group with the both device trackers in (as that will make everything else simple). Then you can start with a simple automation that notifies you when the last person leaves:
alias: 'All away'
initial_state: 'on'
trigger:
platform: state
entity_id: group.my_adults
to: 'not_home'
action:
service: notify.WHATEVER
data:
message: "The last person has left home"
With that working you can create another for to: 'home', that notifies when the first person comes home. At that point you can replace the notifications with actions to turn on/off devices etc.
True. Probably shouldn’t put the cart before the horse. I’ll stay away from grouping a lot, boolean etc, until I get a real grasp on my automations, and have them working as separate ones working at once. Then I’ll look into how to group them effectively. As of now I do searches and copy a few routines as best I can. Sometimes, the input_boolean for example, I write it in not really knowing how to incorporate it into my whole setup, and basically created a switch to nowhere. ha Thanks.
Don’t worry about input_boolean, that doesn’t do anything directly, but you use it in your automations as a logical switch. I didn’t introduce it to my automations for quite some time.
Thanks. Thats really good information on the boolean. I’ll work on creating the group and automation you showed in the previous post. Looks very logical now that I see it in print. I feel I’ve learned enough to be on the verge of doing some pretty cool things down the road, with a little help and trial and error I’ll be connecting all the dots as time goes on I’m sure. It was quite overwhelming at first, but that was a week and a half ago, and I’ve come a long way since. Certainly a lot fewer errors in my yaml files now. ha
Going through a lot of this myself one thing that I did which some may feel is counter intuitive to the home automation mantra is include a “Leaving” input_boolean. When I know I’m going to be leaving soon I just flip that guy on and then my door “to: open” trigger causes all my leaving stuff to happen (turn off tv/lights/set hvac etc…)
I also have a backup based on owntracks that will trigger when all cell phones are away from the homezone that will trigger the same automation.
I find it to be pretty much impossible for a home automation system to know automatically if the house is about to be empty the moment a door opens. (if someone can think of a full proof way I’d be happy to entertain it/poke holes in it!)
What if someone is staying home? What if I’m just running out to throw out the garbage/get the mail etc.
So the ‘Leaving’ button takes away the frustration and guess work. Add a pad on the wall and it’s super easy to press that button and wait while the wife finishes getting ready