Home Assistant integration for OnlyCat catflap

I’d suggest adding a simple json based implementation for this integration. Have every existing policy be its own entity with the state (or an attribute) be the json of this policy. Add an action to update a policy that takes a json as input, validates it against the schema and sends it off to the api.
This way functionality is added on a technical level without trying to find entity-workarounds with core HA features.

This then would allow the creation of a custom card that can handle the UI for this JSON. Similar to eg. Scheduler Card made for the Scheduler component.

1 Like

Hello everybody.

May i ask about your overall experience with the OnlyCat Flap?
Is it reliably working in detecting multiple Cats with the id chip?
Is it reliably detecting prey?

And finally whats the state of Support by the company and the state of this integration?
Would you advise buying one?

Thank you in advance,
Ralph.

My overall experience with the OnlyCat Flap is good.
I have two cats with an ID chip and they’re reliably detected.
Prey seems to be reasonably reliably detected. among all cases there’s only one where my cat got a mouse inside. Looking at the video there was only a frame or so showing the mouse.

Personally I don’t expect it to be perfect, but it has almost been perfect. So I’m pleased and don’t regret the purchase.

Support from the company is good. When my flap was damaged in shipping I got new parts for free.
One of my cats is able to open the flap from the inside while it is locked. I could send the flap back for a free upgrade, but since I don’t want to do that Only Cat offered me to buy new parts and replace myself. These haven’t arrived yet.

Apperently it is rare for cats to figure out this lock, but one of mine is both determined enough and smart enough to have figured this out.

The integration works well, I mostly use it to track if the cats are inside or not, but also to change policies, and notification of prey detection.
Of course there’s room for improvement, but it works well enough that development seems to have calmed down.

I would advise buying one, but consider getting the lock upgrade included in the order if you have a smart cat :wink:

Kristoffer

The flap is a little bit pricy, and there are some features I still wait on (offline api and home/away states), but its a good cat flap. And not having to change batteries is a huge win.
Chip detection works well, worst thing happening to me is one of my cats having to stand for 5s before being detected sometimes, but his chip is kinda far back though.
Prey detection works great. I had no false negatives so far and just a few false positives due to big GPS trackers on their collars, if they lingered around the camera for too long. But I’m happy with leaving it unattended without worrying my cats won’t come home.

The developers provided us the base code for websocket communication used with their api and are supportive in maintaining the repo and officially allowing this custom client to connect to their api services. Which is already something one sadly can’t expect from most companies these days.

I would recommend OnlyCat, but still hope for some more features to arrive.

1 Like

Thank you for your information.

So the integration is querying the OnlyCat Servers, Not the local device? Which is what i hoped for…

Feline greetings,
Ralph.

1 Like

This integration uses cloud push, meaning it subscribes to the official OnlyCat websockets just like the app does.

Local API has been said to be added later (to the flap) but is not yet supported by OnlyCat.

Anyone’s stopped updating status of their cats? Since the last HA update I don’t seem to be getting any updates of statuses

My Cat’s status stopped working recently, may have coincided with an HA update, the badges I had on a control panel stopped showing the cat’s in or out status.
I checked the integration and it wasn’t initialising, in the debug logs I got this:

2025-10-18 18:36:24.424 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry XX for onlycat
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 761, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/config/custom_components/onlycat/init.py”, line 54, in async_setup_entry
await _initialize_pets(entry)
File “/config/custom_components/onlycat/init.py”, line 160, in _initialize_pets
last_seen = datetime.fromisoformat(rfid[“timestamp”])
TypeError: fromisoformat: argument must be str

So I changed line 160 or “/config/custom_components/onlycat/init.py” to force it to STR:

last_seen = datetime.fromisoformat(str(rfid["timestamp"]))

It then appeared to be returning nothing, so I ended up replacing line 160 with this:

            timestamp = rfid.get("timestamp")
            if timestamp:
                last_seen = datetime.fromisoformat(str(timestamp))
            else:
                last_seen = None  # or set a default datetime if needed

Now the integration initialises OK and I got both my cats status back.

Very nice, love the product tho I have a wabbit not cat, I love the project idea

Hey @Alex-ala :slight_smile:

Only took me… two months… But I finally had time to make a stab at this. I’ve opened the PR now and would really appreciate your eyes if/when you have time.

First time committing to this repo so obviously don’t hold back if anything is out of line in terms of PR style/length, code standards/etiquette etc.

I’ve included a (not brief) description of changes in the PR description as well as some screenshots. There’s still a couple of things I want to change in it, particularly around how the API is being queried, but I’m waiting to hear back from OnlyCat about that. For now it’s functional, just not super efficient.

Any thoughts appreciated, thanks again! :slight_smile:

https://github.com/OnlyCatAI/onlycat-home-assistant/pull/63

Hey all,

Can anyone help me figure out how do I get the microchip ID (or cat name) from an entry/exit event?

As far as I can tell, the only sensor that would provide this is the “flap event” binary sensor, but I can’t seem to get any attributes out of it. I delved into the code and it looks like there should be attributes for:

  • rfidCodes
  • timestamp
  • eventTriggerSource
  • eventId

