diff --git a/mesh-bot.py b/mesh-bot.py index 9c0e85f..977822b 100755 --- a/mesh-bot.py +++ b/mesh-bot.py @@ -218,10 +218,8 @@ def get_node_list(): if node['num'] != myNodeNum: node_name = get_name_from_number(node['num']) - try: - last_heard = node['lastHeard'] - except Exception as e: - last_heard = 0 + # issue where lastHeard is not always present + last_heard = node.get('lastHeard', 0) item = (node_name,last_heard) node_list.append(item) diff --git a/pong-bot.py b/pong-bot.py index d734328..f744066 100755 --- a/pong-bot.py +++ b/pong-bot.py @@ -184,10 +184,8 @@ def get_node_list(): if node['num'] != myNodeNum: node_name = get_name_from_number(node['num']) - try: - last_heard = node['lastHeard'] - except Exception as e: - last_heard = 0 + # issue where lastHeard is not always present + last_heard = node.get('lastHeard', 0) item = (node_name,last_heard) node_list.append(item)