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

    NODEMANAGER OTA CONFIGURATION per java script

    Scheduled Pinned Locked Moved Scripts
    5 Posts 2 Posters 445 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.
    • T Offline
      TRex-600
      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 1 Reply Last reply Reply Quote 0
      • jkandasaJ Offline
        jkandasa @TRex-600
        last edited by

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

        1 Reply Last reply Reply Quote 0
        • T Offline
          TRex-600
          last edited by

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

          jkandasaJ 1 Reply Last reply Reply Quote 0
          • jkandasaJ Offline
            jkandasa @TRex-600
            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);
            }
            
            
            1 Reply Last reply Reply Quote 0
            • T Offline
              TRex-600
              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.

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

              0

              Online

              587

              Users

              529

              Topics

              3.4k

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