Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added public IP address binding to permit remote Artisan invocations #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
env
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,8 @@ The fan control is not supported in the Artisan designer so you need to add alar
Now you are ready to roast!

Hit Start, and keep in mind that the first 30sec are for preheating the machine.


# Remote Execution

It is now possible to run the Server on a different machine than Artisan itself; see REMOTE_EXECUTION.md for more details.
12 changes: 12 additions & 0 deletions REMOTE_EXECUTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Running SR700 Artisan Server remotely

As SR700 Server runs using Python's "Pyro" tooling, it is possible to communicate over TCP/IP with a remote server.
You can, for example, run this server on a small Raspberry Pi Zero W connected to your SR700, while running Artisan on a more powerful laptop.

In order to provide a remote connection for artisan, you must:

* launch `Start_SR700_Artisan_Server` with the `--network_mode public` flag
* have the SR700_Artisan_Server on the same network subnet as the machine running Artisan (as by default, the Pyro Proxy searches out a Nameserver with a broadcast that assumes it will find it on the same subnet)
* install the SR700_Artisan_Server code on the Artisan host as well as the Server host that is providing a connection

Note that the configuration you import into Artisan tells artisan to look on the Path for functions such as Get_Artisan_Temps, which is provided by this package. This is why it must be installed on both machines to work (and be visible/callable by Artisan)
14 changes: 12 additions & 2 deletions SR700_Artisan_Server/Start_SR700_Artisan_Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ def main():
parser.add_argument('--pid_mode', type=str, help='PID mode: internal,\
artisan, if not specified the internal PID is used,',
default='internal',choices=['internal','artisan'] )
parser.add_argument('--network_mode', type=str, help='Network mode: private,\
public, if not specified runs as "private" (external computers cannot interact with roaster),',
default='private',choices=['private','public'] )
parser.add_argument('--phidget_hub_port', type=int, default=0)
parser.add_argument('--phidget_hub_channel', type=int, default=0)
parser.add_argument('--kp', type=float, default=None)
Expand Down Expand Up @@ -285,13 +288,20 @@ def main():

logging.info('Starting Nameserver...')
with open(os.devnull, 'w') as fp:
nameserver_process=sb.Popen(['python', '-m','Pyro4.naming'],stdout=fp)
launch_options = ['python3', '-m','Pyro4.naming']
if args.network_mode == "public":
launch_options.append('--host=0.0.0.0')
nameserver_process=sb.Popen(launch_options,stdout=fp)

##Pyro4.naming.startNS()
time.sleep(1)

logging.info('Starting Server...')
daemon = Pyro4.Daemon() # make a Pyro daemon
if args.network_mode == "private":
daemon = Pyro4.Daemon() # make a Pyro daemon
elif args.network_mode == "public":
daemon = Pyro4.Daemon(Pyro4.socketutil.getIpAddress('127.0.0.1',True)) # make a Pyro daemon and bind to external IP

ns = Pyro4.locateNS()


Expand Down