Fix Hardware list (#1490)

This commit is contained in:
Pascal Vizeli 2020-02-07 18:30:39 +01:00 committed by GitHub
parent a65d3222b9
commit fcdd66dc6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View File

@ -54,10 +54,16 @@ class Hardware:
# Exctract all devices
for device in self.context.list_devices():
# Skip devices without mapping
if not device.device_node:
continue
dev_list.append(
Device(device.sys_name),
Path(device.device_node),
[Path(node) for node in device.device_links],
Device(
device.sys_name,
Path(device.device_node),
[Path(node) for node in device.device_links],
)
)
return dev_list

View File

@ -0,0 +1,10 @@
"""Test hardware utils."""
from hassio.misc.hardware import Hardware
def test_read_all_devices():
"""Test to read all devices."""
system = Hardware()
assert system.devices