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 2.9k 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.
  • marceltrapmanM Offline
    marceltrapmanM 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.

    hekH 1 Reply Last reply
    0
    • marceltrapmanM marceltrapman

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

      hekH Offline
      hekH 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
      • marceltrapmanM Offline
        marceltrapmanM 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
        • marceltrapmanM Offline
          marceltrapmanM 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.

          hekH 1 Reply Last reply
          0
          • marceltrapmanM 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...

            hekH Offline
            hekH 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
            • marceltrapmanM Offline
              marceltrapmanM 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.

              hekH 1 Reply Last reply
              0
              • marceltrapmanM 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)
                
                hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by
                #9

                @marceltrapman

                Should you really flush after calling readline()?

                1 Reply Last reply
                0
                • marceltrapmanM Offline
                  marceltrapmanM 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
                  • hekH Offline
                    hekH 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
                    • marceltrapmanM Offline
                      marceltrapmanM 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
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      29

                      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