Sureflap Connect - Pet Door

If anyone else is a crazy cat person like me and wants to treat their cats like people this is what I did to turn the state attributes of the cat flap into device trackers which can then be assigned to “people”.

I’m working towards being able to ask alexa/siri where the cats are.

binary_sensor:
  - platform: template
    sensors:
      buddy:
        friendly_name: Buddy
        device_class: presence
        value_template: "{{ is_state_attr('sensor.surepet_connect', 'Buddy', 'Inside') }}"
      richard:
        friendly_name: Richard
        device_class: presence
        value_template: "{{ is_state_attr('sensor.surepet_connect', 'Richard', 'Inside') }}"

This automation will create devices for your cats in known_devices.yaml and update the state of those devices when either the state of the cat attribute changes or home assistant is restarted and as long as track: true is set you can then assign them to people in the UI.

automation:
  - id: '1555327665592'
    alias: Cat Tracker
    trigger:
    - entity_id: binary_sensor.buddy
      platform: state
    - entity_id: binary_sensor.richard
      platform: state
    - event: start
      platform: homeassistant
    action:
    - data_template:
        dev_id: buddy
        location_name: >
          {% if is_state('binary_sensor.buddy', 'on') -%}
            home
          {%- else -%}
            not_home
          {%- endif %}
      service: device_tracker.see
    - data_template:
        dev_id: richard
        location_name: >
          {% if is_state('binary_sensor.richard', 'on') -%}
            home
          {%- else -%}
            not_home
          {%- endif %}
      service: device_tracker.see

I pulled the idea from this post

2 Likes