From 2da50e99542686d066d7fbf5fa789f3de95a4f79 Mon Sep 17 00:00:00 2001 From: Maximilian Leith Date: Sat, 11 Nov 2023 20:26:39 +0100 Subject: [PATCH] add mac address to device info --- docs/documentation/atvscript.md | 4 ++++ pyatv/scripts/atvscript.py | 1 + tests/scripts/test_atvscript.py | 2 ++ 3 files changed, 7 insertions(+) diff --git a/docs/documentation/atvscript.md b/docs/documentation/atvscript.md index 1ad0973ab..e7f4129ff 100644 --- a/docs/documentation/atvscript.md +++ b/docs/documentation/atvscript.md @@ -79,6 +79,7 @@ $ atvscript scan "xxx" ], "device_info": { + "mac": "AA:BB:CC:DD:EE:FF", "model": "Gen4K", "model_str": "Apple TV 4K", "operating_system": "TvOS", @@ -105,6 +106,7 @@ $ atvscript scan "xxx" ], "device_info": { + "mac": "AA:BB:CC:DD:EE:FF", "model": "Gen3", "model_str": "Apple TV 3", "operating_system": "Legacy", @@ -131,6 +133,7 @@ $ atvscript scan "xxx" ], "device_info": { + "mac": null, "model": "Unknown", "model_str": "Unknown", "operating_system": "Unknown", @@ -166,6 +169,7 @@ $ atvscript -s 10.0.10.81 scan "xxx" ], "device_info": { + "mac": "AA:BB:CC:DD:EE:FF", "model": "Gen4K", "model_str": "Apple TV 4K", "operating_system": "TvOS", diff --git a/pyatv/scripts/atvscript.py b/pyatv/scripts/atvscript.py index 6c399afd8..61db9bdd5 100644 --- a/pyatv/scripts/atvscript.py +++ b/pyatv/scripts/atvscript.py @@ -223,6 +223,7 @@ async def _scan_devices(loop, storage: Storage, hosts): "identifier": atv.identifier, "all_identifiers": atv.all_identifiers, "device_info": { + "mac": atv.device_info.mac, "model": atv.device_info.model.name, "model_str": atv.device_info.model_str, "operating_system": atv.device_info.operating_system.name, diff --git a/tests/scripts/test_atvscript.py b/tests/scripts/test_atvscript.py index e5f06fb9e..d083783c1 100644 --- a/tests/scripts/test_atvscript.py +++ b/tests/scripts/test_atvscript.py @@ -43,6 +43,7 @@ async def test_scan_devices(scriptenv, fake_atv): "identifier": DMAP_ID, "all_identifiers": [DMAP_ID], "device_info": { + "mac": None, "model": "Unknown", "model_str": "Unknown", "operating_system": "Legacy", @@ -56,6 +57,7 @@ async def test_scan_devices(scriptenv, fake_atv): "identifier": MRP_ID, "all_identifiers": [AIRPLAY_ID, MRP_ID], "device_info": { + "mac": AIRPLAY_ID, "model": "Unknown", "model_str": "pyatv", "operating_system": "TvOS",