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. Arduinon startup complete request strange behaviour (python)

Arduinon startup complete request strange behaviour (python)

Scheduled Pinned Locked Moved Troubleshooting
12 Posts 2 Posters 3.6k Views 1 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.
  • M marceltrapman

    Hi,

    When the gateway is started up it sends a message 'Arduino startup complete' (at least that is what I see).

    But instead of using the 'normal' 5 field format I receive the below with 8 fields.
    Obviously this is wrong and it looks like one or two request are mixed up (possibly a request for a radioId together with the startup message)...
    Any idea how this can happen (using python and serial connection)...

    2014-04-29 01:16:36 MySensors Debug Receiving command 255;255;4;0;0;4;11;Arduino startup complete.

    H Offline
    H Offline
    hek
    Admin
    wrote on last edited by
    #2

    @marceltrapman

    Strange.

    serial(PSTR("0;0;%d;%d;Arduino startup complete.\n"),  M_INTERNAL, I_LOG_MESSAGE);
    

    This is the only thing i can find being printed during Gateway begin.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      marceltrapman
      Mod
      wrote on last edited by
      #3

      @hek is it in any way possible that messages get scrambled on the gateway when they cross each other?

      Fulltime Servoy Developer
      Parttime Moderator MySensors board

      I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
      I have a FABtotum to print cases.

      H 1 Reply Last reply
      0
      • M marceltrapman

        @hek is it in any way possible that messages get scrambled on the gateway when they cross each other?

        H Offline
        H Offline
        hek
        Admin
        wrote on last edited by
        #4

        @marceltrapman

        No, i don't really see how this could happen. Do you have any idea what other message it could have gotten mixed up with?

        What happens if you turn of debug-printing does it disappear?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          marceltrapman
          Mod
          wrote on last edited by
          #5

          This happened with and without debug printing.

          The funny thing is that it appeared 'out of the blue', showed up a couple of restarts and it looks like it disappeared again with the last restart.

          I will keep an eye on it since I will need a lot of restarts before I am ready with the plugin ")

          Fulltime Servoy Developer
          Parttime Moderator MySensors board

          I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
          I have a FABtotum to print cases.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            marceltrapman
            Mod
            wrote on last edited by marceltrapman
            #6

            OK, this time it is completely clear to me but I don't know why yet.

            Receiving command 1;2;2;2;0;0;4;11;Arduino startup complete.

            Two sensor/gateway messages were concatenated.

            The first a relay device 'reporting for duty', asking for the registered state of itself 1;2;2;2;
            And following the gateway reporting for duty: 0;0;4;11;Adruino startup complete

            Strange though that the gateway presentation comes after the sensor presentation...

            Fulltime Servoy Developer
            Parttime Moderator MySensors board

            I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
            I have a FABtotum to print cases.

            H 1 Reply Last reply
            0
            • M marceltrapman

              OK, this time it is completely clear to me but I don't know why yet.

              Receiving command 1;2;2;2;0;0;4;11;Arduino startup complete.

              Two sensor/gateway messages were concatenated.

              The first a relay device 'reporting for duty', asking for the registered state of itself 1;2;2;2;
              And following the gateway reporting for duty: 0;0;4;11;Adruino startup complete

              Strange though that the gateway presentation comes after the sensor presentation...

              H Offline
              H Offline
              hek
              Admin
              wrote on last edited by
              #7

              @marceltrapman

              Are you really "breaking" the commands on newline character on the phyton side? Please post your code ;)

              1 Reply Last reply
              0
              • M Offline
                M Offline
                marceltrapman
                Mod
                wrote on last edited by marceltrapman
                #8

                See below, the answer is yes. I do a readline() and it breaks on '\n' by default and MySensors does the same.

                BTW I added the flush() after sending my previous post as well as removing all sleeping code from the sensor.
                I will start playing with this because I suspect one of these two (or both) solved the issue.
                I now see Receiving command 0;0;4;11;Arduino startup complete. before anything else :)

                EDIT: false alarm. A new upload of the sketch and a restart made the issue appear again :(

                    try:
                        request = self.connection.readline()
                    except:
                        self.debugLog("Unexpected error:", sys.exc_info()[0])
                        request = None
                    finally:
                        self.connection.flush()
                
                        if request:
                            request = request.strip("\n\r")
                
                            self.debugLog("Receiving command %s" % request)
                

                Fulltime Servoy Developer
                Parttime Moderator MySensors board

                I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
                I have a FABtotum to print cases.

                H 1 Reply Last reply
                0
                • M marceltrapman

                  See below, the answer is yes. I do a readline() and it breaks on '\n' by default and MySensors does the same.

                  BTW I added the flush() after sending my previous post as well as removing all sleeping code from the sensor.
                  I will start playing with this because I suspect one of these two (or both) solved the issue.
                  I now see Receiving command 0;0;4;11;Arduino startup complete. before anything else :)

                  EDIT: false alarm. A new upload of the sketch and a restart made the issue appear again :(

                      try:
                          request = self.connection.readline()
                      except:
                          self.debugLog("Unexpected error:", sys.exc_info()[0])
                          request = None
                      finally:
                          self.connection.flush()
                  
                          if request:
                              request = request.strip("\n\r")
                  
                              self.debugLog("Receiving command %s" % request)
                  
                  H Offline
                  H Offline
                  hek
                  Admin
                  wrote on last edited by
                  #9

                  @marceltrapman

                  Should you really flush after calling readline()?

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    marceltrapman
                    Mod
                    wrote on last edited by
                    #10

                    Nope, this was a 'if it does not help it will not hurt'.

                    I am going to remove it.

                    Fulltime Servoy Developer
                    Parttime Moderator MySensors board

                    I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
                    I have a FABtotum to print cases.

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hek
                      Admin
                      wrote on last edited by
                      #11

                      Hard to say,

                      It surely looks like readline() gives back more that one line to me.

                      I'm no phyton expert. But where is request-variable declared? Is it cleared between runs?

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        marceltrapman
                        Mod
                        wrote on last edited by
                        #12

                        Yes, all variables are cleared before I re-use them which is completely obsolete even because they are defined in the method and the method is called from within a/the loop.

                        I will ask the Indigo gurus about this...

                        Fulltime Servoy Developer
                        Parttime Moderator MySensors board

                        I use Domoticz as controller for Z-Wave and MySensors (previously Indigo and OpenHAB).
                        I have a FABtotum to print cases.

                        1 Reply Last reply
                        0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        13

                        Online

                        12.1k

                        Users

                        11.2k

                        Topics

                        113.4k

                        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