Battery level in rules or chart? [Script Rule to check battery level]

  • 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

  • @DaTTcz For now direct battery support not available on Rules. However you can do it from script. I will update how to handle with script.

    Kindly create a request on github page to support battery level on rules.

    ALL these features are available on SNAPSHOT build

    Enter your condition via script,


    • Create UID Tag for your node,
    • Create script to check node battery level (script type: Condition)
    • Create rule with this condition script
    • Enjoy 🙂
    Create UID Tag:


    Add script:

    Java Script to check battery level,

    var myImports = new JavaImporter(, 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 >= 50){ // Your condition
         mcResult = true;
    Add rule:


  • Thank you for your response!

  • @jkandasa 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...

Suggested Topics