Raumgenaue Indoor-Ortung per WLAN โ mit den FritzBox-Routern, die ohnehin an der Wand haengen. Room-level indoor positioning over Wi-Fi โ using only the routers you already own. Sahip oldugun WLAN router'lariyla, ev ici oda-bazli konum tespiti.
๐ Sprache / Language / Dil: ย ๐ฉ๐ช Deutsch ย ยทย ๐ฌ๐ง English ย ยทย ๐น๐ท Tuerkce
โ๏ธ Trademark / Marken-Hinweis DE โ FRITZ! und FRITZ!Box sind eingetragene Marken der FRITZ! GmbH (vormals AVM GmbH). Dieses Projekt ist ein unabhaengiges, von der Community entwickeltes Werkzeug und steht in keiner Verbindung zu FRITZ!/AVM. Produktnamen werden ausschliesslich zu Identifikationszwecken genannt, um die Kompatibilitaet zu beschreiben. EN โ FRITZ! and FRITZ!Box are registered trademarks of FRITZ! GmbH (formerly AVM GmbH). This project is an independent, community-developed tool, neither affiliated with, authorized, sponsored nor endorsed by FRITZ!/AVM. Product names are used for identification purposes only to describe compatibility.
โ ๏ธ Haftungsausschluss / Disclaimer / Sorumluluk Reddi โ bitte lesen / please read / lutfen oku DE โ FritzTrack4U ist ein Eigen-Lern- und Bastel-System zum selber Aufbauen, Lernen und Experimentieren. Die Nutzung erfolgt vollstaendig auf eigene Gefahr. Jeder ist fuer sein eigenes System, seine FritzBoxen, seine Daten und seine Automationen selbst verantwortlich. Es wird keine Haftung uebernommen โ fuer keinerlei Schaeden, Datenverluste, Fehlfunktionen, Folgeschaeden oder sonstige Nachteile, die direkt oder indirekt aus der Nutzung entstehen. Keine Gewaehr fuer Richtigkeit, Genauigkeit oder Eignung fuer einen bestimmten Zweck. EN โ FritzTrack4U is a self-learning, DIY hobby system for building, learning and experimenting yourself. Use is entirely at your own risk. Everyone is solely responsible for their own system, FritzBoxes, data and automations. No liability is accepted for any damage, data loss, malfunction, consequential harm or other disadvantage arising directly or indirectly from its use. No warranty of correctness, accuracy or fitness for a particular purpose. TR โ FritzTrack4U, kendin kurup ogrenmen ve denemen icin bir kendin-yap / kendi-ogrenme sistemidir. Kullanim tamamen kendi sorumlulugundadir. Herkes kendi sistemi, FritzBox'lari, verileri ve otomasyonlarindan kendisi sorumludur. Kullanimdan dogabilecek hicbir zarar, veri kaybi, ariza veya dolayli zarardan sorumluluk kabul edilmez. Dogruluk veya belirli bir amaca uygunluk icin garanti verilmez.
๐ฌ Demo-GIF folgt ยท
docs/images/demo.gifโ vier Etagen, Live-Punkte pro Person, ohne dass jemand eine App oeffnet.
Raumgenaue Ortung im ganzen Haus โ nur mit den FritzBoxen, die ohnehin an der Wand haengen. Keine Zusatz-Hardware. Kein ESP32. Keine API-Keys. Ein bis viele AVM-Router, TR-064 und die Sturheit, nicht zu glauben dass es nicht geht.
GPS funktioniert draussen perfekt und drinnen gar nicht. Genau im Haus willst du aber wissen, wer wo ist. FritzTrack4U loest das mit einem einzigen Gedanken:
Mehrere FritzBoxen ergeben gemeinsam ein Signal-Muster โ verglichen gegen vorher eingelernte Raum-Profile.
Ein Handy haengt zu jedem Zeitpunkt an einer Box โ aber ueber kurze Zeit und mehrere Boxen-Standorte entsteht ein Signal-Muster (Vektor). Welche Box es haelt, verraet die Etage; das Muster, verglichen gegen eingelernte Raum-Fingerprints, verraet den Raum.
flowchart LR
P(("๐ฑ Ein Handy<br/>im Kaminraum"))
P -. "stark" .-> B1["๐ก Box A<br/>80%"]
P -. "mittel" .-> B2["๐ก Box B<br/>40%"]
P -. "schwach" .-> B3["๐ก Box C<br/>15%"]
P -. "kaum" .-> B4["๐ก Box D<br/>5%"]
B1 --> V["๐งฎ Vektor (Muster)<br/>{A:80, B:40,<br/>C:15, D:5}"]
B2 --> V
B3 --> V
B4 --> V
V --> M{{"Vergleich gegen<br/>eingelernte Raum-Profile<br/>(mittlere Abweichung)"}}
M --> R(["๐ Position:<br/>Kaminraum"])
Der Punkt: Die Position kommt aus dem Vergleich des Signal-Musters gegen vorher eingelernte Raum-Fingerprints โ nicht aus einer gleichzeitigen Mehrfach-Messung. Je mehr Boxen im Haus verteilt sind, desto dichter das Muster und desto stabiler die Raum-Erkennung.
So wird aus einer einzelnen Box ein grober Etagen-Sensor โ und aus mehreren Boxen ein raumgenaues Ortungssystem:
flowchart TD
Phone["๐ฑ Handy im Raum"]
Phone -.->|"80%"| B1["๐ก FritzBox 1"]
Phone -.->|"40%"| B2["๐ก FritzBox 2"]
Phone -.->|"15%"| B3["๐ก FritzBox 3"]
Phone -.->|"5%"| B4["๐ก FritzBox 4"]
B1 --> V["๐งฎ Signal-Vektor (Muster)<br/>[80, 40, 15, 5]"]
B2 --> V
B3 --> V
B4 --> V
V ==>|"Vergleich gegen eingelernte Raum-Profile<br/>mittlere Abweichung"| Match{"๐ Bester Treffer?"}
Match --> Pos["๐ Raum: Buero"]
subgraph Kalibriert ["Gespeicherte Raum-Fingerprints"]
FP1["Buero: [78, 42, 14, 6]"]
FP2["Kueche: [20, 75, 30, 10]"]
FP3["Schlafzimmer: [10, 25, 70, 40]"]
end
Kalibriert -.-> Match
classDef phone fill:#a855f7,stroke:#7c3aed,color:#fff,stroke-width:2px
classDef box fill:#1e293b,stroke:#475569,color:#e2e8f0
classDef vector fill:#7c3aed,stroke:#a855f7,color:#fff,stroke-width:2px
classDef result fill:#16a34a,stroke:#15803d,color:#fff,stroke-width:2px
classDef fp fill:#0f172a,stroke:#334155,color:#94a3b8
class Phone phone
class B1,B2,B3,B4 box
class V vector
class Pos result
class FP1,FP2,FP3 fp
Kernaussage: Nicht die staerkste Box entscheidet, sondern der volle Vektor aller Boxen gegen die kalibrierten Raum-Fingerprints. Staerkste Box = Etage, voller Vektor = Raum, keine Box = abwesend.
- ๐ช Etagen-Erkennung ueber die staerkste Box โ funktioniert sofort, schon ab einer Box.
- ๐ Raum-Erkennung ueber Multi-Box-Signalvektor + kalibrierte Fingerprints โ nach dem Einlernen pro Raum (Kalibrierung noetig, siehe unten).
- ๐ช Anwesenheit/Abwesenheit: Sieht keine Box das Handy โ die Person ist nicht zu Hause.
- ๐ฅ Gaeste-Erkennung: Unbekannte Geraete werden als Gast erkannt, nicht still ignoriert.
- ๐๏ธ SQLite-Verlauf mit 60-Tage-Auto-Cleanup โ wer war wann in welchem Raum.
- โฑ๏ธ Adaptiver Takt: schnell bei Bewegung, sparsam bei Ruhe โ schont die FritzBox.
- ๐ Home Assistant ueber MQTT-Auto-Discovery โ pro Person ein Sensor, ohne Handarbeit.
- ๐งฉ Config-getrieben, 1 bis N Boxen: funktioniert mit einer einzigen Box, skaliert auf beliebig viele.
- ๐ธ 0 โฌ Zusatz-Hardware. Keine API-Keys. Keine Cloud.
| Boxen | Was du bekommst | Genauigkeit |
|---|---|---|
| 1 Box | Welche Box haengt das Handy? โ grobe Etage + Anwesenheit | ๐ข sofort, ohne Setup |
| 2โ3 Boxen | Signalvektoren โ Raum โ nach Kalibrierung pro Raum | ๐ก raumgenau nach Einlernen |
| 4+ Boxen | Dichterer Vektor โ stabiler Raum, weniger Schwankung | ๐ก raumgenau, robuster |
Ehrlich: Etage + Anwesenheit laufen sofort. Raum-Genauigkeit braucht Kalibrierung (einmal pro Raum einlernen) โ und haengt davon ab, ob ein Handy ueberhaupt von mehreren Boxen gesehen wird (WLAN-Physik: ein Handy ist meist nur mit einer Box verbunden). Das ist ein Lern-/Bastel-Projekt, kein Zentimeter-GPS.
Damit niemand falsche Erwartungen hat (und das Projekt glaubwuerdig bleibt):
| โ Das kann FritzTrack4U | โ Das kann es NICHT |
|---|---|
| Erkennen in welchem Raum / auf welcher Etage jemand ist | Zentimeter-genaue Position im Raum (kein โX steht am Schreibtisch") |
| Anwesend / abwesend zuverlaessig melden | Geraete sehen, die nicht im WLAN verbunden sind (z.B. fremde Gast-Handys ausser Reichweite) |
| Mehrere Personen gleichzeitig (je 1 getrackt. Geraet) | Personen ohne Handy orten |
| Gaeste (unbekannte Geraete) melden | Eine fremde MAC zuverlaessig wiedererkennen (iPhones randomisieren MACs) |
| Mit 1 Box (Etage) bis N Boxen (Raum) skalieren | Mit Hardware-Praezision von UWB / BLE-Beacons mithalten |
Physikalische Grenze, ehrlich gesagt: WLAN-Signal schwankt von Natur aus ein paar Prozent (auch wenn man stillsteht). Darum ist die Aufloesung raum-genau, nicht punkt-genau. Wer Zentimeter braucht, nutzt UWB oder BLE-Beacons. Wer wissen will in welchem Zimmer jemand ist โ ohne Zusatz-Hardware โ ist hier richtig.
Ehrlich bleiben: ESP32 ist der genauere Profi-Standard. FritzTrack4U gewinnt, wenn du null Zusatz-Hardware willst.
| Kriterium | FritzTrack4U | ESP32 Bermuda / ESPresense |
|---|---|---|
| Hardware-Kosten | 0 โฌ (Boxen vorhanden) | ~5 โฌ pro Chip, einer pro Raum |
| Zusatz-Geraete im Haus | keine | viele (ein Chip je Raum) |
| Genauigkeit | raumgrob โ raumgenau (mit Vektor) | raumgenau, <10 s |
| Reifegrad | Eigenbau, hier dokumentiert | Profi-Standard |
| Einrichtung | 1 Router-User pro Box | Chips flashen + verteilen |
| Stromverbrauch zusaetzlich | 0 (Boxen laufen eh) | gering, aber vielfach |
| Wann gewinnt es | du willst nichts dazukaufen | du willst maximale Genauigkeit |
Fazit: Kein โbesser als ESP32" โ sondern umsonst und gut genug, mit Luft nach oben.
Diese Szenarien sind die Richtung, nicht alle schon fertig. Was geplant ist, ist als geplant markiert.
Smart-Home-Komfort im eigenen Zuhause (der Kern):
- ๐ Kind betritt sein Zimmer โ Licht geht an. Verlaesst es โ nach Puffer wieder aus.
- ๐ฅ๏ธ Du verlaesst das Buero โ Monitore aus, PC sperrt, Heizung runter. (geplant โ benoetigt schaltbare Geraete)
- ๐ฅ Heizung folgt den Menschen statt der Uhr โ warm, wo jemand ist. (geplant)
- ๐ช โWer ist zu Hause?" als Karte fuers ganze Haus โ Etage, Raum, Anwesenheit.
- ๐ Gaeste-Hinweis: ein unbekanntes Handy taucht im WLAN auf.
Bewusst NICHT das Ziel: Mitarbeiter-Ueberwachung am Arbeitsplatz oder Kunden-Tracking im Laden. Das waere in Deutschland datenschutzrechtlich heikel (DSGVO, Betriebsrat) โ FritzTrack4U ist ein Werkzeug fuers eigene Zuhause, mit deiner eigenen Familie und deiner eigenen Einwilligung.
flowchart LR
subgraph Boxes ["FritzBoxen"]
F1["๐ก FritzBox 1"]
F2["๐ก FritzBox 2"]
F3["๐ก FritzBox 3"]
F4["๐ก FritzBox 4"]
end
F1 -->|"TR-064 / Port 49000"| D
F2 -->|"TR-064 / Port 49000"| D
F3 -->|"TR-064 / Port 49000"| D
F4 -->|"TR-064 / Port 49000"| D
D["๐ Python-Daemon<br/>sammelt Signal-Vektoren"]
D -->|"speichert"| DB[("๐พ SQLite-Verlauf<br/>60 Tage")]
D -->|"publiziert"| MQTT["๐จ MQTT-Broker"]
MQTT --> HA["๐ Home Assistant"]
HA --> S1["๐ค Person A: Buero"]
HA --> S2["๐ค Person B: Kueche"]
classDef box fill:#1e293b,stroke:#475569,color:#e2e8f0
classDef daemon fill:#7c3aed,stroke:#a855f7,color:#fff,stroke-width:2px
classDef store fill:#0ea5e9,stroke:#0284c7,color:#fff
classDef bus fill:#f59e0b,stroke:#d97706,color:#1e293b
classDef ha fill:#16a34a,stroke:#15803d,color:#fff,stroke-width:2px
classDef person fill:#0f172a,stroke:#334155,color:#cbd5e1
class F1,F2,F3,F4 box
class D daemon
class DB store
class MQTT bus
class HA ha
class S1,S2 person
git clone https://github.com/Aslan4u73/FritzTrack4u.git
cd FritzTrack4u
# Nur noetig wenn du MQTT/Home Assistant nutzt (sonst laeuft es ohne Abhaengigkeiten):
pip install -r requirements.txt
# Konfiguration aus der Vorlage anlegen und ausfuellen:
cp config.example.json config.json
nano config.json
python3 fritztrack4u.py --config ./config.jsonPflicht-Schritt fuer Multi-Box (der eigentliche Trick): Lege auf jeder FritzBox einen eigenen Benutzer mit dem Recht โFRITZ!Box Einstellungen" an. Nur dann liefert jede Box per TR-064 ihre eigene Signalstaerke. Fragst du nur den Master, bekommst du nur einen Wert โ und damit keinen Vektor. Komplette Anleitung: docs/INSTALL.de.md.
// config.example.json (Auszug โ volle Vorlage im Repo)
{
"boxes": [
{ "name": "Buero", "ip": "192.168.178.1", "floor": "Erdgeschoss", "floor_nr": 0, "user": "tracker", "password": "DEIN_PASSWORT" },
{ "name": "Schlafzimmer", "ip": "192.168.178.2", "floor": "Obergeschoss", "floor_nr": 1, "user": "tracker", "password": "DEIN_PASSWORT" }
],
"devices": { "AA:BB:CC:DD:EE:FF": "Person1" },
"mqtt": { "enabled": true, "host": "192.168.178.50", "port": 1883, "user": "ha", "password": "..." },
"intervals": { "normal": 60, "movement": 15, "idle": 300, "live": 3 },
"retention_days": 60
} N x FritzBox (Mesh) Host (Mini-Server, LAN-only) Home Assistant
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Box A (Master)โ TR-064 / 49000 โ fritztrack4u.py โ MQTT โ Sensor je โ
โ Box B โโโโโโโโโโโโโโโโโโบโ - Login pro Box (SID) โโโโโโโโบโ Person โ
โ Box C โ โ - SignalStrength % je Boxโ 1883 โ Anwesenheit โ
โ Box D โ โ - Vektor + Fingerprint โ โ + Live-Btn โ
โโโโโโโโโโโโโโโโ โ - SQLite 60-Tage-Verlauf โ โ + (3D-Viz) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
- Login: AVM-Challenge-Response (MD5 ueber UTF-16LE โ der Stolperstein), SID wird ~900 s wiederverwendet, um die Box zu schonen.
- Datenquelle: TR-064
GetGenericAssociatedDeviceInfopro Box โSignalStrength(%) je Handy. - Vektor: alle Box-Werte pro Handy einsammeln โ
[Box A%, Box B%, โฆ]. - Match:
best_room()vergleicht den Vektor gegen kalibrierte Raum-Fingerprints (mittlere Abweichung ueber alle Boxen). - Haertung: Retries + Pausen gegen FritzBox-Ueberlast, grosse Normal-Intervalle als Schutz.
๐ผ๏ธ Screenshots folgen ยท
docs/images/3d-haus.png,docs/images/ha-sensoren.png
Diese README dokumentiert die Reise ehrlich, inklusive aller Sackgassen. Es gab keinen genialen Trick โ es gab Sturheit.
- Der erste Konsens: โFritzBox kann kein Indoor-Tracking, eine Box meldet pro Handy nur einen Wert โ alle nehmen ESP32." Klingt fundiert. War unvollstaendig.
- Mesh-Sticking entdeckt: Ein Handy klebt an einer alten Box, obwohl die Person laengst weg ist. โAn welcher Box haengt es" โ โwo ist die Person". Erster Beweis, dass die naive Annahme falsch ist.
- ~12 API-Wege ueber 3 Test-Runden: viele Sackgassen โ
edit_device(1 Wert),meshlist.lua(404),meshTopo(Daten, aber keine rssi-Felder), homeNet/meshNet (kein dBm). Jeder Weg ehrlich getestet, nicht โgefuehlt" verworfen. - Dreimal โunmoeglich" โ dreimal widersprochen: Die KI erklaerte drei Mal selbstbewusst โTriangulieren mit FritzBox geht nicht". Murat widersprach jedes Mal โ auf Basis Physik: Nachbarboxen hoeren das Handy schwach durch die Waende (genau das nutzt die FritzBox intern fuers Mesh-Steering). Er hatte jedes Mal recht.
- ๐ฅ Der Durchbruch: Nicht nur den Master fragen โ eigener Login PRO Box. Dann liefert TR-064
GetGenericAssociatedDeviceInfopro Box denSignalStrength. Beobachtet: In Grenzfaellen sieht eine Nachbarbox dasselbe Handy schwach durch die Wand โ z.B.{Buero 35%, SARA 10%}. Das ist die Ausnahme (meist haengt ein Handy nur an einer Box), reicht aber mit Etagen-Info und kalibrierten Fingerprints fuer eine Raum-Zuordnung. - Anwesenheits-Bug gefunden & gefixt: Ein offline gegangenes Handy klebte auf dem alten Raum โ jetzt gilt: keine Box sieht das Handy = abwesend.
- iPhone-Standby-Falle: iPhones verschwinden im Standby kurz aus der Assoziationsliste, ohne den Raum zu verlassen. Loesung: 2-Minuten-Puffer, bevor ein Raum als โverlassen" gilt.
Der Strategie-Wechsel, der alles drehte: weg von โeine Box abfragen" hin zu โMulti-Box-Datensammler". Aus einer Momentaufnahme wurde ein dynamisches Ortungssystem. Murat hatte bei allem recht.
Die Lektion: Dreimal โgeht nicht" ist kein Beweis, dass es nicht geht. Frag alle Knoten, nicht nur den naechstliegenden.
| Version | Was dazukam |
|---|---|
| v1 | Eine Box, nur grobe Etage (โan welcher Box haengt das Handy"). |
| v5 | Fingerprint-Kalibrierung pro Raum โ 1 Box + dBm, erste Raum-Genauigkeit. |
| v6 | Multi-Box-Datensammler: alle Boxen einzeln per TR-064, Anwesenheits-Check (offline = abwesend), SQLite-Verlauf, adaptiver Takt. |
| v6.1 | Gaeste-Erkennung + 60-Tage-Auto-Cleanup. |
| FritzTrack4U (public) | Config-getrieben 1โN Boxen, anonymisiert, voller-Vektor-Match ueber alle Boxen. |
Room-level positioning for a whole house โ using only the FritzBoxes already on your walls. No extra hardware. No ESP32. No API keys. One to many AVM routers, TR-064, and the stubbornness to not believe it can't be done.
GPS works perfectly outdoors and not at all indoors. Yet indoors is exactly where you want to know who is where. FritzTrack4U solves it with a single idea:
Several FritzBoxes together form a signal pattern โ matched against room profiles you trained beforehand.
A phone is associated with one box at any moment โ but across a short time span and several box locations a signal pattern (vector) emerges. The box it's on reveals the floor; the pattern, matched against trained room fingerprints, reveals the room.
flowchart LR
P(("๐ฑ One phone<br/>in the den"))
P -. "strong" .-> B1["๐ก Box A<br/>80%"]
P -. "medium" .-> B2["๐ก Box B<br/>40%"]
P -. "weak" .-> B3["๐ก Box C<br/>15%"]
P -. "faint" .-> B4["๐ก Box D<br/>5%"]
B1 --> V["๐งฎ Vector<br/>{A:80, B:40,<br/>C:15, D:5}"]
B2 --> V
B3 --> V
B4 --> V
V --> M{{"Match vs.<br/>trained room profiles<br/>(mean absolute deviation)"}}
M --> R(["๐ Position:<br/>the den"])
The point: position comes from matching the signal pattern against room fingerprints trained beforehand โ not from a simultaneous multi-box measurement. The more boxes spread across the house, the denser the pattern and the more stable the room detection.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฑ ONE room (e.g. the office) โ
โ โ โ
โ โโโโโ ๐ก Box 1 โโโโโโโโโโ 80% โ strong, same room โ
โ โโโโโ ๐ก Box 2 โโโโโโโโโโ 40% โ next room โ
โ โโโโโ ๐ก Box 3 โโโโโโโโโโ 15% โ through a wall โ
โ โโโโโ ๐ก Box 4 โโโโโโโโโโ 5% โ other floor โ
โ โผ โ
โ Vector {80, 40, 15, 5} โโโบ ROOM: office โ
โ
โ โ
โ Strongest box = FLOOR Full vector = ROOM โ
โ No box sees the phone = AWAY โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- ๐ Room-level positioning via multi-box signal pattern + calibrated fingerprints (matched against trained room profiles).
- ๐ช Floor detection from the strongest box โ works with just one box.
- ๐ช Presence/absence: if no box sees the phone โ the person is away.
- ๐ฅ Guest detection: unknown devices are flagged as guests, not silently dropped.
- ๐๏ธ SQLite history with 60-day auto-cleanup โ who was in which room, when.
- โฑ๏ธ Adaptive polling: fast on movement, gentle at rest โ protects the FritzBox.
- ๐ Home Assistant via MQTT auto-discovery โ one sensor per person, zero manual setup.
- ๐งฉ Config-driven, 1 to N boxes: works with a single box, scales to as many as you like.
- ๐ธ โฌ0 extra hardware. No API keys. No cloud.
| Boxes | What you get | Accuracy |
|---|---|---|
| 1 box | Which box is the phone on? โ rough floor | ๐ก floor-level |
| 2โ3 boxes | First signal vectors โ room (with fingerprint) | ๐ข room-level |
| 4+ boxes | Dense vector โ robust room, basis for position within a room | ๐ข๐ข room-level + |
Rule of thumb: Strongest box = floor. Full vector = room. No box = away.
Let's be honest: ESP32 is the more accurate, professional standard. FritzTrack4U wins when you want zero extra hardware.
| Criterion | FritzTrack4U | ESP32 Bermuda / ESPresense |
|---|---|---|
| Hardware cost | โฌ0 (boxes already there) | ~โฌ5 per chip, one per room |
| Extra devices in the house | none | many (one chip per room) |
| Accuracy | coarse โ room-level (with vector) | room-level, <10 s |
| Maturity | DIY, documented here | professional standard |
| Setup | 1 router user per box | flash + distribute chips |
| Extra power draw | 0 (boxes run anyway) | low, but multiplied |
| When it wins | you want to buy nothing | you want max accuracy |
Bottom line: not "better than ESP32" โ but free and good enough, with room to grow.
git clone https://github.com/Aslan4u73/FritzTrack4u.git
cd FritzTrack4u
# Only needed if you use MQTT/Home Assistant (otherwise it runs dependency-free):
pip install -r requirements.txt
# Create your config from the template and fill it in:
cp config.example.json config.json
nano config.json
python3 fritztrack4u.py --config ./config.jsonRequired for multi-box (the actual trick): create a dedicated user with the "FRITZ!Box settings" permission on every box. Only then does each box return its own signal strength over TR-064. Query only the master and you get a single value โ and therefore no vector. Full guide: docs/INSTALL.de.md (German).
// config.example.json (excerpt โ full template in the repo)
{
"boxes": [
{ "name": "Office", "ip": "192.168.178.1", "floor": "Ground floor", "floor_nr": 0, "user": "tracker", "password": "YOUR_PASSWORD" },
{ "name": "Bedroom", "ip": "192.168.178.2", "floor": "Upper floor", "floor_nr": 1, "user": "tracker", "password": "YOUR_PASSWORD" }
],
"devices": { "AA:BB:CC:DD:EE:FF": "Person1" },
"mqtt": { "enabled": true, "host": "192.168.178.50", "port": 1883, "user": "ha", "password": "..." },
"intervals": { "normal": 60, "movement": 15, "idle": 300, "live": 3 },
"retention_days": 60
} N x FritzBox (mesh) Host (mini-server, LAN-only) Home Assistant
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Box A (master)โ TR-064 / 49000 โ fritztrack4u.py โ MQTT โ sensor per โ
โ Box B โโโโโโโโโโโโโโโโโโบโ - login per box (SID) โโโโโโโโบโ person โ
โ Box C โ โ - SignalStrength % / box โ 1883 โ presence โ
โ Box D โ โ - vector + fingerprint โ โ + live btn โ
โโโโโโโโโโโโโโโโ โ - SQLite 60-day history โ โ + (3D viz) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
- Login: AVM challenge-response (MD5 over UTF-16LE โ the gotcha), SID reused ~900 s to spare the box.
- Data source: TR-064
GetGenericAssociatedDeviceInfoper box โSignalStrength(%) per phone. - Vector: collect every box value per phone โ
[Box A%, Box B%, โฆ]. - Match:
best_room()compares the vector against calibrated room fingerprints (mean deviation over all boxes). - Hardening: retries + pauses against FritzBox overload, large normal intervals as protection.
This README documents the journey honestly, dead ends included. There was no genius trick โ there was stubbornness.
- The first consensus: "FritzBox can't do indoor tracking, a box reports only one value per phone โ everyone uses ESP32." Sounds solid. It was incomplete.
- Mesh-sticking discovered: a phone clings to an old box even after the person has left. "Which box it's on" โ "where the person is." First proof the naive assumption is wrong.
- ~12 API routes across 3 test rounds: many dead ends โ
edit_device(1 value),meshlist.lua(404),meshTopo(data, but no rssi fields), homeNet/meshNet (no dBm). Every route actually tested, not dismissed "by feel." - Three times "impossible" โ three times contradicted: the AI confidently declared "you can't triangulate with a FritzBox" three times. Murat disagreed each time โ on physics: neighbor boxes hear the phone faintly through the walls (exactly what the FritzBox uses internally for mesh steering). He was right every time.
- ๐ฅ The breakthrough: don't query only the master โ a dedicated login PER box. Then TR-064
GetGenericAssociatedDeviceInforeturns each box'sSignalStrength. Observed: in edge cases a neighbor box sees the same phone faintly through the wall โ e.g.{Office 35%, Sara 10%}. That is the exception (usually a phone is attached to only one box), but combined with floor info and calibrated fingerprints it is enough for a room assignment. - Presence bug found & fixed: a phone gone offline stuck to its old room โ now: no box sees the phone = away.
- The iPhone standby trap: iPhones briefly vanish from the association list in standby without leaving the room. Fix: a 2-minute buffer before a room counts as "left."
The strategy shift that turned everything: away from "query one box" toward "multi-box data collector." A snapshot became a dynamic positioning system. Murat was right about all of it.
The lesson: three "can't be done" is not proof it can't be done. Ask all nodes, not just the nearest.
| Version | What was added |
|---|---|
| v1 | One box, rough floor only ("which box is the phone on"). |
| v5 | Per-room fingerprint calibration โ 1 box + dBm, first room accuracy. |
| v6 | Multi-box data collector: all boxes individually via TR-064, presence check (offline = away), SQLite history, adaptive polling. |
| v6.1 | Guest detection + 60-day auto-cleanup. |
| FritzTrack4U (public) | Config-driven 1โN boxes, anonymized, signal-pattern match against trained room fingerprints. |
Tum ev icin oda-bazli konum tespiti โ sadece zaten duvarda asili olan FritzBox router'larla. Ekstra donanim yok. ESP32 yok. API anahtari yok. Bir ila cok sayida AVM router, TR-064 ve "olmaz" demeye inanmama inadi.
GPS disarida mukemmel, iceride hic calismaz. Oysa kimin nerede oldugunu tam da ev icinde bilmek istersin. FritzTrack4U bunu tek bir fikirle cozer:
Her FritzBox ayni telefonu AYNI ANDA olcer โ her biri kendi sinyal gucuyle.
Bir odadaki telefon tek bir deger degil, tum kutular uzerinde bir vektor uretir. En guclu kutu kati belli eder. Tam vektor odayi belli eder. Eslestirme, kalibre edilmis oda parmak izlerine karsi yapilir โ sadece en guclu kutuya degil, tum kutulara gore.
flowchart LR
P(("๐ฑ Bir telefon<br/>calisma odasinda"))
P -. "guclu" .-> B1["๐ก Kutu A<br/>80%"]
P -. "orta" .-> B2["๐ก Kutu B<br/>40%"]
P -. "zayif" .-> B3["๐ก Kutu C<br/>15%"]
P -. "cok zayif" .-> B4["๐ก Kutu D<br/>5%"]
B1 --> V["๐งฎ Vektor<br/>{A:80, B:40,<br/>C:15, D:5}"]
B2 --> V
B3 --> V
B4 --> V
V --> M{{"Oda parmak izleriyle<br/>karsilastir<br/>(TUM kutular uzerinde<br/>ortalama sapma)"}}
M --> R(["๐ Konum:<br/>calisma odasi"])
Onemli nokta: konum, tam vektor karsilastirmasindan gelir (tum kutular uzerinde ortalama mutlak sapma), yalnizca en guclu kutudan degil. Ne kadar cok kutu dinlerse, o kadar isabetli olur.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฑ BIR oda (orn. ofis) โ
โ โ โ
โ โโโโโ ๐ก Kutu 1 โโโโโโโโโโ 80% โ guclu, ayni oda โ
โ โโโโโ ๐ก Kutu 2 โโโโโโโโโโ 40% โ yan oda โ
โ โโโโโ ๐ก Kutu 3 โโโโโโโโโโ 15% โ duvarin ardindan โ
โ โโโโโ ๐ก Kutu 4 โโโโโโโโโโ 5% โ baska kat โ
โ โผ โ
โ Vektor {80, 40, 15, 5} โโโบ ODA: ofis โ
โ
โ โ
โ En guclu kutu = KAT Tam vektor = ODA โ
โ Hicbir kutu telefonu gormez = EVDE DEGIL โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- ๐ Oda-bazli konum: cok-kutulu sinyal vektoru + kalibre parmak izleri (tum kutular uzerinde ortalama sapma).
- ๐ช Kat tespiti: en guclu kutudan โ tek bir kutuyla bile calisir.
- ๐ช Var/yok: hicbir kutu telefonu gormuyorsa โ kisi evde degil.
- ๐ฅ Misafir tespiti: bilinmeyen cihazlar misafir olarak isaretlenir, sessizce atlanmaz.
- ๐๏ธ SQLite gecmisi ve 60 gunluk otomatik temizlik โ kim ne zaman hangi odadaydi.
- โฑ๏ธ Uyarlanabilir tarama: harekette hizli, dingin durumda tutumlu โ FritzBox'i korur.
- ๐ Home Assistant MQTT otomatik kesfi ile โ kisi basina bir sensor, elle ayar yok.
- ๐งฉ Yapilandirma-tabanli, 1 ila N kutu: tek kutuyla calisir, istedigin kadar olceklenir.
- ๐ธ 0 โฌ ekstra donanim. API anahtari yok. Bulut yok.
| Kutu | Ne elde edersin | Isabet |
|---|---|---|
| 1 kutu | Telefon hangi kutuda? โ kaba kat | ๐ก kat seviyesi |
| 2โ3 kutu | Ilk sinyal vektorleri โ oda (parmak iziyle) | ๐ข oda seviyesi |
| 4+ kutu | Yogun vektor โ saglam oda, oda icinde konum temeli | ๐ข๐ข oda seviyesi + |
Pratik kural: En guclu kutu = kat. Tam vektor = oda. Kutu yok = evde degil.
Durust olalim: ESP32 daha isabetli, profesyonel standarttir. FritzTrack4U sifir ekstra donanim istedigin zaman kazanir.
| Olcut | FritzTrack4U | ESP32 Bermuda / ESPresense |
|---|---|---|
| Donanim maliyeti | 0 โฌ (kutular hazir) | cip basina ~5 โฌ, oda basina bir tane |
| Evdeki ekstra cihaz | yok | cok (her odaya bir cip) |
| Isabet | kaba โ oda-bazli (vektorle) | oda-bazli, <10 sn |
| Olgunluk | kendin yap, burada belgeli | profesyonel standart |
| Kurulum | kutu basina 1 router kullanicisi | cipleri flashla + dagit |
| Ek guc tuketimi | 0 (kutular zaten calisir) | dusuk ama katlanmis |
| Ne zaman kazanir | hicbir sey almak istemiyorsan | maksimum isabet istiyorsan |
Sonuc: "ESP32'den iyi" degil โ bedava ve yeterince iyi, gelisime acik.
git clone https://github.com/Aslan4u73/FritzTrack4u.git
cd FritzTrack4u
# Sadece MQTT/Home Assistant kullaniyorsan gerekli (yoksa bagimliliksiz calisir):
pip install -r requirements.txt
# Sablondan kendi yapilandirmani olustur ve doldur:
cp config.example.json config.json
nano config.json
python3 fritztrack4u.py --config ./config.jsonCok-kutu icin zorunlu adim (asil puf nokta): her FritzBox'ta "FRITZ!Box ayarlari" yetkisine sahip ozel bir kullanici olustur. Ancak o zaman her kutu TR-064 uzerinden kendi sinyal gucunu verir. Sadece master'i sorgularsan tek deger alirsin โ ve vektor olmaz. Tam kilavuz: docs/INSTALL.de.md (Almanca).
// config.example.json (kesit โ tam sablon repo'da)
{
"boxes": [
{ "name": "Ofis", "ip": "192.168.178.1", "floor": "Zemin kat", "floor_nr": 0, "user": "tracker", "password": "SIFREN" },
{ "name": "Yatak", "ip": "192.168.178.2", "floor": "Ust kat", "floor_nr": 1, "user": "tracker", "password": "SIFREN" }
],
"devices": { "AA:BB:CC:DD:EE:FF": "Kisi1" },
"mqtt": { "enabled": true, "host": "192.168.178.50", "port": 1883, "user": "ha", "password": "..." },
"intervals": { "normal": 60, "movement": 15, "idle": 300, "live": 3 },
"retention_days": 60
} N x FritzBox (mesh) Sunucu (mini, sadece LAN) Home Assistant
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Kutu A (master)โ TR-064 / 49000 โ fritztrack4u.py โ MQTT โ kisi basina โ
โ Kutu B โโโโโโโโโโโโโโโโโโบโ - kutu basina giris (SID)โโโโโโโโบโ sensor โ
โ Kutu C โ โ - kutu basina % sinyal โ 1883 โ var/yok โ
โ Kutu D โ โ - vektor + parmak izi โ โ + canli btn โ
โโโโโโโโโโโโโโโโ โ - SQLite 60 gun gecmis โ โ + (3D goruntu)โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
- Giris: AVM challenge-response (MD5, UTF-16LE uzerinden โ puf nokta), SID kutuyu yormamak icin ~900 sn tekrar kullanilir.
- Veri kaynagi: kutu basina TR-064
GetGenericAssociatedDeviceInfoโ telefon basinaSignalStrength(%). - Vektor: telefon basina her kutu degerini topla โ
[Kutu A%, Kutu B%, โฆ]. - Eslestirme:
best_room()vektoru kalibre oda parmak izleriyle karsilastirir (tum kutular uzerinde ortalama sapma). - Saglamlastirma: FritzBox asiri yukune karsi yeniden deneme + bekleme, koruma icin genis normal araliklar.
Bu README yolculugu durustce belgeler, cikmaz sokaklar dahil. Dahiyane bir numara yoktu โ inat vardi.
- Ilk uzlasi: "FritzBox ev ici takip yapamaz, bir kutu telefon basina yalnizca tek deger verir โ herkes ESP32 kullanir." Saglam gorunur. Eksikti.
- Mesh-yapismasi kesfi: telefon, kisi coktan gitse bile eski bir kutuya yapisir. "Hangi kutuda" โ "kisi nerede". Naif varsayimin yanlis oldugunun ilk kaniti.
- 3 turda ~12 API yolu: cok cikmaz โ
edit_device(1 deger),meshlist.lua(404),meshTopo(veri var ama rssi yok), homeNet/meshNet (dBm yok). Her yol gercekten denendi, "hissederek" elenmedi. - Uc kez "imkansiz" โ uc kez itiraz: yapay zeka uc kez kendinden emin "FritzBox ile uclulama olmaz" dedi. Murat her seferinde fizikle itiraz etti: komsu kutular telefonu duvarlardan zayifca duyar (FritzBox bunu mesh yonlendirme icin zaten kullanir). Her seferinde haklฤฑ cikti.
- ๐ฅ Atilim: sadece master'i degil โ her kutu icin ayri giris. O zaman TR-064
GetGenericAssociatedDeviceInfoher kutununSignalStrengthdegerini verir. Kanitlandi: ayni telefon iki kutu tarafindan ayni anda gorulur โ{Ofis %35, Sara %10}. Gercek bir 2-kutu grubu; aralarinda duvar oldugu icin ikinci kutuda daha zayif. - Var/yok hatasi bulundu & duzeltildi: cevrimdisi olan telefon eski odaya yapisiyordu โ artik: hicbir kutu gormezse = evde degil.
- iPhone bekleme tuzagi: iPhone'lar beklemede odadan cikmadan kisaca iliski listesinden kaybolur. Cozum: bir oda "terk edildi" sayilmadan once 2 dakikalik tampon.
Her seyi ceviren strateji degisimi: *"bir kutuyu sorgula"*dan *"cok-kutulu veri toplayici"*ya. Anlik goruntu, dinamik bir konum sistemine donustu. Murat her konuda haklฤฑydฤฑ.
Ders: uc kez "olmaz" demek, olmayacaginin kaniti degildir. En yakin dugumu degil, tum dugumleri sor.
| Surum | Ne eklendi |
|---|---|
| v1 | Tek kutu, sadece kaba kat ("telefon hangi kutuda"). |
| v5 | Oda basina parmak izi kalibrasyonu โ 1 kutu + dBm, ilk oda isabeti. |
| v6 | Cok-kutulu veri toplayici: tum kutular TR-064 ile tek tek, var/yok kontrolu (cevrimdisi = yok), SQLite gecmisi, uyarlanabilir tarama. |
| v6.1 | Misafir tespiti + 60 gun otomatik temizlik. |
| FritzTrack4U (public) | Yapilandirma-tabanli 1โN kutu, anonimlestirilmis, tum kutular uzerinde tam vektor eslestirmesi. |
MIT โ frei nutzbar, frei aenderbar, ohne jede Gewaehr und ohne Haftung (siehe Haftungsausschluss oben). / Free to use and modify, no warranty, no liability. / Ozgurce kullan ve degistir, garanti ve sorumluluk yok.
Gebaut von Murat Danis (aslan4u.de) โ AI-Engineer & E-Commerce-Entwickler.
Ehrlich gesagt: Die Idee und das Durchhalten (nicht aufgeben) kamen von mir โ gebaut habe ich es aber gemeinsam mit meiner KI-Assistentin LISA. Allein haette ich das so nicht geschafft. Das ist Mensch + KI als Team, und ich finde, das darf man auch so sagen. ๐ค
Honestly: the idea and the persistence are mine โ but I built this together with my AI assistant LISA. I couldn't have done it alone. Human + AI as a team, and I'm happy to say so.
๐ Weitere Projekte / More projects: aslan4u.de
โ๏ธ DE โ FRITZ! und FRITZ!Box sind eingetragene Marken der FRITZ! GmbH (vormals AVM GmbH). Dieses Projekt ist ein unabhaengiges, von der Community entwickeltes Werkzeug und steht in keiner Verbindung zu FRITZ!/AVM. Produktnamen werden ausschliesslich zu Identifikationszwecken genannt, um die Kompatibilitaet zu beschreiben.
EN โ FRITZ! and FRITZ!Box are registered trademarks of FRITZ! GmbH (formerly AVM GmbH). This project is an independent, community-developed tool, neither affiliated with, authorized, sponsored nor endorsed by FRITZ!/AVM. Product names are used for identification purposes only to describe compatibility.
Gebaut aus Sturheit, FritzBoxen und einem Mini-Server ohne WLAN-Karte. Built from stubbornness, FritzBoxes, and a mini-server with no Wi-Fi card. Inattan, FritzBox'lardan ve WLAN karti olmayan bir mini sunucudan dogdu.
โญ Wenn dich das hier ueberzeugt hat โ gib einen Stern. / If this convinced you โ drop a star. / Ikna olduysan โ bir yildiz birak.
๐ Keywords / Schlagwoerter / Anahtar kelimeler
#IndoorGPS ยท #IndoorPositioning ยท #IndoorPersonTracking ยท #IndoorLocalization ยท #WiFiPositioning ยท #WiFiSensing ยท #WiFiTracking ยท #WiFiFingerprinting ยท #RSSI ยท #PresenceDetection ยท #RoomPresence ยท #OccupancySensing ยท #DeviceFree ยท #Trilateration ยท #HomeAssistant ยท #SmartHome ยท #SmartHomeDE ยท #Hausautomatisierung ยท #HomeAutomation ยท #IoT ยท #FritzBox ยท #AVM ยท #TR064 ยท #NoESP32 ยท #ESPresenseAlternative ยท #PrivacyFirst ยท #OpenSource
FritzBox Anwesenheitserkennung ยท Home Assistant Anwesenheitserkennung ยท Raumerkennung Home Assistant ยท Praesenzerkennung Smart Home ยท WLAN Personen erkennen ยท Anwesenheitserkennung ohne ESP32 ยท wer ist zuhause Smart Home ยท Etage erkennen Smart Home ยท Gaeste erkennen WLAN ยท indoor ortung WLAN open source ยท raumgenaue Ortung per WLAN ยท router-based presence detection ยท WiFi RSSI room-level presence ยท device-free indoor localization ยท multi-floor indoor positioning ยท self-hosted indoor positioning ยท ESPresense alternative without ESP32 ยท FRITZ!Box Home Assistant device tracker