<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Reflection use for datasource host]]></title><description><![CDATA[<p dir="auto">Hy, I've several modbus datasources each one with the target host ip</p>
<p dir="auto"><img src="https://camo.nodebb.org/578f1bd5ddcc9093ca1aa54c3bd1ad6f70382e77?url=https%3A%2F%2Fi.imgur.com%2FtNYmfpg.png" alt="0_1558694934866_35dd0bc7-46bc-4a4f-94e7-5849419d5597-immagine.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">it is possible to assign this IP to a virtual datapoint like this:<br />
<img src="https://camo.nodebb.org/99a7eca75a4ab5812865d11d06190535df577c5f?url=https%3A%2F%2Fi.imgur.com%2F4ffhM5P.png" alt="0_1558695249968_042b273d-4a26-44b0-aa9a-3db3eba22877-immagine.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">and use it to select the host in the modbus datasource definition?</p>
<p dir="auto"><img src="https://camo.nodebb.org/956ba47a5f5e23ebc15b880d4bad6855d6d40c54?url=https%3A%2F%2Fi.imgur.com%2FzzuQbp9.png" alt="0_1558701416036_4da1174f-1109-4320-9ce6-e1c0c1da21c7-immagine.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">instead seems to be possible to use it directly in a scripting data source?</p>
<pre><code>    var response = com.serotonin.m2m2.rt.maint.work.ProcessWorkItem.executeProcessCommand("/home/solergy/./tracker_upgrade_IP.sh S07E-MCU-3AX.bin upload " + STM32_IP.value , 300);
</code></pre>
<p dir="auto">and also,<br />
there's a way to know the MANGO path inside a script?</p>
<p dir="auto">Thanks,<br />
Antonio</p>
]]></description><link>https://forum.mango-os.com/topic/4228/reflection-use-for-datasource-host</link><generator>RSS for Node</generator><lastBuildDate>Mon, 15 Jun 2026 08:47:00 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/4228.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 24 May 2019 10:46:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Reflection use for datasource host on Wed, 29 May 2019 12:55:20 GMT]]></title><description><![CDATA[<p dir="auto">No, it's a reference to the variable in Java directly.</p>
]]></description><link>https://forum.mango-os.com/post/22264</link><guid isPermaLink="true">https://forum.mango-os.com/post/22264</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 29 May 2019 12:55:20 GMT</pubDate></item><item><title><![CDATA[Reply to Reflection use for datasource host on Wed, 29 May 2019 12:35:16 GMT]]></title><description><![CDATA[<p dir="auto">Thanks,<br />
MA_HOME is defined but not the value of MA_HOME,</p>
<p dir="auto"><img src="https://camo.nodebb.org/d7e78641c5d46bb9c93e92e3e410bc5233618c8a?url=https%3A%2F%2Fi.imgur.com%2FUoupYBE.png" alt="0_1559133855652_0af6bfaa-360e-4c40-a505-04857b6310b8-immagine.png" class=" img-fluid img-markdown" /><br />
<strong>path: undefined</strong></p>
<p dir="auto">I follow this during installation:<br />
<a href="https://help.infiniteautomation.com/linux-installation" rel="nofollow ugc">https://help.infiniteautomation.com/linux-installation</a><br />
and it is not mentioned</p>
<p dir="auto">MA_HOME is a simple environment variable?</p>
<p dir="auto">Thanks,<br />
Antonio</p>
]]></description><link>https://forum.mango-os.com/post/22261</link><guid isPermaLink="true">https://forum.mango-os.com/post/22261</guid><dc:creator><![CDATA[etantonio]]></dc:creator><pubDate>Wed, 29 May 2019 12:35:16 GMT</pubDate></item><item><title><![CDATA[Reply to Reflection use for datasource host on Tue, 28 May 2019 12:59:27 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Concerning instead MA_HOME seems to be undefined,</p>
</blockquote>
<p dir="auto"><a href="https://github.com/infiniteautomation/ma-core-public/blob/2.8.x/Core/src/com/serotonin/m2m2/Common.java#L87" rel="nofollow ugc">https://github.com/infiniteautomation/ma-core-public/blob/2.8.x/Core/src/com/serotonin/m2m2/Common.java#L87</a></p>
<p dir="auto">Best to include that you're using 2.8 in every first post or I'll assume you've apprehended the value added and upgraded.</p>
]]></description><link>https://forum.mango-os.com/post/22250</link><guid isPermaLink="true">https://forum.mango-os.com/post/22250</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Tue, 28 May 2019 12:59:27 GMT</pubDate></item><item><title><![CDATA[Reply to Reflection use for datasource host on Mon, 27 May 2019 10:05:45 GMT]]></title><description><![CDATA[<p dir="auto">Thanks,<br />
JsonEmport seems to be not available in mango 2.8.8<br />
<img src="https://camo.nodebb.org/9997af1f13ffd6eb2ab3ba3bc7b5f20257fde262?url=https%3A%2F%2Fi.imgur.com%2F0PmqJrE.png" alt="0_1558952168134_3c092431-87ce-4570-99b6-4013e76efce4-immagine.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">but it is not a problem because instead is available the following:</p>
<pre><code>var hostIP = (com.serotonin.m2m2.db.dao.DataSourceDao.instance.getByXid("FML01-main")).host
</code></pre>
<p dir="auto">Concerning instead MA_HOME seems to be undefined,</p>
<p dir="auto">In your documentation is stated somewhere that it is necessary to create this environment variable?<br />
Actually is not defined in my system but it seems it is not a problem, everything else seems ok.<br />
Thanks</p>
]]></description><link>https://forum.mango-os.com/post/22243</link><guid isPermaLink="true">https://forum.mango-os.com/post/22243</guid><dc:creator><![CDATA[etantonio]]></dc:creator><pubDate>Mon, 27 May 2019 10:05:45 GMT</pubDate></item><item><title><![CDATA[Reply to Reflection use for datasource host on Fri, 24 May 2019 16:36:46 GMT]]></title><description><![CDATA[<p dir="auto">Hi Antonio,</p>
<p dir="auto">You can modify the configuration of a Mango instance on the fly from scripts using the JsonEmport script utility, which can allow you to work with JSON as you would via the Configuration Import/Export page.</p>
<p dir="auto">See this help page <a href="https://help.infiniteautomation.com/about-mango-java-script" rel="nofollow ugc">https://help.infiniteautomation.com/about-mango-java-script</a><br />
And here's an example from the forum changing theu pdate period of a data source: <a href="https://forum.infiniteautomation.com/topic/3288/alter-data-source-update-time-via-event-handler" rel="nofollow ugc">https://forum.infiniteautomation.com/topic/3288/alter-data-source-update-time-via-event-handler</a></p>
<p dir="auto">You could adapt that to use the virtual point's .value to update the host of the Modbus IP data source in question. Would that work for what you're asking?</p>
<blockquote>
<p dir="auto">there's a way to know the MANGO path inside a script?</p>
</blockquote>
<p dir="auto">You mean the directory that it is installed to? Yes,</p>
<pre><code>var pathToMango = com.serotonin.m2m2.Common.MA_HOME_PATH; //java.nio.file.Path, get a string via .toString()
</code></pre>
]]></description><link>https://forum.mango-os.com/post/22235</link><guid isPermaLink="true">https://forum.mango-os.com/post/22235</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Fri, 24 May 2019 16:36:46 GMT</pubDate></item></channel></rss>