puttyman / hass-amplifi

A home assistant integration for Ubiquiti Amplifi
27 stars 16 forks source link

Update device_tracker.py #39

Closed hawksj closed 8 months ago

hawksj commented 8 months ago

Tiny edit to standardise the naming convention of entity IDs for devices that do not provide a description, hostname, or IP address and default to MAC address.

Noticed this when we had guests over that connected iPhones with MAC address randomisation to our Guest WiFi SSID.

See here: image

I've not tested this as my iPhone's IP address is available to the integration so doesn't default to the MAC address like above.

On account of not being able to test it, it is entirely possible I've got the wrong block of code. Please verify before merging.

This may be an intentional feature, in which case just close this PR.

hawksj commented 8 months ago

IMG_9408

can confirm that this addition names entities correctly (the the amplifi prefix). I’m on mobile this evening so the screenshot above is from the app.

I was able to test this because the error I briefly mentioned in another thread occurred when meant the integration instance had to be deleted and reinitialised. I will create an issue for this as I’m struggling to work through the code and figure out where it’s going wrong.

hawksj commented 8 months ago

As an interesting note, the top two devices starting with F0:9F:C2 ARE actually the two mesh points. I have now renamed the entity name (not ID to avoid upsetting the integration) but I wonder whether, based on this, it would be possible to automatically identify the mesh points as such. I do want to dig around in the info files from the router to see what’s in there and if we can improve the information that is pulled from it, I’ve just not had the time yet.

I have no idea what the FE:9F:C2 device is yet, it doesn’t match the MAC of any of the interfaces in the Amplifi app, but it’s close enough that I suspect it is related. Maybe the raw info file will tell me…

atudor2 commented 8 months ago

Hi @hawksj lgtm 👍 checked in my dev container and no issues picked up

hawksj commented 8 months ago

Thanks again for checking this one @atudor2. Will merge the changes.