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. Announcements
  3. Converting a sketch from 1.5.x to 2.0.x

Converting a sketch from 1.5.x to 2.0.x

Scheduled Pinned Locked Moved Announcements
52 Posts 21 Posters 31.9k Views 26 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.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by
    #33

    Are you able to upload some other sketch to the nano?
    Or has something bad happen to the FTDI chip on your nano perhaps?

    rchampR 1 Reply Last reply
    0
    • M Offline
      M Offline
      moskovskiy82
      wrote on last edited by
      #34

      Just for clarification. V2.0 gateway (MQTT client esp8266) - will it work with the 1.5/1.6 sensors? Or everything needs to be flashed as soon as possible?

      1 Reply Last reply
      0
      • hekH hek

        Are you able to upload some other sketch to the nano?
        Or has something bad happen to the FTDI chip on your nano perhaps?

        rchampR Offline
        rchampR Offline
        rchamp
        wrote on last edited by
        #35

        @hek it's actually a close nano with an FTDI board connected via serial inputs. I had this directly connected to my Vera, and communication with my old sensors was working just fine.

        EDIT: Fixed. All in all, it was user error. I was trying to connect through FTDI adapter. I unplugged FTDI board, connected USB directly to nano clone, and upload worked fine.

        Do I need to update mysensors plugin as well on Vera UI5?

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #36

          @rchamp said:

          Do I need to update mysensors plugin as well on Vera UI5?

          No, shouldn't be necessary.

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #37

            @moskovskiy82 said:

            Just for clarification. V2.0 gateway (MQTT client esp8266) - will it work with the 1.5/1.6 sensors?

            You could try, but the recommendation is to update the nodes as well.

            1 Reply Last reply
            0
            • martinhjelmareM martinhjelmare

              @Maurizio-Collu

              2.0 should work with home assistant, but all new features of 2.0 are not supported yet. WIP.

              Maurizio ColluM Offline
              Maurizio ColluM Offline
              Maurizio Collu
              wrote on last edited by
              #38

              @martinhjelmare
              Thanks Martin.

              I uploaded the GatewaySerial to the arduino working as gateway, but if I upload the sketch and I open the monitor, I obtain this error:

              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:FAIL
              0;255;3;0;9;!TSM:FAILURE
              0;255;3;0;9;TSM:PDT

              What does it mean?

              Maurizio ColluM martinhjelmareM 2 Replies Last reply
              0
              • Maurizio ColluM Maurizio Collu

                @martinhjelmare
                Thanks Martin.

                I uploaded the GatewaySerial to the arduino working as gateway, but if I upload the sketch and I open the monitor, I obtain this error:

                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:FAIL
                0;255;3;0;9;!TSM:FAILURE
                0;255;3;0;9;TSM:PDT

                What does it mean?

                Maurizio ColluM Offline
                Maurizio ColluM Offline
                Maurizio Collu
                wrote on last edited by
                #39

                @martinhjelmare
                Plus, when starting home assistant, I get this error

                16-07-26 23:03:44 homeassistant.bootstrap: Error during setup of component mysensors
                Traceback (most recent call last):
                File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 62, in setup_gateway
                socket.inet_aton(device)
                OSError: illegal IP address string passed to inet_aton

                During handling of the above exception, another exception occurred:

                Traceback (most recent call last):
                File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 150, in _setup_component
                if not component.setup(hass, config):
                File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 109, in setup
                device, persistence_file, baud_rate, tcp_port)
                File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 73, in setup_gateway
                baud=baud_rate)
                File "/home/pi/.homeassistant/deps/mysensors/mysensors.py", line 326, in init
                persistence_file, protocol_version)
                File "/home/pi/.homeassistant/deps/mysensors/mysensors.py", line 40, in init
                self.const = _const
                UnboundLocalError: local variable '_const' referenced before assignment

                martinhjelmareM 1 Reply Last reply
                0
                • Maurizio ColluM Maurizio Collu

                  @martinhjelmare
                  Plus, when starting home assistant, I get this error

                  16-07-26 23:03:44 homeassistant.bootstrap: Error during setup of component mysensors
                  Traceback (most recent call last):
                  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 62, in setup_gateway
                  socket.inet_aton(device)
                  OSError: illegal IP address string passed to inet_aton

                  During handling of the above exception, another exception occurred:

                  Traceback (most recent call last):
                  File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 150, in _setup_component
                  if not component.setup(hass, config):
                  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 109, in setup
                  device, persistence_file, baud_rate, tcp_port)
                  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/mysensors.py", line 73, in setup_gateway
                  baud=baud_rate)
                  File "/home/pi/.homeassistant/deps/mysensors/mysensors.py", line 326, in init
                  persistence_file, protocol_version)
                  File "/home/pi/.homeassistant/deps/mysensors/mysensors.py", line 40, in init
                  self.const = _const
                  UnboundLocalError: local variable '_const' referenced before assignment

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

                  @Maurizio-Collu

                  Regarding the error in home assistant, that's a bug, due to specifying mysensors version other than 1.4 or 1.5. Use 1.5 and you should be fine. The bug is fixed in the dev branch of pymysensors and will be fixed in home assistant when real mysensors 2.0 support is merged. WIP.

                  Please post home assistant topics in the home assistant category under controllers. This is off topic in this thread.

                  1 Reply Last reply
                  0
                  • Maurizio ColluM Maurizio Collu

                    @martinhjelmare
                    Thanks Martin.

                    I uploaded the GatewaySerial to the arduino working as gateway, but if I upload the sketch and I open the monitor, I obtain this error:

                    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:FAIL
                    0;255;3;0;9;!TSM:FAILURE
                    0;255;3;0;9;TSM:PDT

                    What does it mean?

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

                    @Maurizio-Collu said:

                    @martinhjelmare
                    Thanks Martin.

                    I uploaded the GatewaySerial to the arduino working as gateway, but if I upload the sketch and I open the monitor, I obtain this error:

                    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:FAIL
                    0;255;3;0;9;!TSM:FAILURE
                    0;255;3;0;9;TSM:PDT

                    What does it mean?

                    @tekka knows this best, and he wrote a post explaining some of those messages here:
                    https://forum.mysensors.org/topic/4347/can-t-get-sensors-talking/3

                    Maurizio ColluM 1 Reply Last reply
                    0
                    • martinhjelmareM martinhjelmare

                      @Maurizio-Collu said:

                      @martinhjelmare
                      Thanks Martin.

                      I uploaded the GatewaySerial to the arduino working as gateway, but if I upload the sketch and I open the monitor, I obtain this error:

                      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:FAIL
                      0;255;3;0;9;!TSM:FAILURE
                      0;255;3;0;9;TSM:PDT

                      What does it mean?

                      @tekka knows this best, and he wrote a post explaining some of those messages here:
                      https://forum.mysensors.org/topic/4347/can-t-get-sensors-talking/3

                      Maurizio ColluM Offline
                      Maurizio ColluM Offline
                      Maurizio Collu
                      wrote on last edited by
                      #42

                      @martinhjelmare Thanks a ot.
                      Is there any guide/manual where all these messages are explained?

                      Plus, is there anywhere written what all these terms mean?

                      TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:

                      Kind Regards

                      mfalkviddM tekkaT 2 Replies Last reply
                      0
                      • Maurizio ColluM Maurizio Collu

                        @martinhjelmare Thanks a ot.
                        Is there any guide/manual where all these messages are explained?

                        Plus, is there anywhere written what all these terms mean?

                        TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:

                        Kind Regards

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

                        @Maurizio-Collu do you mean except the link martinhjelmare provided?

                        Maurizio ColluM 1 Reply Last reply
                        0
                        • mfalkviddM mfalkvidd

                          @Maurizio-Collu do you mean except the link martinhjelmare provided?

                          Maurizio ColluM Offline
                          Maurizio ColluM Offline
                          Maurizio Collu
                          wrote on last edited by
                          #44

                          @mfalkvidd Yes, basically this part (I'm sure it is explained somewhere, but I can't find where)

                          255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:

                          SOrry for my newbieness...

                          1 Reply Last reply
                          0
                          • Maurizio ColluM Maurizio Collu

                            @martinhjelmare Thanks a ot.
                            Is there any guide/manual where all these messages are explained?

                            Plus, is there anywhere written what all these terms mean?

                            TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:

                            Kind Regards

                            tekkaT Offline
                            tekkaT Offline
                            tekka
                            Admin
                            wrote on last edited by tekka
                            #45

                            @Maurizio-Collu Yes, the doc is in preparation, the meaning of these messages is described here (this is a PR that harmonizes the log message and will be pushed to 2.0.1).

                            In brief:

                            TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
                            
                            

                            TSP:MSG:SEND refers to message sending function in the transport state machine

                            255-255-0-0 is the routing information, i.e. sender-last-next-destination

                            s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:

                            • s=sensor ID (255 = internal)
                            • c=command (3 = C_INTERNAL)
                            • t=type (3 = I_ID_REQUEST)
                            • pt=payload type (0 = P_STRING)
                            • l=message length (0)
                            • sg=signature flag (0 = not signed)
                            • ft=failed transmission counter (0 = no failed uplink transmission at this* oint)
                            • st=send status (OK)
                            • : actual message (empty)

                            => Your node has no assigned ID (=255) and is requesting a new ID from the controller.

                            Please refer to the serial protocol or API for additional information.

                            Good luck!

                            1 Reply Last reply
                            3
                            • pndgt0P Offline
                              pndgt0P Offline
                              pndgt0
                              wrote on last edited by
                              #46

                              Hi,
                              I was trying to implement the irrigation controller but realized that was not migrated to MySensors 2.0.
                              I followed the instructions provided in the first post and arrived to a version that compiles with no errors. Nonetheless, as I am newbie, I would appreciate if someone could review some changes that I am not sure about. Those changes are related with the original sketch which has direct calls to process() in several while statements. First I tried to change the process() with _process() but several errors appeared, so finally I removed all the calls to process() but am not sure. I have the modified code here IrrigationController.ino in which I commented the lines added / deleted / modified. Any help / direction would be greatly appreciated.

                              Boots33B 1 Reply Last reply
                              0
                              • pndgt0P pndgt0

                                Hi,
                                I was trying to implement the irrigation controller but realized that was not migrated to MySensors 2.0.
                                I followed the instructions provided in the first post and arrived to a version that compiles with no errors. Nonetheless, as I am newbie, I would appreciate if someone could review some changes that I am not sure about. Those changes are related with the original sketch which has direct calls to process() in several while statements. First I tried to change the process() with _process() but several errors appeared, so finally I removed all the calls to process() but am not sure. I have the modified code here IrrigationController.ino in which I commented the lines added / deleted / modified. Any help / direction would be greatly appreciated.

                                Boots33B Offline
                                Boots33B Offline
                                Boots33
                                Hero Member
                                wrote on last edited by
                                #47

                                @pndgt0

                                The sketches that require external libraries are not included in the V2 install anymore but they are available here in the new V2 format. You will find the irrigation sketch there.

                                pndgt0P 1 Reply Last reply
                                0
                                • Boots33B Boots33

                                  @pndgt0

                                  The sketches that require external libraries are not included in the V2 install anymore but they are available here in the new V2 format. You will find the irrigation sketch there.

                                  pndgt0P Offline
                                  pndgt0P Offline
                                  pndgt0
                                  wrote on last edited by
                                  #48

                                  @Boots33 Great! Thank you for the quick response and the URL. I took that version. Just wanted to let you know that to successfully compile it was needed to remove the #include <LiquidCrystal.h> and probably an update to that sketch would be needed at Github respository.
                                  Thank you again!

                                  Boots33B 1 Reply Last reply
                                  0
                                  • pndgt0P pndgt0

                                    @Boots33 Great! Thank you for the quick response and the URL. I took that version. Just wanted to let you know that to successfully compile it was needed to remove the #include <LiquidCrystal.h> and probably an update to that sketch would be needed at Github respository.
                                    Thank you again!

                                    Boots33B Offline
                                    Boots33B Offline
                                    Boots33
                                    Hero Member
                                    wrote on last edited by
                                    #49

                                    @pndgt0 That may be because you do not have the LiquidCrystal library installed. They have the external libraries there as well

                                    1 Reply Last reply
                                    0
                                    • paqorP Offline
                                      paqorP Offline
                                      paqor
                                      wrote on last edited by
                                      #50
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • siodS Offline
                                        siodS Offline
                                        siod
                                        wrote on last edited by siod
                                        #51

                                        I built a 2.0 MQTT gateway and am experimenting with a sensor using 1.5 library. I can see incoming data in the serial monitor, but the data is a bit different then when I was using the 1.5 MQTT gateway. In openhab I used this:

                                        {mqtt="<[mysensor:MyMQTT/3/2/1/V_TRIPPED:state:CLOSED:1],<[mysensor:MyMQTT/3/2/1/V_TRIPPED:state:OPEN:0]"}
                                        

                                        But now I must skip the V_Tripped part to make it work like this:

                                        {mqtt="<[mysensor:mygateway1-out/3/2/1/0/16:state:OPEN:1],<[mysensor:mygateway1-out/3/2/1/0/16:state:CLOSED:0]"}
                                        

                                        Is this how it is supposed to be or do I have to make the sensor node 2.0 compatible first? I thought the payload is saved in the V_TRIPPED variable, but it doesn´t seem to work in the new 2.0 library. Pls advise-

                                        edit:

                                        Ok, digged a bit deeper: if I understand it right, I don´t need "V_TRIPPED" or any other value in my controllers code (which is openhab actually) anymore but still in my sensor node code of course. So the gateway will transform "V_Tripped" into sub-typ "16". Correct? So all I´ll have to change is my openhab code, right?

                                        still learning...

                                        YveauxY 1 Reply Last reply
                                        0
                                        • siodS siod

                                          I built a 2.0 MQTT gateway and am experimenting with a sensor using 1.5 library. I can see incoming data in the serial monitor, but the data is a bit different then when I was using the 1.5 MQTT gateway. In openhab I used this:

                                          {mqtt="<[mysensor:MyMQTT/3/2/1/V_TRIPPED:state:CLOSED:1],<[mysensor:MyMQTT/3/2/1/V_TRIPPED:state:OPEN:0]"}
                                          

                                          But now I must skip the V_Tripped part to make it work like this:

                                          {mqtt="<[mysensor:mygateway1-out/3/2/1/0/16:state:OPEN:1],<[mysensor:mygateway1-out/3/2/1/0/16:state:CLOSED:0]"}
                                          

                                          Is this how it is supposed to be or do I have to make the sensor node 2.0 compatible first? I thought the payload is saved in the V_TRIPPED variable, but it doesn´t seem to work in the new 2.0 library. Pls advise-

                                          edit:

                                          Ok, digged a bit deeper: if I understand it right, I don´t need "V_TRIPPED" or any other value in my controllers code (which is openhab actually) anymore but still in my sensor node code of course. So the gateway will transform "V_Tripped" into sub-typ "16". Correct? So all I´ll have to change is my openhab code, right?

                                          YveauxY Offline
                                          YveauxY Offline
                                          Yveaux
                                          Mod
                                          wrote on last edited by
                                          #52

                                          @siod correct. The conversion of value code to text has been removed in the 2.0.0 implementation, so now the raw values codes are reported in the topic.

                                          http://yveaux.blogspot.nl

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


                                          19

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          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