<?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[Battery level in rules or chart? [Script Rule to check battery level]]]></title><description><![CDATA[<p dir="auto">Hello, how can I work with an item Battery level? How do I keep track of battery usage nodes? It's going to add to the rules? It could based on the condition of batteries to generate rules for individual nodes? I Can add another item to the sensor, but why send another same item. thank you for the advice</p>
]]></description><link>http://forum.mycontroller.org/topic/77/battery-level-in-rules-or-chart-script-rule-to-check-battery-level</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Mar 2026 07:42:06 GMT</lastBuildDate><atom:link href="http://forum.mycontroller.org/topic/77.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 17 Nov 2016 18:23:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Battery level in rules or chart? [Script Rule to check battery level] on Sun, 15 Jan 2017 12:22:14 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'm using the 0.0.3.Final-SNAPSHOT - does this mean I dont need to create a script like above but find a rule/condition about battery levels of nodes? If so, I cannot find that, but I am currently using your script example, which works, but is of course a little cumbersome compared to another option of using a node's battery level directly somewhere in the rules panel...</p>
]]></description><link>http://forum.mycontroller.org/post/546</link><guid isPermaLink="true">http://forum.mycontroller.org/post/546</guid><dc:creator><![CDATA[Velo17]]></dc:creator><pubDate>Sun, 15 Jan 2017 12:22:14 GMT</pubDate></item><item><title><![CDATA[Reply to Battery level in rules or chart? [Script Rule to check battery level] on Sun, 01 Jan 2017 20:21:26 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for your response!</p>
]]></description><link>http://forum.mycontroller.org/post/467</link><guid isPermaLink="true">http://forum.mycontroller.org/post/467</guid><dc:creator><![CDATA[DaTTcz]]></dc:creator><pubDate>Sun, 01 Jan 2017 20:21:26 GMT</pubDate></item><item><title><![CDATA[Reply to Battery level in rules or chart? [Script Rule to check battery level] on Fri, 18 Nov 2016 07:37:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dattcz" aria-label="Profile: DaTTcz">@<bdi>DaTTcz</bdi></a> For now direct battery support not available on Rules. However you can do it from <code>script</code>. I will update how to handle with script.</p>
<p dir="auto"><s>Kindly create a request on <a href="https://github.com/mycontroller-org/mycontroller/issues" rel="nofollow ugc">github page</a> to support battery level on rules.</s></p>
<p dir="auto"><strong>ALL these features are available on <a href="http://forum.mycontroller.org/topic/58/download-snapshot-build">SNAPSHOT build</a></strong></p>
<p dir="auto">Enter your condition via script,</p>
<p dir="auto">Steps:</p>
<ul>
<li>Create UID Tag for your node,</li>
<li>Create script to check node battery level (script type: Condition)</li>
<li>Create rule with this condition script</li>
<li>Enjoy <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=49d1c908e56" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></li>
</ul>
<h5>Create UID Tag:</h5>
<p dir="auto"><img src="/uploads/files/1479454457760-upload-6bd6f2c1-24c2-431c-b97e-6ae08892003c" alt="0_1479454456642_upload-6bd6f2c1-24c2-431c-b97e-6ae08892003c" class=" img-fluid img-markdown" /></p>
<h5>Add script:</h5>
<p dir="auto"><img src="/uploads/files/1479454323215-upload-df8f276c-45cd-4c6c-9ef2-1de1c50f4445" alt="0_1479454321011_upload-df8f276c-45cd-4c6c-9ef2-1de1c50f4445" class=" img-fluid img-markdown" /><br />
Java Script to check battery level,</p>
<pre><code>var myImports = new JavaImporter(java.io, java.lang, java.util, java.text);

with(myImports) {
  var mcResult = false; //By default this is false. When your condition meets change this to true
  var batteryLevel = mcApi.uidTag().getByUid("node1").resource.batteryLevel;
  if(batteryLevel &gt;= 50){ // Your condition
     mcResult = true;
  }
}
</code></pre>
<h5>Add rule:</h5>
<p dir="auto"><img src="/uploads/files/1479454519676-upload-ec78f98b-ead9-442b-80aa-28eda4e10dd4" alt="0_1479454517098_upload-ec78f98b-ead9-442b-80aa-28eda4e10dd4" class=" img-fluid img-markdown" /></p>
]]></description><link>http://forum.mycontroller.org/post/350</link><guid isPermaLink="true">http://forum.mycontroller.org/post/350</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Fri, 18 Nov 2016 07:37:40 GMT</pubDate></item></channel></rss>