def turnSwitch(switch, on=False):
    from elro import RemoteSwitch
    devices = {'A': 1, 'B': 2, 'C': 4, 'D': 8, 'E': 16}
    device = devices.get(switch, 0)
    if (not device):
        return False
    device = RemoteSwitch(device, key=app.config['ELRO_KEY'], pin=app.config['ELRO_PIN'])
    if on:
        device.switchOn()
    else:
        device.switchOff()
    return True
def turnSwitch(switch, on=False):
    from elro import RemoteSwitch
    devices = {'A': 1, 'B': 2, 'C': 4, 'D': 8, 'E': 16}
    device = devices.get(switch, 0)
    if (not device):
        return False
    device = RemoteSwitch(device, key=app.config['ELRO_KEY'], pin=app.config['ELRO_PIN'])
    if on:
        device.switchOn()
    else:
        device.switchOff()
    return True