def control_ac(action): try: acserver = ServerProxy('http://10.0.1.45:17002', allow_none=True) if action == 'on': acserver.on() if action == 'off': acserver.off() if action == 'auto': acserver.auto() if action == 'autooff': acserver.auto(0) except: pass return redirect(url_for('root_index'))