diff --git a/mudpi.py b/mudpi.py old mode 100644 new mode 100755 index 8923dde..77e6efd --- a/mudpi.py +++ b/mudpi.py @@ -5,6 +5,7 @@ import time import json import sys +import traceback sys.path.append('..') from action import Action from config_load import loadConfigJson @@ -63,7 +64,7 @@ print('_________________________________________________') print('') print('Eric Davisson @theDavisson') -print('Version: ', CONFIGS.get('version', '0.8.6')) +print('Version: ', CONFIGS.get('version', '0.8.7')) print('\033[0;0m') if CONFIGS['debug'] is True: @@ -135,6 +136,7 @@ threads.append(pw) except KeyError: print('No Pi Workers Found to Load or Invalid Type') + traceback.print_exc() # Worker for relays attached to pi @@ -157,6 +159,7 @@ threads.append(r) except KeyError: print('No Relays Found to Load') + traceback.print_exc() # Worker for nodes attached to pi via serial or wifi[esp8266] # Supported nodes: arduinos, esp8266, ADC-MCP3xxx, probably others @@ -178,8 +181,9 @@ t = t.run() if t is not None: threads.append(t) - except KeyError: + except KeyError as e: print('Invalid or no Nodes found to Load') + traceback.print_exc() # Load in Actions @@ -190,6 +194,7 @@ actions[a.key] = a except KeyError: print('No Actions Found to Load') + traceback.print_exc() # Worker for Triggers try: @@ -199,6 +204,7 @@ threads.append(t) except KeyError: print('No Triggers Found to Load') + traceback.print_exc() #Decided not to build server worker (this is replaced with nodejs, expressjs) @@ -254,4 +260,4 @@ def server_worker(): print("MudPi Shutting Down...\t\t\t\033[1;32m Complete\033[0;0m") print("Mudpi is Now...\t\t\t\t\033[1;31m Offline\033[0;0m") - \ No newline at end of file + diff --git a/sensors/MCP3xxx/sensor.py b/sensors/MCP3xxx/sensor.py index 68258c0..e5eee87 100644 --- a/sensors/MCP3xxx/sensor.py +++ b/sensors/MCP3xxx/sensor.py @@ -5,14 +5,14 @@ class Sensor: PINS = { - '0': MCP.P0, - '1': MCP.P1, - '2': MCP.P2, - '3': MCP.P3, - '4': MCP.P4, - '5': MCP.P5, - '6': MCP.P6, - '7': MCP.P7, + 0: MCP.P0, + 1: MCP.P1, + 2: MCP.P2, + 3: MCP.P3, + 4: MCP.P4, + 5: MCP.P5, + 6: MCP.P6, + 7: MCP.P7, } def __init__(self, pin: int, mcp, name='Sensor', key=None):