Add mac address to sky_hub tracker (#39506)

* Add mac address to Sky_Hub tracker

* Update manifest.json

* Update device_tracker.py

* Update device_tracker.py

* Update device_tracker.py

* Apply suggestions from code review

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
RogerSelwyn 2020-09-04 21:31:06 +01:00 committed by GitHub
parent 01bac9f433
commit 0d3396ed64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View File

@ -44,11 +44,25 @@ class SkyHubDeviceScanner(DeviceScanner):
async def async_scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
await self._async_update_info()
return list(self.last_results)
return [device.mac for device in self.last_results]
async def async_get_device_name(self, device):
"""Return the name of the given device."""
return self.last_results.get(device)
name = next(
(result.name for result in self.last_results if result.mac == device),
None,
)
return name
async def async_get_extra_attributes(self, device):
"""Get extra attributes of a device."""
device = next(
(result for result in self.last_results if result.mac == device), None
)
if device is None:
return {}
return device.asdict()
async def _async_update_info(self):
"""Ensure the information from the Sky Hub is up to date."""

View File

@ -2,6 +2,6 @@
"domain": "sky_hub",
"name": "Sky Hub",
"documentation": "https://www.home-assistant.io/integrations/sky_hub",
"requirements": ["pyskyqhub==0.1.1"],
"requirements": ["pyskyqhub==0.1.2"],
"codeowners": ["@rogerselwyn"]
}

View File

@ -1622,7 +1622,7 @@ pysher==1.0.1
pysignalclirestapi==0.3.4
# homeassistant.components.sky_hub
pyskyqhub==0.1.1
pyskyqhub==0.1.2
# homeassistant.components.sma
pysma==0.3.5