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. Development
  3. Issues reading from serial gateway

Issues reading from serial gateway

Scheduled Pinned Locked Moved Development
14 Posts 5 Posters 3.0k Views 2 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.
  • E Offline
    E Offline
    ericvdb
    wrote on last edited by ericvdb
    #2

    Change http://www.mysensors.org/build/binary#binaryswitchsensor-example line 46

    gw.begin();
    

    to

    gw.begin(null, 10, false);
    

    Where 10 is in this example the Node ID

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pelnarp
      wrote on last edited by
      #3

      I see, great, thank you! Is there a way how to assign the ID of the node from outside, without a controller? Let's say, there will be a number of nodes, sensors being turned on or off and the ID's should be assigned using the serial gateway from the connected PC. I guess this is what the controllers must be doing, I just want to control it myself.
      Thank you

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ericvdb
        wrote on last edited by
        #4

        Exactly, It's the controllers job to give out ID's to the Node's. There's no way around other then setting the Node ID in the sketch as i mentioned above.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          pelnarp
          wrote on last edited by
          #5

          Thank you for the response, however it does not make sense to me. How would it be possible for a controller to assign the ID? There must be some set of commands (API) on the node that are used by the controllers to assign the node ID's, right? I basically want to write a code that will act as a controller in terms of assigning the ID's to the nodes. Is this possible?
          Thanks!

          1 Reply Last reply
          0
          • E Offline
            E Offline
            ericvdb
            wrote on last edited by
            #6

            Sure, thats what all the controllers do.

            Have a read on the API page

            1 Reply Last reply
            0
            • P Offline
              P Offline
              pelnarp
              wrote on last edited by
              #7

              Thank you for pointing me to this direction. Happy New Year!

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pelnarp
                wrote on last edited by
                #8

                Hi, I have read the whole API documentation but still do not seem to find the way to configure the node ID. I have found this topic http://forum.mysensors.org/topic/350/problems-getting-sensorid/11 but sending the command "255;255;3;0;4;1" to the node did not help though. I would appreciate any hints on this topic. Thank you!

                J 1 Reply Last reply
                0
                • P pelnarp

                  Hi, I have read the whole API documentation but still do not seem to find the way to configure the node ID. I have found this topic http://forum.mysensors.org/topic/350/problems-getting-sensorid/11 but sending the command "255;255;3;0;4;1" to the node did not help though. I would appreciate any hints on this topic. Thank you!

                  J Offline
                  J Offline
                  jkandasa
                  Plugin Developer
                  wrote on last edited by
                  #9

                  @pelnarp said:

                  Hi, I have read the whole API documentation but still do not seem to find the way to configure the node ID. I have found this topic http://forum.mysensors.org/topic/350/problems-getting-sensorid/11 but sending the command "255;255;3;0;4;1" to the node did not help though. I would appreciate any hints on this topic. Thank you!

                  @pelnarp you should complete each serial command with \n(indicates command completed), your command should be 255;255;3;0;4;1\n

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pelnarp
                    wrote on last edited by
                    #10

                    I am trying to send the values, but nothing happens. I am sending "255;255;3;0;4;1\n" over serial port (USB) to the serial gateway, but this does not seem to be processed. Either it is not sent to the sensor at all, or the sensor does not react. I am trying to send this from either Serial Monitor in the Arduino Studio or from my C# code, console app. The serial port works and reads the values properly, however sending this sequence seems to be an issue.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      pelnarp
                      wrote on last edited by
                      #11

                      Ok, I have figured this out. When sending the value via the serial port there must be a delay between the characters (3ms). Therefore I do something like this (schematically), which works:

                      foreach (char c in "255;255;3;0;4;1")
                      {
                      serialPort1.Write(c.ToString());
                      Thread.Sleep(3);
                      }

                      1 Reply Last reply
                      0
                      • ElGuapoE Offline
                        ElGuapoE Offline
                        ElGuapo
                        wrote on last edited by
                        #12

                        Hi, to all!

                        My situation was exatly the same, that "pelnarps" had! My sensor couldn't get ID from gw, and gave the same results at both ends (gw, and sensor side). Changing gw.begin() as "ericdvb" suggested, solved this issue.
                        Thanks ericdvb, and pelnarps! I convinced, that this issue can be solved decreasing baudrate, isn't it!

                        1 Reply Last reply
                        0
                        • mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #13

                          Welcome to the MySensors forum @ElGuapo !
                          The gw never gives out ID. The ID is given from your controller, or handled manually by setting ID in gw.begin if you prefer that.

                          1 Reply Last reply
                          0
                          • ElGuapoE Offline
                            ElGuapoE Offline
                            ElGuapo
                            wrote on last edited by
                            #14

                            Hi, mfalkvidd! Thanks for your fast replay. I'm new in Home automation. Actually I try to build my sample system, based on serial gateway. I have my gateway connected to Openhab as controller, and now started to works finally with a temperature sensor.
                            I spent a lot of time trying to connect sensor to gateway, with no success. Just that piece of information needed to overcome.
                            Thanks for all!

                            1 Reply Last reply
                            1
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            23

                            Online

                            11.7k

                            Users

                            11.2k

                            Topics

                            113.0k

                            Posts


                            Copyright 2019 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