def index(client_id): detail = get_client_detail(client_id) form = CodeForm() product_id = str(detail['data']['configuration'][1]['value']) product_secret = str(detail['data']['configuration'][2]['value']) if request.method == "POST": generate_token_file(form.code.data, product_id, product_secret, access_token_cache_file) try: return render_template( 'plugin_nestdevice.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', get_token_url=get_token_link(product_id, product_secret, access_token_cache_file), form=form, device_list=get_device_list(product_id, product_secret, access_token_cache_file), devices=get_device(product_id, product_secret, access_token_cache_file), errorlog=get_info_from_log(geterrorlogcmd)) except TemplateNotFound: abort(404)
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 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): detail = get_client_detail(client_id) form = CodeForm() withing_client_id = str(detail['data']['configuration'][1]['value']) withing_client_secret = str(detail['data']['configuration'][2]['value']) if request.method == "POST": generate_token_file(form.verifier.data) with open(withing_temp_file, 'r') as withing_auth_file: auth = pickle.load(withing_auth_file) else : try: auth = get_auth(withing_client_id, withing_client_secret) except: flash(gettext(u"Plugin not configured."), "error") abort(404) try: return render_template('plugin_withingdevice.html', clientid = client_id, client_detail = detail, mactive = "clients", active = 'advanced', get_token_url= get_authorize_url(auth), form = form, # car_id = get_car_list(withing_client_id,withing_client_secret), # current_token = show_current_token(), errorlog = get_info_from_log(geterrorlogcmd)) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) try: return render_template('plugin_callerid.html', clientid = client_id, client_detail = detail, mactive="clients", active = 'advanced') except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) try: return render_template('client_nothing_adm.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced') except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) try: return render_template('plugin_mysensors.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', errorlog=get_errorlog(geterrorlogcmd, logfile)) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) try: return render_template('plugin_onewired.html', clientid = client_id, client_detail = detail, mactive="clients", active = 'advanced', informations = get_informations()) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) try: return render_template('plugin_bluez.html', clientid = client_id, client_detail = detail, mactive="clients", active = 'advanced', bt = list_bt_devices()) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) try: return render_template( 'plugin_hue.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', hue=list_lights(detail['data']['configuration'][1]['value'])) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) device = str(detail['data']['configuration'][1]['value']) try: return render_template('plugin_onewired.html', clientid = client_id, client_detail = detail, mactive="clients", active = 'advanced', informations = get_informations(device), errorlog = get_errorlog(geterrorlogcmd)) except TemplateNotFound: abort(404)
def log(client_id): detail = get_client_detail(client_id) with open(logfile, 'r') as contentLogFile: content_log = contentLogFile.read() try: return render_template('plugin_vigilightning_log.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', logfile=logfile, contentLog=content_log) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) ebusd_device = str(detail['data']['configuration'][1]['value']) information = '' try: return render_template('plugin_ebusd.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', sensor_list=list_sensors(ebusd_device), errorlog=get_info_from_log(geterrorlogcmd), information=information) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) # vigiallergen plugin configuration devices = get_client_devices(client_id) # vigiallergen plugin devices list #print("Admin vigiallergen devices\n %s" % format(devices)) print("Departements list: %s" % format(get_informations(devices))) try: return render_template('plugin_vigiallergen.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', departementslist=get_informations(devices), logfile=logfile, errorlog=get_errorlog(geterrorlogcmd, logfile)) except TemplateNotFound: abort(404)
def graph(client_id, sensor_id, device, stype): flash(gettext(u"Loading data"), "info") clientid = client_id detail = get_client_detail(client_id) if sensor_id == '0': flash(gettext(u"No data to graph"), "error") abort(404) tsfrom = int(datetime.now().strftime("%s")) - 2678400 # now - 32d datahistory = [] cli = MQSyncReq(zmq.Context()) msg = MQMessage() msg.set_action('sensor_history.get') msg.add_data('sensor_id', sensor_id) msg.add_data('mode', 'period') msg.add_data('from', tsfrom) sensor_history = cli.request('admin', msg.get(), timeout=15).get() if 'sensor_history.result' in sensor_history: historyvalues = json.loads(sensor_history[1]) if historyvalues["status"]: for value in historyvalues["values"]: datahistory.append([value["timestamp"] * 1000, value["value_num"]]) try: stypeunit = datatypeslist["DT_" + stype]['unit'] except KeyError: stypeunit = "" try: return render_template('plugin_mqtt_graph.html', clientid = client_id, client_detail = detail, mactive = "clients", active = 'advanced', device = device, stype = stype, unit = stypeunit, data = datahistory) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) # vigilightning plugin configuration devices = get_client_devices( client_id) # vigilightning plugin devices list deviceInfos = get_informations(devices) print("Locations list: %s" % format(deviceInfos)) try: return render_template('plugin_vigilightning.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', locationsList=deviceInfos, logfile=logfile, errorlog=get_errorlog(geterrorlogcmd, logfile)) except TemplateNotFound: abort(404)
def contacts(client_id): detail = get_client_detail(client_id) form = ContactsForm() if request.method == "POST": save_contacts(form.contacts.data) else: form.contacts.data = read_contacts() try: return render_template('plugin_callerid_contacts.html', clientid = client_id, client_detail = detail, mactive="clients", active = 'advanced', contacts = read_contacts(), form = form) except TemplateNotFound: abort(404)
def blacklist(client_id): detail = get_client_detail(client_id) form = BlacklistForm() if request.method == "POST": save_blacklist(form.blacklist.data) else: form.blacklist.data = read_blacklist() try: return render_template('plugin_callerid_blacklist.html', clientid = client_id, client_detail = detail, mactive="clients", active = 'advanced', blacklist = read_blacklist(), form = form) except TemplateNotFound: abort(404)
def log(client_id): clientid = client_id detail = get_client_detail(client_id) with open(logfile, 'r') as contentLogFile: content_log = contentLogFile.read() if not content_log: content_log = "Empty log file" if isinstance(content_log, str): content_log = unicode(content_log, 'utf-8') try: return render_template('plugin_mqtt_log.html', clientid = client_id, client_detail = detail, mactive = "clients", active = 'advanced', logfile = logfile, contentLog = content_log) except TemplateNotFound: abort(404)
def index(client_id): detail = get_client_detail(client_id) # mqtt plugin configuration devices = get_client_devices(client_id) # mqtt plugin devices list #print("\n\nget_client_devices = \n%s\n\n" % format(devices)) try: return render_template('plugin_mqtt.html', clientid = client_id, client_detail = detail, mactive = "clients", active = 'advanced', datatypes = datatypeslist, rest_url = request.url_root + "rest", sensorslist = get_sensors(devices), commandslist = get_commands(devices), logfile = logfile, errorlog = get_errorlog(logfile)) except TemplateNotFound: abort(404)
def index(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 manager = get_manager_status(abort) # if rfP_List['error'] == 'Plugin timeout response.': abort = True print(u"Acces page...") try: #return render_template('{0}.html'.format(page)) return render_template('plugin_rfplayer.html', clientid=client_id, client_detail=detail, mactive="clients", active='advanced', dongle_active='', donglemenu_active="general", manager=manager) 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)
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)
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)