I have recently switched over to Unifi Presence Detection via integrations and has been working well so far. Prior to the move I was using Nmap and it notified me when a device was added to the network via tts and ios using the following app.
> class NewDeviceNotify(hass.Hass):
>
> def initialize(self):
> self.listen_event_handle_list = []
>
> self.listen_event_handle_list.append(self.listen_event(self.newdevice, "device_tracker_new_device"))
>
> def newdevice(self, event_name, data, kwargs):
> self.log("NEW DEVICE ADDED")
> self.log("DATA: {}".format(data))
> self.call_service(globals.notify_ios_grant, title = "Device Added to HA", message = "Device {} has been added to HA".format(data))
> self.call_service("notify/alexa_media", target = ["media_player.kitchen_alexa","media_player.study_alexa"], message = "A new device has been added to the network", data = {"type":"announce"})
> def terminate(self):
> for listen_event_handle in self.listen_event_handle_list:
> self.cancel_listen_event(listen_event_handle)
Under the new integration, no new devices are written to the know_devices.yaml anymore as part of Unifi. Instead they are written directly to the entity_registry. I assume this is why the app wont work anymore? Is there a way around this?