I’m wondering what’s the best practice to solve my problem.
Basically I would like all sort of automation to triggers when I arrive home or when I leave home or when I’m out of home at 10pm etc.
Ideally I see myself having two different “states” at my home, ether “no one is home” or “someone is home”. I can see those states automatically change with location of cellphones or something.
But since my “home” is not an entity with states I’m wondering how I should advance.
Can I somehow create an artificial entity with those states, or should I create a binary sensor. I have tried to find articles. Could someone as well recommend some reading material how to understand the basics of programming these automation, all i seem to find are short videos that eather set-up home assistant or solve some very specific problem
If you have set up mobile app integration, I think you’ll have an entity called person.xxxx which has a state either home or not_home.
Below is an example of state based trigger that monitor entity_id called
- platform: state
- platform: state
What you’re after is 'presence detection" - use this as your search term. Here’s a video to get you started 4 EASY Presence Detection Setups in Home Assistant - YouTube
Yes but if there’s more than one person living in the house, I would like to have one state programmed for multiple persons.
Create a group containing the person living in your house-
It at least one person is at home, the group state will be ON. The group state will be OFF only when all person are not_home.
name: Home Presence
You will now have a new group entity called
Here’s what I’m doing in Node red for my two person household. I created one input boolean ‘Nobody is home’ to keep track of an empty house. as an individual moves into or out of the home zone, objects related to them are turned on or off. if the house is empty then everything gets turned off.
May or may not off-topic, but would recommend we read this one through:
Making Home Assistant’s Presence Detection not so Binary – Phil Hawthorne
Somebody gave it some serious thoughts on what the design should be…
why not check the state of zone.home (or whatever you called your home). It should be the number of people in your home - as long as 1) they are running the companion app, or 2) you are monitoring their presence using your router and their phones mac addresses (using the router integration).
This won’t work for guests whose mac addresses you don’t have recorded, but usually you are dealing with people you know when checking presence in your home. My wife and I both run the companion app, sometime when we are away our children might drop by. Using the router integration, their phones mac addresses are included in their people profile - so as soon as their phones connect to my wifi, HA knows they are home and increments zone.home.