• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Battery level error on email

    scheduled pinned locked moved General Discussion
    8 posts 2 posters 1.6k views 1 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • bmanosB offline
      bmanos
      global: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 one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa @bmanos
        global:last-edited-by,

        @bmanos Can you post your email template?

        one-reply-to-this-post last-reply-time reply quote 0
        • bmanosB offline
          bmanos
          global: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 one-reply-to-this-post last-reply-time reply quote 0
          • jkandasaJ offline
            jkandasa @bmanos
            global: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 one-reply-to-this-post last-reply-time reply quote 0
            • bmanosB offline
              bmanos @jkandasa
              global:last-edited-by,

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

              bmanosB one-reply-to-this-post last-reply-time reply quote 0
              • bmanosB offline
                bmanos @bmanos
                global: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 one-reply-to-this-post last-reply-time reply quote 0
                • jkandasaJ offline
                  jkandasa @bmanos
                  global: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 one-reply-to-this-post last-reply-time reply quote 0
                  • bmanosB offline
                    bmanos @jkandasa
                    global:last-edited-by,

                    thanks @jkandasa

                    one-reply-to-this-post last-reply-time reply quote 0
                    • first-post
                      last-post

                    0

                    online

                    644

                    users

                    532

                    topics

                    3.4k

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