diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a764a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +env diff --git a/README.md b/README.md index 4e6aaa5..9ac0de6 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/REMOTE_EXECUTION.md b/REMOTE_EXECUTION.md new file mode 100644 index 0000000..2734580 --- /dev/null +++ b/REMOTE_EXECUTION.md @@ -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) diff --git a/SR700_Artisan_Server/Start_SR700_Artisan_Server.py b/SR700_Artisan_Server/Start_SR700_Artisan_Server.py index f8fa701..9d01da2 100644 --- a/SR700_Artisan_Server/Start_SR700_Artisan_Server.py +++ b/SR700_Artisan_Server/Start_SR700_Artisan_Server.py @@ -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) @@ -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()