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. 💬 MySensors Library - v2.x

💬 MySensors Library - v2.x

Scheduled Pinned Locked Moved Announcements
38 Posts 15 Posters 8.0k Views 12 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.
  • mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by mfalkvidd
    #2

    As noticied by @AWI in https://forum.mysensors.org/topic/4612/where-does-mysensor-store-in-eeprom/ there are not 256 bytes to play with on an AtMega328.

    Also, it seems like the amount gets smaller for every version of MySensors. And the position is changed. So using saveState(20) on one MySensors version and loadState(20) on another version will result in the "wrong" byte being read back.

    Can we handle this in a nice way? Preferably without limiting the use to 512 bytes, since some mcus have more. Should macros be provided to check the maximum size? Should we add a pragma compile warning if saveState is used with a too large address?

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

      I've had some thought of letting the user-part of the eeprom grow from the end of the EEPROM. This would allow user storage to be unaffected when we add more internal stuff.

      Not sure how this would be done with different sizes of eeprom in mind.

      mfalkviddM 1 Reply Last reply
      0
      • hekH hek

        I've had some thought of letting the user-part of the eeprom grow from the end of the EEPROM. This would allow user storage to be unaffected when we add more internal stuff.

        Not sure how this would be done with different sizes of eeprom in mind.

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

        @hek That would at least keep the addresses same between versions, as long as the address is within the "free" space of the eeprom. (except that it would break compatibility one "final" time :))

        save/readState should then check the address at runtime and make sure it doesn't overwrite MySensors' own data. Adding a compile-time warning is possible as well, but won't detect if the sketch developer uses a non-static variable for the address.

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

          @mfalkvidd said:

          would break compatibility one "final" time

          Yep.

          Allowing more that the 256 bytes we do today would absolutely complicate things.

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

            Not bad, I even did an issue back then... ;)

            https://github.com/mysensors/MySensors/issues/379

            1 Reply Last reply
            3
            • cimba007C Offline
              cimba007C Offline
              cimba007
              wrote on last edited by
              #7

              @hek: Could you change the part with "Here is a quick summary of the config options available. NOTE: This table will be updated with more information shortly" to be collapsed at the beginning and a + to exapand? Currently this section takes a lot of space and as it is essential for beginners might frighten new users ;-)

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

                We talked about splitting up this page in more use-case based pages.

                1 Reply Last reply
                1
                • cimba007C Offline
                  cimba007C Offline
                  cimba007
                  wrote on last edited by
                  #9

                  Nice to hear, keep the good work up!

                  1 Reply Last reply
                  0
                  • ileneken3I Offline
                    ileneken3I Offline
                    ileneken3
                    wrote on last edited by
                    #10

                    In the "Create Repeating Nodes" section, could you please change:

                    #define MY_REPEATER_NODE

                    to

                    #define MY_REPEATER_FEATURE

                    I wasted a lot of time trying to figure out why my repeater node wasn't working.

                    Thanks for a great product!

                    hekH 1 Reply Last reply
                    0
                    • ileneken3I ileneken3

                      In the "Create Repeating Nodes" section, could you please change:

                      #define MY_REPEATER_NODE

                      to

                      #define MY_REPEATER_FEATURE

                      I wasted a lot of time trying to figure out why my repeater node wasn't working.

                      Thanks for a great product!

                      hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #11

                      @ileneken3

                      Thanks for reporting, updated.

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

                        (long unrelated discussion moved to https://forum.mysensors.org/topic/5079/the-basics-of-mysensors/ )

                        1 Reply Last reply
                        1
                        • R Offline
                          R Offline
                          Reza
                          wrote on last edited by Reza
                          #13

                          what is difference between MY_PARENT_NODE_ID and MY_PARENT_NODE_IS_STATIC ?
                          when i add "MY PARENT NODE ID" to sketch of end node , so end node dont connect to controller directly ? and dont connect to other repeaters node? even when parent node is fail ?

                          edit : i test this features but dont work ! i want the my end node connect to controller with for example parent with node id 3 ! node 3 is a repeater.... but every time (with move and reset) end node choose a new parent...

                          1 Reply Last reply
                          0
                          • U Offline
                            U Offline
                            user2684
                            Contest Winner
                            wrote on last edited by
                            #14

                            Hi, I could not find a setCommand() message Api to chose between SET or REQ, is this done on purpose? I think it may be legitimate for a node to send a REQ command instead of the default SET.
                            Looks like mSetCommand(msg, C_SET) works but I'd avoid using not standard API calls.
                            Thanks!

                            martinhjelmareM 1 Reply Last reply
                            0
                            • U user2684

                              Hi, I could not find a setCommand() message Api to chose between SET or REQ, is this done on purpose? I think it may be legitimate for a node to send a REQ command instead of the default SET.
                              Looks like mSetCommand(msg, C_SET) works but I'd avoid using not standard API calls.
                              Thanks!

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

                              @user2684

                              void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);
                              

                              See "Requesting data" here:
                              https://www.mysensors.org/download/sensor_api_20

                              U 1 Reply Last reply
                              1
                              • martinhjelmareM martinhjelmare

                                @user2684

                                void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);
                                

                                See "Requesting data" here:
                                https://www.mysensors.org/download/sensor_api_20

                                U Offline
                                U Offline
                                user2684
                                Contest Winner
                                wrote on last edited by
                                #16

                                @martinhjelmare Thanks, I've completely missed it expecting it somehow in the message constructor section, my bad! Thanks again

                                1 Reply Last reply
                                2
                                • T Offline
                                  T Offline
                                  tismoj
                                  wrote on last edited by
                                  #17

                                  Hi I just finished configuring a site map having the sample node (S_DOOR) code above as the only thing and I noticed that it only updates once (only at every restart) to the Paper UI Control, The Basic UI, and to the Classic UI, I've already inserted a prinf to check if it would print to the serial monitor, and to also see if the value is changing on every loop and it is changing.

                                  But when I looked at the Karaf Console, the send() doestn't seem to be reflecting there:
                                  18:25:41.084 [WARN ] [ors.internal.gateway.MySensorsGateway] - Presented child is alredy present in gateway
                                  18:25:41.230 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13907396 TSF:MSG:READ,1-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
                                  18:25:41.385 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 1;255;3;0;6;0
                                  18:25:41.497 [DEBUG] [ors.internal.gateway.MySensorsGateway] - I_CONFIG request received from M, answering: (is imperial?)false
                                  18:25:41.636 [DEBUG] [orsAbstractConnection$MySensorsWriter] - Sending to MySensors: 1;255;3;0;6;M
                                  18:25:41.812 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909293 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=6,pt=0,l=1,sg=0,ft=0,st=NACK:M
                                  18:25:41.985 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909301 TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
                                  18:25:42.141 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909309 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
                                  18:25:42.313 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13909316 TSF:MSG:READ,1-1-0,s=1,c=1,t=16,pt=1,l=1,sg=0:0
                                  18:25:42.480 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 1;1;1;0;16;0
                                  18:25:42.597 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Node 1 found in gateway
                                  18:25:42.734 [DEBUG] [ors.internal.gateway.MySensorsGateway] - Child 1 found in node 1
                                  18:25:42.846 [DEBUG] [sensors.handler.MySensorsThingHandler] - Updating channel: tripped(V_TRIPPED) value to: CLOSED
                                  18:25:43.009 [DEBUG] [sensors.handler.MySensorsThingHandler] - Setting last update for node/child 1/1 to 2018-05-31T18:25:42.000+0800
                                  18:25:43.034 [INFO ] [smarthome.event.ItemStateChangedEvent] - SampleDoorSensor01_LastUpdate changed from 2018-05-31T18:25:22.000+0800 to 2018-05-31T18:25:42.000+0800
                                  18:25:43.320 [INFO ] [smarthome.event.ItemStateChangedEvent] - mysensors_door_9bb51413_door_1_1_lastupdate changed from 2018-05-31T18:25:22.000+0800 to 2018-05-31T18:25:42.000+0800
                                  18:27:12.393 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999913 TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                                  18:27:12.518 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999921 TSF:MSG:BC
                                  18:27:12.600 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999923 TSF:MSG:FPAR REQ,ID=1
                                  18:27:12.745 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999927 TSF:PNG:SEND,TO=0
                                  18:27:12.886 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999931 TSF:CKU:OK
                                  18:27:13.029 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;13999934 TSF:MSG:GWL OK
                                  18:27:13.236 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14000772 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                                  18:27:14.417 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14001947 TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
                                  18:27:14.584 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14001954 TSF:MSG:PINGED,ID=1,HP=1
                                  18:27:14.728 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14001993 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
                                  18:28:40.531 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088079 TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                                  18:28:40.705 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088085 TSF:MSG:BC
                                  18:28:40.831 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088088 TSF:MSG:FPAR REQ,ID=1
                                  18:28:40.966 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088092 TSF:PNG:SEND,TO=0
                                  18:28:41.096 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088095 TSF:CKU:OK
                                  18:28:41.220 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14088098 TSF:MSG:GWL OK
                                  18:28:41.489 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14089036 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                                  18:28:42.576 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14090113 TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
                                  18:28:42.745 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14090119 TSF:MSG:PINGED,ID=1,HP=1
                                  18:28:42.899 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14090159 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
                                  18:30:08.695 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176243 TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
                                  18:30:08.796 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176250 TSF:MSG:BC
                                  18:30:08.911 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176253 TSF:MSG:FPAR REQ,ID=1
                                  18:30:09.050 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176257 TSF:PNG:SEND,TO=0
                                  18:30:09.183 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176261 TSF:CKU:OK
                                  18:30:09.315 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176264 TSF:MSG:GWL OK
                                  18:30:09.464 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14176282 TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
                                  18:30:10.698 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14178277 TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
                                  18:30:10.865 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14178284 TSF:MSG:PINGED,ID=1,HP=1
                                  18:30:11.007 [DEBUG] [orsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;14178324 !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1

                                  1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    tismoj
                                    wrote on last edited by
                                    #18

                                    Please disregard my prev inquiry, I was able to find a solution that same day, but it required me to modify MySensors library (inside RF24_spiMultiByteTransfer function) and also exposed one of the functions in RF24.h to get it to work.

                                    1 Reply Last reply
                                    1
                                    • A Offline
                                      A Offline
                                      APL2017
                                      wrote on last edited by
                                      #19

                                      Please confirm that to have node configured as repeater only, it is sufficient to have the following code written:

                                      #define MY_DEBUG
                                      #define MY_RADIO_NRF24
                                      #include <SPI.h>
                                      #include <MySensors.h>
                                      #define MY_REPEATER_FEATURE

                                      void setup()
                                      {
                                      }
                                      void presentation() {
                                      }
                                      void loop()
                                      {
                                      }

                                      mfalkviddM 1 Reply Last reply
                                      0
                                      • A APL2017

                                        Please confirm that to have node configured as repeater only, it is sufficient to have the following code written:

                                        #define MY_DEBUG
                                        #define MY_RADIO_NRF24
                                        #include <SPI.h>
                                        #include <MySensors.h>
                                        #define MY_REPEATER_FEATURE

                                        void setup()
                                        {
                                        }
                                        void presentation() {
                                        }
                                        void loop()
                                        {
                                        }

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

                                        @apl2017 I don't think you need to include SPI.h
                                        #define MY_REPEATER_FEATURE (and all other MySensors defines) must be placed before including MySensors.h

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          APL2017
                                          wrote on last edited by
                                          #21

                                          Thank you MFalkvidd. I was wondering why many examples in your library have SPI.h library called while have no SPI communication required, it sounds like it can be removed from them as well..
                                          Also, do I need to place CHILD MySensors defines before including MySensors.h? It is not how many examples are done, please clarify.

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


                                          14

                                          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