From a9f796a97cec565357d2cb76d6bd779df340d842 Mon Sep 17 00:00:00 2001 From: kdvlr Date: Sun, 23 Dec 2018 06:35:39 -0600 Subject: [PATCH] Updated to support per device find iphone sound. (#19535) Added additional log statements to help debug --- homeassistant/components/device_tracker/icloud.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/device_tracker/icloud.py b/homeassistant/components/device_tracker/icloud.py index 8ea81e88440..9ac77cf7f01 100644 --- a/homeassistant/components/device_tracker/icloud.py +++ b/homeassistant/components/device_tracker/icloud.py @@ -200,7 +200,9 @@ class Icloud(DeviceScanner): self._intervals = {} for device in self.api.devices: status = device.status(DEVICESTATUSSET) + _LOGGER.debug('Device Status is %s', status) devicename = slugify(status['name'].replace(' ', '', 99)) + _LOGGER.info('Adding icloud device: %s', devicename) if devicename in self.devices: _LOGGER.error('Multiple devices with name: %s', devicename) continue @@ -404,6 +406,7 @@ class Icloud(DeviceScanner): continue status = device.status(DEVICESTATUSSET) + _LOGGER.debug('Device Status is %s', status) dev_id = status['name'].replace(' ', '', 99) dev_id = slugify(dev_id) attrs[ATTR_DEVICESTATUS] = DEVICESTATUSCODES.get( @@ -441,9 +444,9 @@ class Icloud(DeviceScanner): return self.api.authenticate() - for device in self.api.devices: - if devicename is None or device == self.devices[devicename]: + if str(device) == str(self.devices[devicename]): + _LOGGER.info("Playing Lost iPhone sound for %s", devicename) device.play_sound() def update_icloud(self, devicename=None):