Munich Datageeks e.V.
Talk "How the Catflap Got Boring (Or Did It?) – Over 10 Years of Purr-sistence"
Andreas Hübner on stage for his talk

Talk "How the Catflap Got Boring (Or Did It?) – Over 10 Years of Purr-sistence"

Felix Reuthlinger

A 10+ year journey of building and continuously evolving a smart cat flap system - from basic Raspberry Pi sensors to machine learning, Home Assistant integration, and reverse-engineered hardware. A tale of persistence, over-engineering, and why some projects never get boring.

Topic was presented at Munich Datageeks - 100th Munich Datageeks Meetup - October 2025

Abstract

Andreas Hübner, a data scientist and cat owner, presented an updated version of his 2015 Munich Datageeks talk at Stylight, celebrating the 100th meetup of the community. The presentation chronicles over 10 years of continuously operating a smart cat flap system for his cat Mika, demonstrating how a personal project evolved through multiple technological iterations while maintaining production status since August 2014.

Mika, born in 2012 in Aschaffenburg, moved to Munich in 2013 with Andreas and his then-girlfriend (now wife). The transition from a house with outdoor access to a ground-floor apartment created the need for a cat flap solution, as constantly opening and closing doors became tedious for both the cat and the humans.

About the speaker

Andreas Hübner is a data scientist at IFCO, where he works on improving food supply chain sustainability by optimizing operations across over 400 million assets. He has been programming and working with data for nearly a decade, developing expertise across various data science disciplines.

A long-time member of the Munich Datageeks community, Andreas first presented his smart cat flap project at the meetup in 2015. What started as a solution to track his cat Mika's whereabouts has evolved into a continuously running production system spanning over 10 years, incorporating technologies from basic Raspberry Pi sensors to machine learning, Home Assistant integration, and most recently, reverse-engineered local hub replacements.

When not optimizing supply chains or tinkering with IoT projects, Andreas enjoys hands-on home projects and spending time with his wife and cat in Ottobrunn.

Transcript summary

Initial Problem: The Schrödinger's Cat Dilemma

The fundamental challenge wasn't just providing access, but knowing the cat's location. Similar to Schrödinger's famous thought experiment, pet owners face uncertainty about their animals' whereabouts. This creates anxiety about safety and wellbeing, making it desirable to track when the cat is inside or outside the home.

First Technical Implementation (2014-2015)

Hardware Setup

The initial solution involved purchasing the largest available pet flap (suitable even for small dogs) due to Mika's size. The flap featured NFC technology that recognized Mika's implanted chip, preventing neighbor cats like Francel from entering.

The monitoring system consisted of:

  • A Raspberry Pi mounted in a shutter
  • Two reed sensors (green and red) positioned to detect flap movement
  • A magnet attached to the flap door
  • Custom cabling connecting sensors to the Raspberry Pi GPIO pins
  • Professional glass cutting service (€600) to install the flap in a glass door

Software Architecture

The system used a simple but effective stack:

  • Python script processing GPIO pin signals from reed sensors
  • CouchDB for data storage
  • PushBullet app for mobile notifications

Pattern Recognition Logic

The sensor data generated patterns of zeros, ones, and twos based on which sensor detected the magnet. The processing logic included:

  • State machine implementation with waiting, active data collection, and cooldown phases
  • Pattern analysis to determine direction: pattern starting with 1 indicated outgoing, pattern starting with 2 indicated incoming
  • Detection of the longest zero segment representing the actual passage duration when Mika moved through the flap
  • Data cleaning to handle real-world noise and irregularities, including tail length analysis and passage duration filtering

The system successfully sent notifications indicating when Mika entered or exited, initially displaying the raw pattern data as a nerdy feature.

Data Analysis Insights

The collected data revealed several interesting behavioral patterns:

Daily Activity Patterns - Mika showed peak activity in early morning hours, with moderate afternoon activity. This aligned with expected cat behavior for animals without daytime schedules or obligations.

Weekend vs. Weekday Differences - Counter-intuitively, Mika was more active on weekends. During weekdays (pre-remote work era), the owners were absent, causing Mika to become bored and sleep more. On weekends, human presence in the home stimulated more activity.

Weekly Activity Decay - The weekend activity effect showed interesting dynamics across the week:

  • Sunday: High daytime activity
  • Monday-Tuesday: Gradually declining activity
  • Wednesday-Friday: Minimal daytime activity (mostly sleeping)
  • Saturday: Significant activity increase

Meal-Related Timing - Mika demonstrated smart behavioral patterns related to feeding:

  • Tended to come home before bedtime (last chance for daily food)
  • Entered before or right as humans woke up (first meal opportunity)
  • This raised causality questions: does Mika's entry trigger the humans to wake, or do waking humans trigger Mika to enter?

Nocturnal Caution - Passage duration analysis revealed that Mika took longer to pass through the flap during nighttime hours, particularly when exiting. This suggested he paused to assess the environment more carefully before venturing outside in darkness.

Weather Resistance - Temperature and humidity data showed no correlation with passage duration or frequency. Mika's fur provided adequate protection, making him largely immune to weather conditions when deciding whether to go outside.

