INNER CODE UNIT · Python
get_board_by_mac
xoseperez/espurna · code/ota.py:190
def get_board_by_mac(devices, mac):
"""
Returns the required data to flash a given board
"""
for device in devices:
if device.get("mac", "").lower() == mac:
board = {}
board["hostname"] = device.get("hostname")
board["board"] = device.get("device")
board["ip"] = device.get("ip")
board["size"] = get_device_size(device)
if not board["board"] or not board["ip"] or board["size"] == 0:
return None
return board
return None
def get_board_by_hostname(devices, hostname):