Closed pieter-1978 closed 1 year ago
Hey Pieter,
Leuk om nog een Nederlands(talig)e gebruiker te hebben! In het Engels ter behoeve van de rest:
Your config looks good, assuming that you're indeed not running UnifiOS (and that the extra comma in "accessPoint": "secret",,
for Woonkamer is just a typo).
To find out what's going wrong, we need to enable Debug Mode (Homebridge Config UI X > Homebridge Settings > Startup Options > Homebridge Debug Mode -D, then Restart). Then the logs should start showing additional things like this:
[10/11/2022, 8:05:17 PM] [UnifiOccupancy] Connecting with UniFi Controller...
[10/11/2022, 8:05:17 PM] [UnifiOccupancy] Getting access points from UniFi Controller...
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Found access point: 68:d7:9a:3e:91:a8 Living
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Found access point: e0:63:da:21:90:ad Office
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Found access point: 18:e8:29:41:9a:fe Bedroom
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Found access point: 68:d7:9a:46:49:d3 Rooftop
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Getting connected devices from UniFi Controller...
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Found connected device @ AP: Device {
mac: '1a:11:07:54:96:9e',
name: "Douwe's iPhone",
hostname: '',
deviceName: 'iPhone 12 Pro',
vendor: 320,
os: 24
} Living
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Registering new accessory: Douwe @ Rooftop
[10/11/2022, 8:05:18 PM] [UnifiOccupancy] Updated accessory status: Douwe @ Living connected
That's on my working installation, so it'd be interesting to see which of those message we are(n't) seeing on your side. If that doesn't help, I can add some additional debug statements to figure out exactly how far it's getting and where it's getting stuck.
@pieter-1978 Hey Pieter, did you have a chance to try my debugging suggestions above?
I have the same issue, here’s my debug log:
[05/01/2023, 02:02:38] [Unifi0ccupancy ] Getting connected devices from UniFi
Controller...
[05/01/2023, 02:03:38] [Unifi0ccupancy ] Getting connected devices from UniFi
Controller...
[05/01/2023, 02:04:32] [Unifi0ccupancy ] Device disconnected from UniFi Contr oller: User [MAC-address] disconn ected from
"Networkname"
(59m 26s con
nected, 5.30M bytes, last AP[MAC-address)
[05/01/2023,
02:04:38] [UnifiOccupancy
] Getting connected devices from UniFi
Controller...
[05/01/2023,
02:04:521 [Unifi0ccupancy
] Device connected to UniFi Controller : User[MAC-address] has connecte d to AP[MAC-address] with SSID "
Networkname" on "channel 36 (na)"
[05/01/2023, 02:04:52] [Unifi0ccupancy ] Getting connected devices from UniFi
@EasyBizz Thank you! What kind of phone are you trying this with? How does it show up in the UniFi Network UI? Is UniFi able to detect that it's a smartphone and the vendor?
I've seen this work successfully with iPhones, Samsung Galaxy's, Google Pixels, and Motorolas, but perhaps there are exceptions or other brands that just don't work.
Its an iPhone 14 Pro. The manufacturer and device type do not show in Unifi. Not for any phone. It does for some other devices (Nintendo Switch, Mac Mini) . Perhaps a Unifi setting? I wouldnt know where to look
@EasyBizz Interesting, my UDM has always detected phones automatically, and as far as I can tell there's no way to specifically enable/disable Device Fingerprinting (and the fact that it's detecting your Switch and Mac Mini suggests it's working in other cases).
Mine shows as follows, for what it's worth:
Where it shows "Report Missing Icon" for me, does it show you some option to manually specify the device type?
I could also make the phone-detection less strict and consider everything with "iPhone" in the (host)name a phone, even if the device type isn't detected by UniFi. I assume your phone does show up as "[Name]'s iPhone"?
My Unifi setup is AP’s only. Perhaps because I dont have a USG and the modem (not Unifi) does all DHCP etc. Bacause none of my devices have an image/icon
@EasyBizz Ah, that's possible. Are you running the UniFi Controller on a separate server then?
Where my screenshot above shows "Report Missing Icon", does it show you some option to manually specify the device type?
And I assume your phone does show up in UniFi as "[Name]'s iPhone" even though the device type is not detected? I could make the phone-detection less strict and consider everything with "iPhone" in the (host)name a phone.
I dont’t even have the option (in unifi ios app) to select icon. I’ve been searching the Unifi forums and I think the Dream Machine has a lot of options USG and CloudKey don’t have.
If you can have the plugin look out for a device name that would be perfect. But is it possible to let the user enter the value? So in Homebridge-UI we can enter our own value for what to look for in the device name. And if the field is empty the plugin will work as it does now.
@DouweM unfortunately I haven’t checked further at that time as I found another solution. Just fyi my setup is a rpi4 running the UniFi controller, a USG and a few UniFi switches and AP
@EasyBizz Ah, that's possible. Are you running the UniFi Controller on a separate server then?
Where my screenshot above shows "Report Missing Icon", does it show you some option to manually specify the device type?
And I assume your phone does show up in UniFi as "[Name]'s iPhone" even though the device type is not detected? I could make the phone-detection less strict and consider everything with "iPhone" in the (host)name a phone.
Hoi @DouweM ,
I'm running into the same issue I think (Unifi APs only - running Controller in Docker) :
iPhones also have this 'private WIFI address' feature where the MAC is changed. to check, I forgot my phone with this feature on - after reconnecting, the device is not detected at all , no manufacturer or model displayed.
With the private MAC feature off , manufacturer is detected , but not device type though.
However If I use the feature in Unifi to lookup the image of my device , after doing so, OS and Device type are added to the overview screen:
Manufacturer Apple, Inc. Model Apple iPhone 12 OS Apple iOS
(this happens in both cases - private mac on AND off)
Maybe you could make detection less strict like you said? or alternatively make it so that one can specify MAC addresses manually?
or alternatively make it so that one can specify MAC addresses manually?
that plugin already exists, and works great. The thing is; when you get a new phone you have to setup everything again. Or add every new device manualy.
@DouweM offers an automated creation of detected devices. I think that is the main feature of this plugin that separates it from the other Unifi-occupancy-sensors plugin.
I think it wiuld be awesome if this plugin has a specific phrase/word/term/code to look for in device names. So I can add the phrase to every client alias I would like in the Unifi app/controller. This could even be another device than a phone.
so lets say I start every client I want as a sensor with “9xyz9” the plugin automagically creates it in homebridge when it detects them. Douwe could filter the phrase out anyway, so this could always be a unique, random string you make up.
@DouweM volgens mij is alles NL hier, maar als dit lukt ben je een baas! Ik snap dat het een vrije-tijds-klusje is. Maar hoop er wel op, succes in ieder geval!
@EasyBizz @Raka74 @pieter-1978 I just pushed version 1.0.4 that should detect anything with "phone" in the (host)name! Can you give that a try? I can also look into making the words it looks for configurable, if there's still a reason for that after this.
@DouweM
Just installed it - and now phones are detected:
Very nice! Thanks for the update.
@Raka74 Great! If you change the device's name to "Winfried's iPhone 12" in the UniFi Network portal, it should start showing up as "Winfried @ KleineKamer".
@DouweM , I just checked today and it works! Thanks for the update!
@DouweM confirmed, works like a charm! I would love a user configured phrase though. To also add iPad or Apple Watch etc. Without having to name them “phone” in unifi.
But even without it the plugin works great! Good job!
@EasyBizz I've created a follow-up issue for your request: https://github.com/DouweM/homebridge-unifi-occupancy/issues/9
Hi, I installed the plugin and all seems OK but somehow it does not show any sensors. I use a RPI4 to run the Homebridge and the Unify Controller. for my access points I entered their MAC address.
can you please let me know if I do something wrong?
Many thanks!
below my config and log