Browse Source

Add MAC to mDNS text fields

i18n
Xose Pérez 6 years ago
parent
commit
ca1c1f7605
2 changed files with 6 additions and 2 deletions
  1. +1
    -0
      code/espurna/mdns.ino
  2. +5
    -2
      code/ota.py

+ 1
- 0
code/espurna/mdns.ino View File

@ -50,6 +50,7 @@ void mdnsServerSetup() {
// Public ESPurna related txt for OTA discovery // Public ESPurna related txt for OTA discovery
MDNS.addServiceTxt("arduino", "tcp", "app_name", APP_NAME); MDNS.addServiceTxt("arduino", "tcp", "app_name", APP_NAME);
MDNS.addServiceTxt("arduino", "tcp", "app_version", APP_VERSION); MDNS.addServiceTxt("arduino", "tcp", "app_version", APP_VERSION);
MDNS.addServiceTxt("arduino", "tcp", "mac", WiFi.macAddress());
MDNS.addServiceTxt("arduino", "tcp", "target_board", getBoardName()); MDNS.addServiceTxt("arduino", "tcp", "target_board", getBoardName());
{ {
char buffer[6] = {0}; char buffer[6] = {0};


+ 5
- 2
code/ota.py View File

@ -44,6 +44,7 @@ def on_service_state_change(zeroconf, service_type, name, state_change):
'hostname': hostname.upper(), 'hostname': hostname.upper(),
'ip': socket.inet_ntoa(info.address) 'ip': socket.inet_ntoa(info.address)
} }
device['mac'] = info.properties.get('mac', '')
device['app'] = info.properties.get('app_name', '') device['app'] = info.properties.get('app_name', '')
device['version'] = info.properties.get('app_version', '') device['version'] = info.properties.get('app_version', '')
device['device'] = info.properties.get('target_board', '') device['device'] = info.properties.get('target_board', '')
@ -60,11 +61,12 @@ def list_devices():
""" """
Shows the list of discovered 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( print(output_format.format(
"#", "#",
"HOSTNAME", "HOSTNAME",
"IP", "IP",
"MAC",
"APP", "APP",
"VERSION", "VERSION",
"DEVICE", "DEVICE",
@ -72,7 +74,7 @@ def list_devices():
"SDK_SIZE", "SDK_SIZE",
"FREE_SPACE" "FREE_SPACE"
)) ))
print("-" * 146)
print("-" * 139)
index = 0 index = 0
for device in devices: for device in devices:
@ -81,6 +83,7 @@ def list_devices():
index, index,
device.get('hostname', ''), device.get('hostname', ''),
device.get('ip', ''), device.get('ip', ''),
device.get('mac', ''),
device.get('app', ''), device.get('app', ''),
device.get('version', ''), device.get('version', ''),
device.get('device', ''), device.get('device', ''),


Loading…
Cancel
Save