<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Set gateway and default path</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ed830e216d/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ed830e216d/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/ed830e216d/</id><updated>2020-02-27T14:44:06.788000Z</updated><subtitle>Recent posts to Set gateway and default path</subtitle><entry><title>Set gateway and default path</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ed830e216d/?limit=25#ec34" rel="alternate"/><published>2020-02-27T14:44:06.788000Z</published><updated>2020-02-27T14:44:06.788000Z</updated><author><name>chab</name><uri>https://forge.codesys.com/u/chab/</uri></author><id>https://forge.codesys.com635391f9841408006787b16456c09593bfae4959</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I used:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;controller&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;projects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;"CoDeSys_Control"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;pprint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pprint&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;deviceid&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_device_identification&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;devicegateway&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_gateway&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;deviceaddress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_address&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;pprint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pprint&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;devicegateway&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And that resulted in a 16 byte GUID.&lt;/p&gt;
&lt;p&gt;Next I'll try to set the controller communication setting...&lt;/p&gt;
&lt;p&gt;Also I detected that the Menu; Project; Export file contains the GatewayGuid. &lt;br/&gt;
Search for &amp;lt;single type="System.Guid" name="GatewayGuid"&amp;gt; in the *.export file.&amp;lt;/single&amp;gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Set gateway and default path</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ed830e216d/?limit=25#0bcf" rel="alternate"/><published>2020-02-27T14:44:06.141000Z</published><updated>2020-02-27T14:44:06.141000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comc9b81e0971a4dff98fba535fc9036052e76f0afa</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; M.Schaber&lt;/p&gt;
&lt;p&gt;Hi, Edwin,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Edwin hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Does CoDeSys provide the possibility to set the gateway (e.g. IP number) and scan the network for devices, by python script.&lt;br/&gt;
In the examples, I see no gateway IP number at all. While in the GUI, I have to select a gateway and set the active path. &lt;br/&gt;
e.g. &lt;br/&gt;
# set "Python.project" to active application&lt;br/&gt;
app = proj.active_application          &lt;br/&gt;
onlineapp = online.create_online_application(app)&lt;br/&gt;
# login to device&lt;br/&gt;
onlineapp.login(OnlineChangeOption.Try, True)          &lt;br/&gt;
The goal is to give a script two parameters (project name and gateway IP number). And that script would download the project to that device. (The project itself does not contain the gateway information.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For scripts, device Objects have the following methods:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;get_gateway&lt;/span&gt;&lt;span class="ss"&gt;()&lt;/span&gt; # &lt;span class="nv"&gt;Returns&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;Guid&lt;/span&gt; &lt;span class="nv"&gt;of&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;Gateway&lt;/span&gt;
&lt;span class="nv"&gt;get_address&lt;/span&gt;&lt;span class="ss"&gt;()&lt;/span&gt; # &lt;span class="nv"&gt;Returns&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;device&lt;/span&gt; &lt;span class="nv"&gt;address&lt;/span&gt; &lt;span class="nv"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;a&lt;/span&gt; &lt;span class="nv"&gt;string&lt;/span&gt;.
&lt;span class="nv"&gt;set_gateway_and_address&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;gateway&lt;/span&gt;, &lt;span class="nv"&gt;address&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; # &lt;span class="nv"&gt;Sets&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;gateway&lt;/span&gt; &lt;span class="nv"&gt;and&lt;/span&gt; &lt;span class="nv"&gt;address&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nv"&gt;this&lt;/span&gt; &lt;span class="nv"&gt;device&lt;/span&gt;. &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;gateway&lt;/span&gt; &lt;span class="nv"&gt;can&lt;/span&gt; &lt;span class="nv"&gt;be&lt;/span&gt; &lt;span class="nv"&gt;a&lt;/span&gt; &lt;span class="nv"&gt;Guid&lt;/span&gt; &lt;span class="nv"&gt;object&lt;/span&gt; &lt;span class="nv"&gt;or&lt;/span&gt; &lt;span class="nv"&gt;the&lt;/span&gt; &lt;span class="nv"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;representation&lt;/span&gt; &lt;span class="nv"&gt;of&lt;/span&gt; &lt;span class="nv"&gt;a&lt;/span&gt; &lt;span class="nv"&gt;Guid&lt;/span&gt;.&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So you can set the gateway and address CoDeSys uses to connect to a specific device, the "active path". The adress here is the CoDeSys address (like "&lt;span&gt;[011D.8001.9ED4]&lt;/span&gt;") and not an IP address, as it has to cover routing through several cascaded field busses.&lt;/p&gt;
&lt;p&gt;Sadly, the Guid is not yet displayed anywhere in the UI. The easiest way to get the Guid for a Gateway currently is to set the active path of a device to that gateway, and then dump it via "print projects.primary.find("name_of_device", True)&lt;span&gt;[0]&lt;/span&gt;.get_gateway()" in a script.&lt;/p&gt;
&lt;p&gt;It is not yet possible to configure the list of available Gateways itsself (like the "Add Gateway" button) from the script, however. If you need this functionality, please file it as a requirement via our support department.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Set gateway and default path</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ed830e216d/?limit=25#39df" rel="alternate"/><published>2020-02-27T14:44:05.501000Z</published><updated>2020-02-27T14:44:05.501000Z</updated><author><name>chab</name><uri>https://forge.codesys.com/u/chab/</uri></author><id>https://forge.codesys.com5315b357a35e598ff23fe25611a1c7a4b1ac270a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Does CoDeSys provide the possibility to set the gateway (e.g. IP number) and scan the network for devices, by python script.&lt;/p&gt;
&lt;p&gt;In the examples, I see no gateway IP number at all. While in the GUI, I have to select a gateway and set the active path. &lt;br/&gt;
e.g. &lt;br/&gt;
# set "Python.project" to active application&lt;br/&gt;
app = proj.active_application          &lt;br/&gt;
onlineapp = online.create_online_application(app)&lt;br/&gt;
# login to device&lt;br/&gt;
onlineapp.login(OnlineChangeOption.Try, True)            &lt;/p&gt;
&lt;p&gt;The goal is to give a script two parameters (project name and gateway IP number). And that script would download the project to that device. (The project itself does not contain the gateway information.)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>