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.
  • scalzS Offline
    scalzS Offline
    scalz
    Hardware Contributor
    wrote on last edited by
    #10

    @Rolo6442u
    If I remember well, it is handled by SecurityPersonalizer.ino It is sketch for signing options, and i think you can set/generate your rf aes key there. It store it in eeprom. Then you upload the new sketch with encryption define enabled. For me it's ok, as i use signing which needs to use the personalizer.
    I think this works like this, not sure as i have not enabled encryption yet. Am I right @Anticimex ?

    1 Reply Last reply
    0
    • R Rolo6442u

      Great work ! This version looks a lot cleaner and the support for the RFM69 is more integrated. Thanks for that. One thing I'm missing and that's the specification of the encryption key for the RFM69. This was done in version 1.5.x by a user defined 16 bytes string. Now i see only a #define MY_RFM69_ENABLE_ENCRYPTION.
      How and where is the key specified ? How does this make my setup unique ?

      Thanks.

      AnticimexA Offline
      AnticimexA Offline
      Anticimex
      Contest Winner
      wrote on last edited by
      #11

      @Rolo6442u
      @scalz is correct. Details are in the doxygen documentation for usage. Link is on the GitHub readme. Look under the signing module there.

      Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

      R 1 Reply Last reply
      1
      • AnticimexA Anticimex

        @Rolo6442u
        @scalz is correct. Details are in the doxygen documentation for usage. Link is on the GitHub readme. Look under the signing module there.

        R Offline
        R Offline
        Rolo6442u
        wrote on last edited by
        #12

        @Anticimex
        @scalz
        Thanks, I got it working. By setting it to "soft" this sketch writes all key's to eeprom and will not look for a hardware siging module. The RFM69 uses the EAS key for encryption. I defined my own key again in the sketch.
        Nice solution !

        AnticimexA 1 Reply Last reply
        1
        • R Rolo6442u

          @Anticimex
          @scalz
          Thanks, I got it working. By setting it to "soft" this sketch writes all key's to eeprom and will not look for a hardware siging module. The RFM69 uses the EAS key for encryption. I defined my own key again in the sketch.
          Nice solution !

          AnticimexA Offline
          AnticimexA Offline
          Anticimex
          Contest Winner
          wrote on last edited by
          #13

          @Rolo6442u precisely. Glad to hear that the docs are helping :) and thanks!

          Do you feel secure today? No? Start requiring some signatures and feel better tomorrow ;)

          1 Reply Last reply
          0
          • pascalgauthierP Offline
            pascalgauthierP Offline
            pascalgauthier
            wrote on last edited by
            #14

            How can i call the process() inside a while in the loop() ?

            Thanks

            nielsokkerN 1 Reply Last reply
            0
            • pascalgauthierP pascalgauthier

              How can i call the process() inside a while in the loop() ?

              Thanks

              nielsokkerN Offline
              nielsokkerN Offline
              nielsokker
              wrote on last edited by
              #15

              @pascalgauthier

              I think the function "wait()" might be useful. It is like a sleep, but now it calls "process()"

              pascalgauthierP 1 Reply Last reply
              0
              • nielsokkerN nielsokker

                @pascalgauthier

                I think the function "wait()" might be useful. It is like a sleep, but now it calls "process()"

                pascalgauthierP Offline
                pascalgauthierP Offline
                pascalgauthier
                wrote on last edited by
                #16

                @nielsokker said:

                @pascalgauthier

                I think the function "wait()" might be useful. It is like a sleep, but now it calls "process()"

                I was thinking of using it with wait(0) but I was wondering if there was any way to call the process directly.

                nielsokkerN 1 Reply Last reply
                0
                • pascalgauthierP pascalgauthier

                  @nielsokker said:

                  @pascalgauthier

                  I think the function "wait()" might be useful. It is like a sleep, but now it calls "process()"

                  I was thinking of using it with wait(0) but I was wondering if there was any way to call the process directly.

                  nielsokkerN Offline
                  nielsokkerN Offline
                  nielsokker
                  wrote on last edited by
                  #17

                  @pascalgauthier

                  I'm not sure. I think the developers will know.

                  1 Reply Last reply
                  0
                  • scalzS Offline
                    scalzS Offline
                    scalz
                    Hardware Contributor
                    wrote on last edited by
                    #18

                    @pascalgauthier why do you need to call process ? It's already done internally by the lib. Or is it for inside some longtime loop? you still can use process but now it's _process()
                    Wait is not the same as sleep.
                    Wait : wait for a time and call _process
                    sleep: does not call _process. it sleeps. for a time if set

                    pascalgauthierP 1 Reply Last reply
                    0
                    • scalzS scalz

                      @pascalgauthier why do you need to call process ? It's already done internally by the lib. Or is it for inside some longtime loop? you still can use process but now it's _process()
                      Wait is not the same as sleep.
                      Wait : wait for a time and call _process
                      sleep: does not call _process. it sleeps. for a time if set

                      pascalgauthierP Offline
                      pascalgauthierP Offline
                      pascalgauthier
                      wrote on last edited by
                      #19

                      @scalz
                      Because i have while() that increment motion detected in a 30sec timeframe. And i would like to be sure that i'm not missing any cmd from the gateway. Do i need to define any additional library to use the _process() ?

                      AWIA 1 Reply Last reply
                      0
                      • pascalgauthierP pascalgauthier

                        @scalz
                        Because i have while() that increment motion detected in a 30sec timeframe. And i would like to be sure that i'm not missing any cmd from the gateway. Do i need to define any additional library to use the _process() ?

                        AWIA Offline
                        AWIA Offline
                        AWI
                        Hero Member
                        wrote on last edited by
                        #20

                        @pascalgauthier I would recommend making your while loop non-blocking i.s.o. hacking into a MySensors function.

                        1 Reply Last reply
                        1
                        • scalzS Offline
                          scalzS Offline
                          scalz
                          Hardware Contributor
                          wrote on last edited by
                          #21

                          @pascalgauthier
                          yes it's better non blocking. for non blocking it's better to use "if" like. for beginning, I advise you to look at "blink without delay" concept. then learning a bit how a state machine works etc...could be useful to you. but it's a bit more advanced, or not..

                          pascalgauthierP 1 Reply Last reply
                          0
                          • scalzS scalz

                            @pascalgauthier
                            yes it's better non blocking. for non blocking it's better to use "if" like. for beginning, I advise you to look at "blink without delay" concept. then learning a bit how a state machine works etc...could be useful to you. but it's a bit more advanced, or not..

                            pascalgauthierP Offline
                            pascalgauthierP Offline
                            pascalgauthier
                            wrote on last edited by
                            #22

                            @scalz @AWI

                            Thanks for your help ! :)

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

                              Little bit confused. reading through the release notes...

                              Deprecated variables: V_DIMMER (use V_PERCENTAGE), V_HEATER (use V_HVAC_FLOW_STATE), V_LIGHT (use V_STATUS)
                              

                              Now back to the API page for 2.0...

                              S_DIMMER	4	Dimmable device of some kind	V_STATUS (on/off), V_DIMMER (dimmer level 0-100), V_WATT
                              

                              WHICH ONE TRUST?!

                              YveauxY 1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                moskovskiy82
                                wrote on last edited by
                                #24

                                And if my loop statement consists only of

                                void loop() 
                                { gw.process(); }
                                

                                Rewrite like
                                void loop() { }

                                or exclude loop completely?

                                YveauxY 1 Reply Last reply
                                0
                                • M moskovskiy82

                                  And if my loop statement consists only of

                                  void loop() 
                                  { gw.process(); }
                                  

                                  Rewrite like
                                  void loop() { }

                                  or exclude loop completely?

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

                                  @moskovskiy82 said:

                                  Rewrite like
                                  void loop() { }

                                  That's correct

                                  http://yveaux.blogspot.nl

                                  1 Reply Last reply
                                  0
                                  • M moskovskiy82

                                    Little bit confused. reading through the release notes...

                                    Deprecated variables: V_DIMMER (use V_PERCENTAGE), V_HEATER (use V_HVAC_FLOW_STATE), V_LIGHT (use V_STATUS)
                                    

                                    Now back to the API page for 2.0...

                                    S_DIMMER	4	Dimmable device of some kind	V_STATUS (on/off), V_DIMMER (dimmer level 0-100), V_WATT
                                    

                                    WHICH ONE TRUST?!

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

                                    @moskovskiy82 said:

                                    WHICH ONE TRUST?!

                                    The release notes (as I added this statement ;-) )

                                    http://yveaux.blogspot.nl

                                    1 Reply Last reply
                                    0
                                    • Maurizio ColluM Offline
                                      Maurizio ColluM Offline
                                      Maurizio Collu
                                      wrote on last edited by
                                      #27

                                      Dear all, I'm a bit lost.
                                      I upgraded the library in Arduino to 2.0.0 and now I am having big problems.

                                      I downloaded the sketch for the relay from the MySensors website:
                                      https://www.mysensors.org/build/relay
                                      but I suppose this is still for 1.5

                                      I tried to modify the sketch as suggested - I do not receive any compiling error, but the skectch simply does not do anything. If I use the "monitor" in Arduino IDE, I do not see anything 0_1469262004446_RelayActuator2.ino

                                      There must be something fundamentally wrong in my code, can anyone help?

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

                                        Dear all, I'm a bit lost.
                                        I upgraded the library in Arduino to 2.0.0 and now I am having big problems.

                                        I downloaded the sketch for the relay from the MySensors website:
                                        https://www.mysensors.org/build/relay
                                        but I suppose this is still for 1.5

                                        I tried to modify the sketch as suggested - I do not receive any compiling error, but the skectch simply does not do anything. If I use the "monitor" in Arduino IDE, I do not see anything 0_1469262004446_RelayActuator2.ino

                                        There must be something fundamentally wrong in my code, can anyone help?

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

                                        @Maurizio-Collu the examples for 2.0 are included in the library. They can be opened directly fromthe Examples menu in the Arduino IDE. It is also possible to fetch the examples from github, see https://github.com/mysensors/MySensors/tree/development/examples/RelayActuator For the relay example.

                                        Maurizio ColluM 1 Reply Last reply
                                        0
                                        • Maurizio ColluM Maurizio Collu

                                          Dear all, I'm a bit lost.
                                          I upgraded the library in Arduino to 2.0.0 and now I am having big problems.

                                          I downloaded the sketch for the relay from the MySensors website:
                                          https://www.mysensors.org/build/relay
                                          but I suppose this is still for 1.5

                                          I tried to modify the sketch as suggested - I do not receive any compiling error, but the skectch simply does not do anything. If I use the "monitor" in Arduino IDE, I do not see anything 0_1469262004446_RelayActuator2.ino

                                          There must be something fundamentally wrong in my code, can anyone help?

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

                                          @Maurizio-Collu

                                          You have a few mistakes in your sketch, Download the V2 sketch that @mfalkvidd has pointed you to and compare the two side by side. you will soon see where you have gone wrong. don't forget you will need to update your gateway to V2 as well, a version 1.5 gateway will not connect with a version 2 node.

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


                                          10

                                          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