Track the state of pets with a smart pet door

I have a smart pet door that has for each pet a binary sensor as a presence. Works great with home/away. Downside: no photo of the pets (like users have).
So I created a user (with photo) for each pet (without login). But I cannot use the binary sensor as a presence device.

So my question is: how can I use the presence of my pets with a photo as icon. Either one way or another. That is:

  1. I can add a photo icon to the known binary sensor of my pet door.
  2. I can use the binary sensor as a presence device for the pet users.

Any ideas?

Yes. Use the device_tracker.see service in an automation. e.g. https://community.home-assistant.io/t/is-there-a-way-to-use-a-binary-sensor-as-an-device-tracker/250665/6?u=tom_l

I am not completely sure what I am doing here, so it’s hard to debug this.

alias: "Presence: pet1"
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.pet1
condition: []
action:
  - service: device_tracker.see
    data:
      dev_id: Pet1
      location_name: |
        {% if trigger.to_state.state == 'on' %}
          home
        {% elif trigger.to_state.state == 'off' %}
          not_home
        {% else %}
           unknown
        {% endif %}
mode: queued

Results in

Executed: July 23, 2024 at 10:27:59

Error: Error rendering data template: UndefinedError: 'dict object' has no attribute 'to_state'

Did you try to test it by manually triggering the automation?

That won’t work as the triggers are skipped so no trigger.to_state.state.
Test it by going to Developer Tools → States and changing the value of the binary sensor.

@tom_l, I’ve changed this post while editing and configuring it. The first pet worked. I added the second pet (changing pet1 to pet2), set both items to the location tracker of that pet-user. But something weird: one pet is away (while the binary sensor isn’t). Via that developer - state route, I cannot change it back…