• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login

    Battery level error on email

    Scheduled Pinned Locked Moved General Discussion
    8 Posts 2 Posters 1.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • bmanosB Offline
      bmanos
      last edited by

      Hello
      I am using the js battery script I set it up using those instructions (https://forum.mycontroller.org/topic/77/battery-level-in-rules-or-chart-script-rule-to-check-battery-level) and make my alert to send an email
      This is what I get when the condition is met

      Exception: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
      ==> notification.actualValue [in template "unknown" at line 13, column 42]

      Tip: It's the step after the last dot that caused this error, not those before it.

      Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??


      FTL stack trace ("~" means nesting-related):
      - Failed at: ${notification.actualValue} [in template "unknown" at line 13, column 40]

      Any idea what is going wrong
      Thanks, Emmanuel

      jkandasaJ 1 Reply Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @bmanos
        last edited by

        @bmanos Can you post your email template?

        1 Reply Last reply Reply Quote 0
        • bmanosB Offline
          bmanos
          last edited by

          Hello again
          This is the default email template

          <!DOCTYPE html>
          <html>
            <style>body {font-size: 12px;}</style>
            <body>
              <b>Dear User,</b>
              <br>
              <br>There is a rule triggered for you!
              <br>
              <br>
                <table border='0'>
                  <tr><td>Rule definition name</td><td>: ${notification.ruleName}</td> <tr>
                  <tr><td>Condition</td><td>: ${notification.ruleCondition}</td><tr>
                  <tr><td>Actual value</td><td>: ${notification.actualValue}</td><tr>
                  <tr><td>Triggered at</td><td>: ${notification.triggeredAt}</td><tr>
                </table>
              <br>
              <br>-- Powered by <a href='http://www.MyController.org'>www.MyController.org</a>
            </body>
          </html>
          
          

          Thanks, Emmanuel

          jkandasaJ 1 Reply Last reply Reply Quote 0
          • jkandasaJ Offline
            jkandasa @bmanos
            last edited by

            @bmanos Thanks for the template. This condition executed via script, hence rule definition doesn't know the actual value.

            You should create a new email template for this purpose without notification.actualValue.

            bmanosB 1 Reply Last reply Reply Quote 0
            • bmanosB Offline
              bmanos @jkandasa
              last edited by

              @jkandasa thanks for your reply I will make an new template without the value and let you know.

              bmanosB 1 Reply Last reply Reply Quote 0
              • bmanosB Offline
                bmanos @bmanos
                last edited by

                @bmanos said in Battery level error on email:

                @jkandasa thanks for your reply I will make an new template without the value and let you know.

                Tested everything works fine thanks again
                If I want to display the battery value in the email how can I do this?

                jkandasaJ 1 Reply Last reply Reply Quote 0
                • jkandasaJ Offline
                  jkandasa @bmanos
                  last edited by

                  @bmanos, For now, you can not send this way. You can use Execute script on the operation and send an email via script(email template won't support here. you have to use plain body message).

                  bmanosB 1 Reply Last reply Reply Quote 0
                  • bmanosB Offline
                    bmanos @jkandasa
                    last edited by

                    thanks @jkandasa

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post

                    1

                    Online

                    587

                    Users

                    529

                    Topics

                    3.4k

                    Posts
                    Copyright © 2015-2025 MyController.org | Contributors | Localization