Project Outcomes (2015)

The project achieved two key successes:

  • Mika continued to thrive with the automated system
  • The Significant Other Approval Factor (SOAF) increased substantially, enabling approval for future technology purchases

Hardware Revolution and Machine Learning (2019-2020)

Motivated by boredom during the early pandemic period, Andreas undertook a major hardware revision with several goals:

Hardware Improvements

  • Miniaturization: Replace the bulky Raspberry Pi with a smaller, directly-mounted solution
  • Accessibility: Position components for easier access without crouching under furniture
  • Robustness: Make sensors pluggable rather than permanently attached, preventing damage from accidental pulls
  • Enhanced functionality: Add a camera for visual monitoring

Prey Detection Feature

The driving motivation was preventing Mika from bringing prey (mice, birds) into the home. The plan involved:

  • Installing a camera above the flap
  • Developing a machine learning model to detect prey in images
  • Automatically locking the flap when prey was detected
  • Creating an open-source package for others with similar needs

The camera provided video footage triggered by motion detection. Andreas built a custom labeling application to prepare training data for the machine learning model.

Updated Software Stack

The system migrated to more modern technologies:

  • MQTT replaced CouchDB for messaging
  • Motion software on Raspberry Pi for image capture
  • Node-RED for pattern processing
  • Firebase for storage
  • Telegram for notifications (replacing PushBullet)

The Telegram bot integration provided enhanced interactivity through clickable buttons that triggered webhooks, enabling feedback collection that wasn't possible with the previous app.

Visual Pattern Recognition

The notification system evolved from displaying raw numeric patterns to showing visual pattern representations in the Telegram chat. Users could click buttons to label patterns as "going in," "going out," or "invalid," providing training data for a Multi-Layer Perceptron (MLP) that replaced the rule-based pattern recognition system.

Project Abandonment

Despite the technical implementation, the prey detection feature never gained stakeholder (wife) approval. Consequently, data collection, analysis, and machine learning became less critical, though reliability and aesthetics remained important.

Software Revolution: Home Assistant Integration (2020-2024)

Andreas discovered Home Assistant, which he described as a complete rabbit hole, leading to another major architectural change.

Simplified Stack

The system shed several components:

  • Removed Firebase
  • Removed Telegram
  • Integrated everything into Home Assistant ecosystem

New Architecture

  • MQTT sends video snippets to Frigate (NVR software)
  • Direct Raspberry Pi connection to Frigate
  • Frigate integrates with Home Assistant
  • Home Assistant Companion app provides notifications and status tracking
  • Dashboard shows status of all household members, including Mika's indoor/outdoor location

This integration provided a cleaner, more unified smart home experience with better status visibility.

Hardware Commoditization (2024)

A move from Trudering to Ottobrunn necessitated another hardware change.

Moving Logistics

Pro tip learned: Keep original glass when installing cat flaps in rental properties, as landlords require restoration upon moving out. The original glass was successfully reinstalled when leaving the previous apartment.

Commercial Solution

Ten years after the initial project, commercial solutions had matured significantly. Andreas purchased:

  • SurePet Pet Flap Connect: Wire-free design improving aesthetics
  • SurePet Hub: Cloud-based connectivity hub

The SurePet hardware quality proved excellent, with the original flap still functioning in a different location. The system integrated well with Home Assistant, reducing technical complexity significantly.

Compromises and Issues

The commoditized solution introduced several drawbacks:

  • Camera functionality lost (solved through alternative means)
  • Cloud dependency for a system controlling home access (concerning for critical infrastructure)
  • Approximately one-minute delay in data reaching Home Assistant
  • Additional app required for full functionality management
  • Not suitable for truly critical systems where life and death decisions depend on real-time response

Return to Hacking: Current State

The story doesn't end with commoditization. Two developments prompted renewed tinkering:

Second Cat Flap Installation

A winter garden required a second cat flap. This non-smart flap used the original hacking approach:

  • Shelly door/window sensor with longer reed sensor cables soldered on
  • Replacement of the built-in sensor with the extended external version
  • Similar pattern detection to the original 2014 implementation
  • Both flaps now sending notifications through unified system

Hub Replacement Project

Recent experimentation (around the time of the presentation preparation) focused on eliminating the problematic cloud-dependent hub:

  • Reverse engineering the SurePet Hub protocol
  • Implementing local hub functionality on an ESP32 microcontroller
  • Eliminating cloud dependency and reducing latency
  • Very early stage experimentation with rough implementation

Conclusion and Reflection

The project demonstrates that the cat flap system never actually became boring, continuously evolving through:

  • Three major hardware iterations
  • Multiple software architecture revisions
  • Integration with emerging smart home platforms
  • Cycles between DIY solutions and commercial products
  • Return to hacking when commercial solutions proved inadequate

The system has maintained production status since August 20, 2014, representing over 10 years of continuous operation. Andreas expressed interest in checking back at the 200th Munich Datageeks meetup to see what further developments might occur.

The presentation illustrated how a simple personal project can serve as a vehicle for learning new technologies, adapting to changing ecosystems, and maintaining engagement through continuous iteration—even when the core functionality remains essentially unchanged.