If first person comes home - turn on lights

Hi all!

It sounds really simple, but I struggle with this for a while now. I want a automation that turns on the lights and starts playing radio when we come home.

I have created a automation that checks if someone is home. If there is someone home, the automation does not run. If there is no one home, the automation runs.

Now, the problem is. When my girlfriend and I come home together, the automation checks if someone is home. Since we arrive at the same time, the automation thinks someone is already home and therefor it will not run.

Is there a easy solution for this?

We use a group and have added each persons tracker entity OR each person entity (if trackers are already set) to that group, that way you can simply trigger off the group going from off to on.

Example Group:

house_occupied:
  name: House Occupied
  icon: mdi:home
  entities:
    - device_tracker.person_one
    - device_tracker.person_two
   # OR #
    - person.person_1
    - person.person_2

That is a great idea, I will try. Thanks!

Zones in Home assistant have a state counting the number of people in that zone. So without knowing how many persons you have added to HA, you can simply test is zone.home is 0 or >0. This works for all zones you define on the map. I have two kids that go to the same school, if I wanted I could check if they are both there :slight_smile:

2 Likes

Allright!

Do you configure it as person, like this? Because HA says it cannot read the persons as a number.

No, it is not an attribute, it is the state itself. So entity zone.home, attribute empty.

2 Likes

Great! Bedankt. :slight_smile:

Goedenavond ik ben hier ook al even mee bezig. Doe ik het zo goed? Muziek mag alleen afspelen als er iemand thuiskomt en er is nog niemand thuis.