But none of those ever seem populated and always return a value of “None”. Am I misunderstanding something? Here’s my basic automation for testing this:

alias: "Cat Flap: Notify on event"
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.oc_xxxxxxxx_event
    to:
      - "on"
conditions: []
actions:
  - action: notify.mobile_app_xq_ec54
    metadata: {}
    data:
      message: >-
        "RFID codes: {{ state_attr('binary_sensor.oc_xxxxxxxx_event',
        'rfidCodes') }}"
      title: Cat Flap
mode: single

Hi
You correctly access the rfidcodes within the flap event.
Trigger this automation on any change on the binary sensor.

The event is a multistep event as communicated by the flap. The first movement already triggers the event to “on”. Additional information like rfid codes are added while it is already on, as soon as the cat flap reports it.

I trigger mine just with

  - trigger: state
    entity_id:
      - binary_sensor.oc_xxxx_event
1 Like

Ah right, so the attributes change without the state itself changing, I’ll give that a go.

This may be the best device I have purchased in a while. When my Cat was stopped with pray yesterday morning I was really relieved that it worked so well. :slight_smile:
I want to keep track of how often this happens, and with the OnlyCat integrated to Home Assistant that was pretty easy:
I created, with som help for Google/AI for the condition, an automation that increases a counter when the OnlyCat detects contraband. The condition is that the counter has not been changed for the last 10 minutes. My cat has only tried to bring a pray in once since installation last week, and only tried two times within a couple of minutes. This may have to be adjusted.

I use a helper, type Counter, that is updated by the automation. My helper is named “Ludvik stoppet med bytte”, meaning the Cat has been stopped with pray.

This is my automation to update the counter:

alias: Ludvik oppdatert teller stoppet med byttedyr
description: Med betingelse at det er minst 10 min siden sist forsøk med bytte.
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.oc_8c1f64481e52_contraband
    to:
      - "on"
conditions:
  - condition: template
    value_template: >-
      {{ now() > (states.counter.ludvik_stoppet_med_bytte.last_updated +
      timedelta(minutes=10)) }}
actions:
  - action: counter.increment
    metadata: {}
    data: {}
    target:
      entity_id: counter.ludvik_stoppet_med_bytte
mode: single

I hope this can be useful for others too. :slight_smile:

3 Likes

I’m now trying to ensure I only get notifications once the RFID has actually been scanned but for some reason the not_to trigger setting just isn’t working as expected. I use it in lots of other automations and have never had a problem. My trigger is this:

alias: "Cat Flap: Notify on event"
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.oc_xxxxxxx_event
    attribute: rfidCodes
    not_to:
      - unknown
      - unavailable
      - none
      - None

But every time it triggers, the rfidCodes attribute is “None”. I don’t see how that’s possible…

I vaguely remember having the same issue, but I don’t know what the reason for this behavior is.

I built my automation that requires the RFID codes with a generic trigger and a condition.

alias: Catucator smart
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.oc_xxx_event
conditions:
  - condition: or
    conditions:
      - alias: Evil cat 1
        condition: template
        value_template: >-
          {{ '7560981xxxxxxxx in
          state_attr('binary_sensor.oc_xxx_event', 'rfidCodes') }}
      - alias: Evil cat 2
        condition: template
        value_template: >-
          {{ '756098xxxxxxxx' in
          state_attr('binary_sensor.oc_xxx_event', 'rfidCodes') }}

So for your automation I’d suggest trying

alias: test
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.oc_xxxxxxx_event
conditions:
  - alias: Ensure RFID
    condition: template
    value_template: "{{ state_attr('binary_sensor.oc_xxx_event', 'rfidCodes') is not none }}"
actions:
  - action: counter.increment
    metadata: {}
    data: {}
    target:
      entity_id: counter.test
1 Like

Yeah that’s how I’m doing it now, just a bit weird that the not_to keyword doesn’t seem to work properly, given it works every other time I’ve used it. Could be that it’s buggy with attributes.

Firstly, thanks to everyone who has put effort into developing this integration. I have been using it for a few months now and it works well.

Is there any news of when OnlyCat will implement their promised local access to the cat flap?

1 Like

I sent them a message last week asking for this, but now that you mention it, let’s ask them here: @OnlyCat do you have any update about this? Could you please share your roadmap or timelines when the local access to the catflap will be available?

3 Likes

I am new to OnlyCat, just installed ours last week and so far loving it. I am also moving from Samsung SmartThings to HA very soon. So I am very interested in integration with HA. However, I have some experience with industrial automation and would like to see MQTT implemented with OnlyCat. I believe his would open up the local interface for lots of other use cases than just HA.

My vision would be for OnlyCat to be a MQTT client and configurable to connect with a MQTT broker using user/password authentication. Encryption with TLS probably not necessary at first (if ever). At first, the OnlyCat client could just publish with MQTT a topic and subtopics with status messages to the broker. Other applications like HA could connect to the broker and subscribe to the topic/messages. Would this make sense?

1 Like