Add Xiaomi miIO probe detector

Detect stock Xiaomi/Mijia devices via miIO hello packet on UDP:54321.
Response magic 0x2131 uniquely identifies miIO devices.

Detector priority: ONVIF > HomeKit > Xiaomi > standard.
This commit is contained in:
eduard256
2026-04-17 20:35:02 +00:00
parent b3e3e8ab1a
commit ccb100fcd0
3 changed files with 88 additions and 7 deletions
+16 -1
View File
@@ -51,6 +51,14 @@ func Init() {
return ""
})
// Xiaomi detector (miIO hello on UDP:54321)
detectors = append(detectors, func(r *probe.Response) string {
if r.Probes.Xiaomi != nil {
return "xiaomi"
}
return ""
})
api.HandleFunc("api/probe", apiProbe)
}
@@ -129,12 +137,19 @@ func runProbe(parent context.Context, ip string) *probe.Response {
resp.Probes.ONVIF = r
mu.Unlock()
})
run(func() {
r, _ := probe.ProbeXiaomi(fastCtx, ip)
mu.Lock()
resp.Probes.Xiaomi = r
mu.Unlock()
})
wg.Wait()
// determine reachable
resp.Reachable = (resp.Probes.Ports != nil && len(resp.Probes.Ports.Open) > 0) ||
resp.Probes.MDNS != nil
resp.Probes.MDNS != nil ||
resp.Probes.Xiaomi != nil
// determine type
resp.Type = "standard"