<?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[Custom Output to display]]></title><description><![CDATA[<p dir="auto">Guys, I need  to create a Custom Widget wich can work with a few inputs and variables I create!</p>
<p dir="auto">So... I already made the logic work, created the tags and etc.. but I'm stuck at the template part!</p>
<p dir="auto">How can I make the connection btw the script and the template and what the heck is script binding?</p>
<p dir="auto">Here is the code I came up with :</p>
<pre><code class="language-javascript">var myImports = new JavaImporter(java.io, java.lang, java.util); 
Amp1= mcApi.variable().get("Amp1");
Consumo1 = mcApi.variable().get("Consumo1");
var sensorVariable = mcApi.uidTag().getByUid("VoltRaw1");
var dispItems = [];
with(myImports)
 {
Consumo1 = Amp1.value * sensorVariable.sensorVariable.value;
}
</code></pre>
]]></description><link>http://forum.mycontroller.org/topic/165/custom-output-to-display</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 13:01:48 GMT</lastBuildDate><atom:link href="http://forum.mycontroller.org/topic/165.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 02 Jun 2017 04:57:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Custom Output to display on Thu, 15 Jun 2017 12:08:50 GMT]]></title><description><![CDATA[<p dir="auto">Thank you thank you!</p>
<p dir="auto">you are the best!</p>
]]></description><link>http://forum.mycontroller.org/post/980</link><guid isPermaLink="true">http://forum.mycontroller.org/post/980</guid><dc:creator><![CDATA[Darvos]]></dc:creator><pubDate>Thu, 15 Jun 2017 12:08:50 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Thu, 15 Jun 2017 10:47:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darvos" aria-label="Profile: Darvos">@<bdi>Darvos</bdi></a> By default, <code>Repository</code> and <code>SensorVariable</code> values will be stored as <code>String</code> You need to convert it to <code>Integer</code>, <code>Float</code> or as you like.</p>
<pre><code class="language-javascript">var myImports = new JavaImporter(java.io, java.lang, java.util); 
with(myImports) {
  var amp1 = mcApi.uidTag().getByUid("AmpRaw1").getResource()
  var volt = mcApi.uidTag().getByUid("VoltRaw1").getResource();
  var taxa = mcApi.variable().get("Taxa"); 
  var Custo_aux = mcApi.variable().get("CustoT"); 

  // custom value
  var finalData = (parseFloat(amp1.value) * parseFloat(volt.value))/ 1000;
  var currentCusto = finalData * parseFloat(taxa.value);
  Custo_aux.value = parseFloat(Custo_aux.value) + currentCusto; //SUM with previous values
  Custo_aux.save(); //store it on repository
}
</code></pre>
<p dir="auto"><strong>Note:</strong> Repository variables <code>Taxa</code>, <code>CustoT</code> should be created with default values. before to execute this script at first time.</p>
]]></description><link>http://forum.mycontroller.org/post/979</link><guid isPermaLink="true">http://forum.mycontroller.org/post/979</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Thu, 15 Jun 2017 10:47:02 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Thu, 15 Jun 2017 10:31:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a> Gosh,  so.. I was doing some research over the forum... and I found this <a href="http://forum.mycontroller.org/topic/139/hour-meter">http://forum.mycontroller.org/topic/139/hour-meter</a> wich I've been trying to use with no sucess...</p>
<p dir="auto">let me put some good info here!</p>
<p dir="auto"><img src="/uploads/files/1497462942410-image.png" alt="0_1497462933454_image.png" class=" img-fluid img-markdown" /><br />
I've made those simple custom  widgets, here is the script for them</p>
<pre><code class="language-javascript">var myImports = new JavaImporter(java.io, java.lang, java.util); 
var Custo = 0;
with(myImports) {
  var amp1 = mcApi.uidTag().getByUid("AmpRaw1").getResource()
  var volt = mcApi.uidTag().getByUid("VoltRaw1").getResource();
  var taxa = mcApi.variable().get("Taxa"); 
  var Custo_aux = mcApi.variable().get("CustoT"); 

  // custom value
  var finalData = (amp1.value * volt.value)/ 1000;
  Custo_aux.value = finalData * taxa.value;
}
</code></pre>
<p dir="auto">I just need a way to acumulate(a.k.a SUM) the values os the last line like Custo_aux.value += the rest...</p>
<p dir="auto">I've been trying to use the .save()  without success too..</p>
<p dir="auto">Plz master J, help me out!!</p>
]]></description><link>http://forum.mycontroller.org/post/978</link><guid isPermaLink="true">http://forum.mycontroller.org/post/978</guid><dc:creator><![CDATA[Darvos]]></dc:creator><pubDate>Thu, 15 Jun 2017 10:31:41 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Wed, 14 Jun 2017 16:26:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a>  J, my saivior!! the project is working just fine, i only have one question to make!! plz save me!!</p>
<p dir="auto">i've been trying to acumulate values (anyvar += anyvar) without sucess...</p>
<p dir="auto">I tried loops, timers, no sucess...</p>
<p dir="auto">I need to sum all the values I gather since the first reading.. any tip?</p>
]]></description><link>http://forum.mycontroller.org/post/977</link><guid isPermaLink="true">http://forum.mycontroller.org/post/977</guid><dc:creator><![CDATA[Darvos]]></dc:creator><pubDate>Wed, 14 Jun 2017 16:26:52 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Fri, 09 Jun 2017 09:19:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darvos" aria-label="Profile: Darvos">@<bdi>Darvos</bdi></a></p>
<h5>JavaScript</h5>
<pre><code class="language-javascript">var myImports = new JavaImporter(java.io, java.lang, java.util); 
with(myImports) {
  var amp1 = mcApi.variable().get("Amp1");
  var volt = mcApi.uidTag().getByUid("VoltRaw1").getResource();
  // custom value
  var finalData = amp1.value * volt.value;
}
</code></pre>
<h5>HTML template</h5>
<pre><code class="language-html">&lt;div&gt;My custom value: ${finalData}&lt;/div&gt;
&lt;div&gt;Raw values:[Amp1:${amp1.value}, volt:${volt.value}]&lt;/div&gt;
</code></pre>
<p dir="auto"><strong>Note:</strong> Use the latest version of MyController <a href="http://forum.mycontroller.org/topic/58/download-snapshot-build">from here</a></p>
]]></description><link>http://forum.mycontroller.org/post/975</link><guid isPermaLink="true">http://forum.mycontroller.org/post/975</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Fri, 09 Jun 2017 09:19:17 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Fri, 09 Jun 2017 09:09:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a> Thaaaats IIIITTT ^^</p>
<p dir="auto">Thank you thank you thanks aloooot jkandasa, you beatiful man!!</p>
<p dir="auto">I was expecting this for days, and I'm really excited with the outcome of this project</p>
]]></description><link>http://forum.mycontroller.org/post/974</link><guid isPermaLink="true">http://forum.mycontroller.org/post/974</guid><dc:creator><![CDATA[Darvos]]></dc:creator><pubDate>Fri, 09 Jun 2017 09:09:58 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Fri, 09 Jun 2017 09:06:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darvos" aria-label="Profile: Darvos">@<bdi>Darvos</bdi></a> You have to do all your calculations on your script and create an HTML template to display the value on the dashboard. Example: <a href="http://forum.mycontroller.org/topic/144/how-to-show-several-sensor-readings-in-a-single-widget/4">http://forum.mycontroller.org/topic/144/how-to-show-several-sensor-readings-in-a-single-widget/4</a></p>
]]></description><link>http://forum.mycontroller.org/post/973</link><guid isPermaLink="true">http://forum.mycontroller.org/post/973</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Fri, 09 Jun 2017 09:06:48 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Thu, 08 Jun 2017 22:16:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a> I forgot the reply you didn't I?</p>
<p dir="auto">Sorry, but I'm still hoping you can help me with this.</p>
<p dir="auto">Thank you very much</p>
]]></description><link>http://forum.mycontroller.org/post/971</link><guid isPermaLink="true">http://forum.mycontroller.org/post/971</guid><dc:creator><![CDATA[Darvos]]></dc:creator><pubDate>Thu, 08 Jun 2017 22:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Fri, 02 Jun 2017 18:32:57 GMT]]></title><description><![CDATA[<p dir="auto">In other words , how can I display a variable, not a input or a tag, just a variable</p>
]]></description><link>http://forum.mycontroller.org/post/968</link><guid isPermaLink="true">http://forum.mycontroller.org/post/968</guid><dc:creator><![CDATA[Darvos]]></dc:creator><pubDate>Fri, 02 Jun 2017 18:32:57 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Fri, 02 Jun 2017 11:44:18 GMT]]></title><description><![CDATA[<p dir="auto">Sure, I want to multiply an input by a variable , put the result in a variable and show it at my dashboard !</p>
<p dir="auto">Example : I'm reading a light sensor, I wanna have both the raw value and the valia of the light multiplied by certain number in my dash board!</p>
<p dir="auto">So I create a "sensor viewer " and a "custom viewer " right?</p>
<p dir="auto">Well, for the custom viewer I need a script to do the job for me... taking both utags and variables and doing a simple multiplication , then show me the valeu ... right?</p>
<p dir="auto">Well I need help finishing the script because, I can make the simple code but can't make it show the valeu at the "custom viewer " . I guess I'm missing both the template and the script binding</p>
]]></description><link>http://forum.mycontroller.org/post/967</link><guid isPermaLink="true">http://forum.mycontroller.org/post/967</guid><dc:creator><![CDATA[Darvos]]></dc:creator><pubDate>Fri, 02 Jun 2017 11:44:18 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Output to display on Fri, 02 Jun 2017 07:35:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darvos" aria-label="Profile: Darvos">@<bdi>Darvos</bdi></a> Script bindings are input to your script. You can read those input as a variable. Example: <code>{"threshold": 85.4, "variable_xyz": 44, "my_text": "hello"}</code></p>
<p dir="auto">I do not understand what you want to do? Could you please elaborate a bit more on this?</p>
]]></description><link>http://forum.mycontroller.org/post/966</link><guid isPermaLink="true">http://forum.mycontroller.org/post/966</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Fri, 02 Jun 2017 07:35:45 GMT</pubDate></item></channel></rss>