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

    NODEMANAGER OTA CONFIGURATION per java script

    scheduled pinned locked moved Scripts
    5 posts 2 posters 728 views 1 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • T offline
      TRex-600
      global:last-edited-by,

      Hello everybody,

      I'm new here. At first big thanks for the great mycontroller!!!

      I want to use the Nodemanager OTA configuration feature. I think the right methode is mcApi.sensor().sendRawMessage(message). But I haven't any idea how define the message. The Syntax of the mesesage looks like: <node_id>;<configuration_child_id>;<req>;0;<V_CUSTOM>;<child_id>,<function_id>,<value>
      for example: 100;200;2;0;48;0,4,10

      Have any one an example script?

      Best regards,
      TRex-600

      jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa @TRex-600
        global:last-edited-by,

        @TRex-600 Welcome to MyController community. I will report an example soon.

        one-reply-to-this-post last-reply-time reply quote 0
        • T offline
          TRex-600
          global:last-edited-by,

          @jkandasa
          That sounds great! I'm really looking forward to an example. Thank you in advance for your effort.

          jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
          • jkandasaJ offline
            jkandasa @TRex-600
            global:last-edited-by,

            @TRex-600 Sorry for the delayed response.

            This script might help you. But I didn't test this. Please let me know if you see an issue.
            Type and SubType details are available in mycontroller source code

            var myImports = new JavaImporter(java.lang, java.util, org.mycontroller.standalone.utils.McUtils, org.mycontroller.standalone.message.IMessage);
            
            with(myImports) {
              // get your gateway via uuid
              var myGateway = mcApi.uidTag().getByUid("my-test-gateway").getResource();
              
              // Import message type
              var Message = Java.type("org.mycontroller.standalone.message.IMessage")
              
              // create message object
              var message = Message.getInstance()
              
              // set gateway id.
              message.setGatewayId(myGateway.id)
              
              // set node EUI
              message.setNodeEui("100")
                
              // set sensor id
              message.setSensorId("200")
              
              // set message type
              message.setType("Request")
              
              // set message sub type
              message.setSubType("Custom")
              
              // set acknowledgement
              message.setAck(0)
              
              // set payload
              message.setPayload("0,4,10")
              
              // send Raw Message
              mcApi.sensor().sendRawMessage(message);
            }
            
            
            one-reply-to-this-post last-reply-time reply quote 0
            • T offline
              TRex-600
              global:last-edited-by,

              @jkandasa Thanks a lot for the example. The delay doesn't matter. I had already found a solution. But I didn't think this was good enough to publish. I take advantage of the fact that the mysensors nodes do not necessarily need a request message for the Ota function. So I got along with mcApi.sensor (). SendPayload ().

              When I have time again I'll try your better solution.

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

              0

              online

              644

              users

              532

              topics

              3.4k

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