Home = 0 didn't work, turns out: my pets are also people that count for the home zone

When I got my pet door I added my pets to Home Assistant. Never thought about it again.
I also had an automation that does things when a particular person is leaving and when the Home Zone was 0, it should turn everything off. And the last almost never happened. I recently noticed that is were my pets who were inside!

Working around them being inside or out and everybody (people) are gone is quite difficult, I guess. So I should transfer my pets to an other entity. But how?

My pet door provides two binary sensors (binary_sensor.pet1 and .pet2 for both my pets (Home or Away).

Now I have an automation when the attribute of a pet changes (Pet 1 is the person):

triggers:
  - entity_id:
      - binary_sensor.pet1
    trigger: state
conditions: []
actions:
  - data:
      dev_id: Pet 1
      location_name: |
        {% if trigger.to_state.state == 'on' %}
          home
        {% elif trigger.to_state.state == 'off' %}
          not_home
        {% else %}
           unknown
        {% endif %}
    action: device_tracker.see
mode: queued

I could skip this automation but you cannot add a picture to a binary sensor. So how could I simplify this, have a picture of my pets in the entity, and them not being persons.

If you want to keep using person entities for your pets, you could set up a Template sensor to get similar functionality to the zone’s state. The zone entity has an attribute persons that lists all the person entities in the zone. A count of what’s left in the list after subtracting the pet’s person entities will give you something you can use like the state of zone.home:

template:
  - sensor:
      - name: Home Zone
        state: |          
          {% set pets = ['person.pet_1','person.pet_2'] %}
          {{ difference(state_attr('zone.home', 'persons'), pets) | count }}
        availability: "{{ has_value('zone.home') }}"
2 Likes

You can have device trackers that are not linked to persons too. If they have an entity picture they show up with that picture on the map. My car is on there, but it is not a person.

It also saves you from having users for cats that you need to block for logging in.

If it was the functionality for having multiple trackers combined that led you to create users, there is also this:

It also lets you set an entity picture.

Also, you can create group of person objects (though not in UI, but yaml), and then check this group in automations, display it on dashboard…

group:
  family_members:
    name: Family members
    icon: mdi:account-group
    entities:
      - person.****
      - person.****

  dogs:
    name: Dogs
    icon: mdi:dog-side
    entities:
      - person.dog1
      - person.dog2

This group will be Home when any person (from that group) is Home, and Away when all people (from that group) are Away. Which is what I think you want to get.

This looks the most easiest. I am gonna test it! :slight_smile: