def network_nodes(client_id, network_id):
    detail = get_client_detail(client_id)
    abort = False
    if detail["status"] not in ["alive",  "starting"] : abort = True
    openzwaveInfo = get_openzwave_info(abort)
    if openzwaveInfo['error'] == 'Plugin timeout response.': abort = True
    managerState = get_manager_state(abort)
    if managerState['error'] == 'Plugin timeout response.': abort = True
    networkState = get_controller_state(network_id, abort)
    if networkState['error'] == 'Plugin timeout response.': abort = True
    nodesState = get_controller_nodes(network_id,  abort)
    try:
        return render_template('plugin_ozwave_nodes.html',
            clientid = client_id,
            client_detail = detail,
            mactive="clients",
            active = 'advanced',
            network_active = network_id,
            networkmenu_active = 'nodes',
            openzwaveInfo = openzwaveInfo,
            managerState = managerState,
            network_state = networkState,
            nodes_state = nodesState['nodes'])

    except TemplateNotFound:
        abort(404)
def index(client_id):
#    client_id = "plugin-ozwave.vmdomogik0"
    detail = get_client_detail(client_id)
    abort = False
    if detail["status"] not in ["alive",  "starting"] : abort = True
    openzwaveInfo = get_openzwave_info(abort)
    if openzwaveInfo['error'] == 'Plugin timeout response.': abort = True
    managerState = get_manager_state(abort)
    if managerState['error'] == 'Plugin timeout response.': abort = True
    try:
        #return render_template('{0}.html'.format(page))
        return render_template('plugin_ozwave.html',
            clientid = client_id,
            client_detail = detail,
            mactive="clients",
            active = 'advanced',
            network_active = '',
            networkmenu_active = 'controller',
            openzwaveInfo = openzwaveInfo,
            managerState = managerState,
            network_state = {})

    except TemplateNotFound:
        abort(404)
def plugin_tools(client_id):
    detail = get_client_detail(client_id)
    abort = False
    if detail["status"] not in ["alive",  "starting"] : abort = True
    openzwaveInfo = get_openzwave_info(abort)
    if openzwaveInfo['error'] == 'Plugin timeout response.': abort = True
    managerState = get_manager_state(abort)
    if managerState['error'] == 'Plugin timeout response.': abort = True
    allProducts = get_openzwave_all_products(abort)
    if allProducts['error'] == 'Plugin timeout response.': abort = True
    try:
        return render_template('plugin_ozwave_tools.html',
            clientid = client_id,
            client_detail = detail,
            mactive="clients",
            active = 'advanced',
            network_active = 'tools',
            networkmenu_active = '',
            openzwaveInfo = openzwaveInfo,
            managerState = managerState,
            ozw_products = allProducts)

    except TemplateNotFound:
        abort(404)