Ejemplo n.º 1
0
def reinstallDevices():
    deviceDB.remove({})
    from core import ffNest
    reinstall_indigo()
    with open(os.path.join(configPath, 'devices.json')) as devices:
        allDevices = json.load(devices)
        for name, device in allDevices.iteritems():
            if device.get('module') != "ffZwave":
                package_full_path = device.get('type') + 's.' + device.get(
                    'package') + '.' + device.get('module')
                package = __import__(package_full_path,
                                     globals={},
                                     locals={},
                                     fromlist=[device.get('package')],
                                     level=-1)
                reload(modules[package_full_path])
                dObj = package.Device(device.get('id'), device)
                d = {}
                d['id'] = device.get('id')
                d['ffObject'] = pickle.dumps(dObj)
                d['config'] = device
                d['status'] = {}
                try:
                    d['commands'] = dObj.commands
                except:
                    d['commands'] = []
                try:
                    d['type'] = dObj.type
                except:
                    d['type'] = 'UNKNOWN'
                deviceDB.insert(d)
Ejemplo n.º 2
0
def install_child_device(deviceID, ffObject, config={}, status={}):
  logging.debug("Installing Child Device")
  d = {}
  d['id'] = deviceID
  d['ffObject'] = pickle.dumps(ffObject)
  d['config'] = config
  d['status'] = status
  deviceDB.insert(d)
Ejemplo n.º 3
0
def test_install(request):
  deviceDB.remove({})
  with open('config/devices.json') as devices:
    allDevices = json.load(devices)
    for name, device in allDevices.iteritems():
      if device.get('module') != "ffZwave":
        package_full_path = device.get('type') + 's.' + device.get('package') + '.' + device.get('module')
        package = __import__(package_full_path, globals={}, locals={}, fromlist=[device.get('package')], level=-1)
        reload(modules[package_full_path])
        dObj = package.Device(device.get('id'), device)
        d = {}
        d['id'] = device.get('id')
        d['ffObject'] = pickle.dumps(dObj)
        d['config'] = device
        d['status'] = {}
        deviceDB.insert(d)
Ejemplo n.º 4
0
def install_child_device(deviceID, ffObject, config={}, status={}):
    logging.debug("Installing Child Device")
    d = {}
    d['id'] = deviceID
    d['ffObject'] = pickle.dumps(ffObject)
    d['config'] = config
    d['status'] = status
    try:
        d['commands'] = ffObject.commands
    except:
        d['commands'] = []
    try:
        d['type'] = ffObject.type
    except:
        d['type'] = "UNKNOWN"
    deviceDB.insert(d)
Ejemplo n.º 5
0
def reinstallDevices():
    deviceDB.remove({})
    with open("config/devices.json") as devices:
        allDevices = json.load(devices)
        for name, device in allDevices.iteritems():
            if device.get("module") != "ffZwave":
                package_full_path = device.get("type") + "s." + device.get("package") + "." + device.get("module")
                package = __import__(
                    package_full_path, globals={}, locals={}, fromlist=[device.get("package")], level=-1
                )
                reload(modules[package_full_path])
                dObj = package.Device(device.get("id"), device)
                d = {}
                d["id"] = device.get("id")
                d["ffObject"] = pickle.dumps(dObj)
                d["config"] = device
                d["status"] = {}
                deviceDB.insert(d)
Ejemplo n.º 6
0
def test_install(request):
    deviceDB.remove({})
    with open('config/devices.json') as devices:
        allDevices = json.load(devices)
        for name, device in allDevices.iteritems():
            if device.get('module') != "ffZwave":
                package_full_path = device.get('type') + 's.' + device.get(
                    'package') + '.' + device.get('module')
                package = __import__(package_full_path,
                                     globals={},
                                     locals={},
                                     fromlist=[device.get('package')],
                                     level=-1)
                reload(modules[package_full_path])
                dObj = package.Device(device.get('id'), device)
                d = {}
                d['id'] = device.get('id')
                d['ffObject'] = pickle.dumps(dObj)
                d['config'] = device
                d['status'] = {}
                deviceDB.insert(d)