From ca1c1f76052a7576c5e4f9b295290c5a2b13901b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Tue, 16 Jan 2018 22:40:37 +0100 Subject: [PATCH] Add MAC to mDNS text fields --- code/espurna/mdns.ino | 1 + code/ota.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/code/espurna/mdns.ino b/code/espurna/mdns.ino index efa13283..24f14c8f 100644 --- a/code/espurna/mdns.ino +++ b/code/espurna/mdns.ino @@ -50,6 +50,7 @@ void mdnsServerSetup() { // Public ESPurna related txt for OTA discovery MDNS.addServiceTxt("arduino", "tcp", "app_name", APP_NAME); MDNS.addServiceTxt("arduino", "tcp", "app_version", APP_VERSION); + MDNS.addServiceTxt("arduino", "tcp", "mac", WiFi.macAddress()); MDNS.addServiceTxt("arduino", "tcp", "target_board", getBoardName()); { char buffer[6] = {0}; diff --git a/code/ota.py b/code/ota.py index 699abc1d..ddc7aa26 100644 --- a/code/ota.py +++ b/code/ota.py @@ -44,6 +44,7 @@ def on_service_state_change(zeroconf, service_type, name, state_change): 'hostname': hostname.upper(), 'ip': socket.inet_ntoa(info.address) } + device['mac'] = info.properties.get('mac', '') device['app'] = info.properties.get('app_name', '') device['version'] = info.properties.get('app_version', '') device['device'] = info.properties.get('target_board', '') @@ -60,11 +61,12 @@ def list_devices(): """ Shows the list of discovered devices """ - output_format="{:>3} {:<25}{:<25}{:<15}{:<15}{:<30}{:<10}{:<10}{:<10}" + output_format="{:>3} {:<14} {:<15} {:<17} {:<12} {:<8} {:<25} {:<8} {:<8} {:<10}" print(output_format.format( "#", "HOSTNAME", "IP", + "MAC", "APP", "VERSION", "DEVICE", @@ -72,7 +74,7 @@ def list_devices(): "SDK_SIZE", "FREE_SPACE" )) - print("-" * 146) + print("-" * 139) index = 0 for device in devices: @@ -81,6 +83,7 @@ def list_devices(): index, device.get('hostname', ''), device.get('ip', ''), + device.get('mac', ''), device.get('app', ''), device.get('version', ''), device.get('device', ''),