Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. How to change sender, command, msg type, payload type, ... ?

How to change sender, command, msg type, payload type, ... ?

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 3 Posters 2.5k Views 3 Watching
  • 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.
  • npkhoiN Offline
    npkhoiN Offline
    npkhoi
    wrote on last edited by
    #1

    Hi everyone, I'm using UNO to build a Serial Gateway and Pro mini to build a sensor node. I use GatewaySerial and AirQualitySensor in Mysensors' example to test the code. I want to send continuously a random number from the AirQualitySensor to GatewaySerial. This is what appearing on my Serial Monitor:
    0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSM:RADIO:OK
    0;255;3;0;9;TSM:GW MODE
    0;255;3;0;9;TSM:READY
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.0.0
    0;255;3;0;9;No registration required
    0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
    0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
    0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
    0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSP:MSG:BC
    0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
    0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
    0;255;3;0;9;TSP:MSG:GWL OK
    0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
    0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    255;255;3;0;3;

    Could you tell me how to change the structure of this line "0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0" like in this example:
    https://www.youtube.com/watch?v=doz9mEtw_8g&feature=youtu.be

    Thank you very much.

    martinhjelmareM 1 Reply Last reply
    0
    • npkhoiN npkhoi

      Hi everyone, I'm using UNO to build a Serial Gateway and Pro mini to build a sensor node. I use GatewaySerial and AirQualitySensor in Mysensors' example to test the code. I want to send continuously a random number from the AirQualitySensor to GatewaySerial. This is what appearing on my Serial Monitor:
      0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      0;255;3;0;14;Gateway startup complete.
      0;255;0;0;18;2.0.0
      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
      0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
      0;255;3;0;9;TSP:MSG:BC
      0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
      0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
      0;255;3;0;9;TSP:MSG:GWL OK
      0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
      0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
      255;255;3;0;3;

      Could you tell me how to change the structure of this line "0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0" like in this example:
      https://www.youtube.com/watch?v=doz9mEtw_8g&feature=youtu.be

      Thank you very much.

      martinhjelmareM Offline
      martinhjelmareM Offline
      martinhjelmare
      Plugin Developer
      wrote on last edited by
      #2

      @npkhoi

      Look at the API page on the mysensors web. You'll find the command to send a message there and lots more.

      I would first make sure I have comms up properly though, before creating a more complicated sketch.

      The last line from your gateway log is a request for node id from the node. You need a controller connected that can hand out node ids and reply to the request. The gateway is not responsible for handing out node ids. The alternative is to specify a fixed node id in your sketch. You should find the command for this also on the api page.

      Also have a look at the sticky post in the troubleshooting section. You should find links to posts explaining the debug output from the log.

      1 Reply Last reply
      0
      • npkhoiN Offline
        npkhoiN Offline
        npkhoi
        wrote on last edited by
        #3

        Thank you martinhjelmare.
        I have read the page https://www.mysensors.org/download/serial_api_20 and I know the format of the message frame but I don't know how to change these things in the sketch . I spent a week trading code in the library and got nothing @@
        Maybe I'm so noob to fine the way to build just an example :disappointed_relieved: Could you give me a link that shows how to change the message frame ?

        mfalkviddM 1 Reply Last reply
        0
        • npkhoiN npkhoi

          Thank you martinhjelmare.
          I have read the page https://www.mysensors.org/download/serial_api_20 and I know the format of the message frame but I don't know how to change these things in the sketch . I spent a week trading code in the library and got nothing @@
          Maybe I'm so noob to fine the way to build just an example :disappointed_relieved: Could you give me a link that shows how to change the message frame ?

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by
          #4

          @npkhoi I'n not sure I understand what you are trying to do, but https://www.mysensors.org/download/sensor_api_20#message-constructor describes how the message object can be interacted with.

          1 Reply Last reply
          0
          • npkhoiN Offline
            npkhoiN Offline
            npkhoi
            wrote on last edited by
            #5

            @mfalkvidd I've read this link https://www.mysensors.org/download/sensor_api_20#message-constructor too, but I'm so confused what I have to do to change "255 - 255 - 255 - 255" to "2 - 2 - 0 - 0", I don't know what to do with the code in the link. Where do I have to change the code to configure the message frame ?

            mfalkviddM 1 Reply Last reply
            0
            • npkhoiN npkhoi

              @mfalkvidd I've read this link https://www.mysensors.org/download/sensor_api_20#message-constructor too, but I'm so confused what I have to do to change "255 - 255 - 255 - 255" to "2 - 2 - 0 - 0", I don't know what to do with the code in the link. Where do I have to change the code to configure the message frame ?

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by
              #6

              @npkhoi I think you are trying to work on the wrong level. MySensors has objects to interact with so you don't need to assemble and parse strings.

              or maybe I just don't understand what you are trying to achieve.

              1 Reply Last reply
              0
              • npkhoiN Offline
                npkhoiN Offline
                npkhoi
                wrote on last edited by npkhoi
                #7

                @mfalkvidd I just want to use AirQualitySensor to send a random number to GatewaySerial (because I don't have an Air Sensor so I send a random number). That's exactly what I want to do now.

                mfalkviddM 1 Reply Last reply
                0
                • npkhoiN npkhoi

                  @mfalkvidd I just want to use AirQualitySensor to send a random number to GatewaySerial (because I don't have an Air Sensor so I send a random number). That's exactly what I want to do now.

                  mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by
                  #8

                  @npkhoi thanks for e plaining. Then it should be sufficient to replace

                  send(msg.set((int16_t)ceil(valMQ)));
                  

                  with

                  send(msg.set(random()));
                  
                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  22

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.1k

                  Posts


                  Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • MySensors
                  • OpenHardware.io
                  • Categories
                  • Recent
                  • Tags
                  • Popular