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.
  • 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 Online
            mfalkviddM Online
            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 Online
                            mfalkviddM Online
                            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
                              • A APL2017

                                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 Online
                                mfalkviddM Online
                                mfalkvidd
                                Mod
                                wrote on last edited by
                                #22

                                Which examples are you referring to? I am not able to find any occurrences of including SPI.h in the examples:

                                Micke @ Quasi Arduino/libraries/MySensors HEAD
                                $ grep -ir 'SPI\.h' examples/ | wc -l
                                0
                                

                                The child ids are not used by the MySensors library. They are only used in the sketch, so there is no need to define them before including the library.

                                A 1 Reply Last reply
                                0
                                • mfalkviddM mfalkvidd

                                  Which examples are you referring to? I am not able to find any occurrences of including SPI.h in the examples:

                                  Micke @ Quasi Arduino/libraries/MySensors HEAD
                                  $ grep -ir 'SPI\.h' examples/ | wc -l
                                  0
                                  

                                  The child ids are not used by the MySensors library. They are only used in the sketch, so there is no need to define them before including the library.

                                  A Offline
                                  A Offline
                                  APL2017
                                  wrote on last edited by APL2017
                                  #23

                                  @mfalkvidd I am referring to the following code example on Build page of MySensors site: Distance, Door/Window/Button, GPS Sensor, IR Sender/Receiver, Parking Sensor, Servo, Temperature, UV

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • A APL2017

                                    @mfalkvidd I am referring to the following code example on Build page of MySensors site: Distance, Door/Window/Button, GPS Sensor, IR Sender/Receiver, Parking Sensor, Servo, Temperature, UV

                                    mfalkviddM Online
                                    mfalkviddM Online
                                    mfalkvidd
                                    Mod
                                    wrote on last edited by
                                    #24

                                    Thanks for clarifying @apl2017
                                    Those examples use external libraries and are therefore placed outside the main MySensors git repo. Some of the external libraries might need SPI. I doubt most of them do though, especially button and servo.

                                    I'm not sure how to verify that in an efficient way though. We woldn't want to break the examples.

                                    A 1 Reply Last reply
                                    0
                                    • mfalkviddM mfalkvidd

                                      Thanks for clarifying @apl2017
                                      Those examples use external libraries and are therefore placed outside the main MySensors git repo. Some of the external libraries might need SPI. I doubt most of them do though, especially button and servo.

                                      I'm not sure how to verify that in an efficient way though. We woldn't want to break the examples.

                                      A Offline
                                      A Offline
                                      APL2017
                                      wrote on last edited by
                                      #25

                                      @mfalkvidd One of the efficient ways to do it (if doable) is to replace site examples with links to main MySensors git repo. I noticed that some examples on site are incorporated into the pages, some are done as links already. I realize thou that examples in git repo could be different. The goal of git repo examples, as I see it, is to show technology capabilities covering majority of typical applications, while on website you may also publish some real exotic examples, such as sky stars, or whole house fan.

                                      Please don't get me wrong, I love MySensors and very pleased with technology, documentation and support. This is just in my nature to attempt to clarify and optimize whatever I can. My colleagues at work hate me for this...

                                      mfalkviddM 1 Reply Last reply
                                      0
                                      • A APL2017

                                        @mfalkvidd One of the efficient ways to do it (if doable) is to replace site examples with links to main MySensors git repo. I noticed that some examples on site are incorporated into the pages, some are done as links already. I realize thou that examples in git repo could be different. The goal of git repo examples, as I see it, is to show technology capabilities covering majority of typical applications, while on website you may also publish some real exotic examples, such as sky stars, or whole house fan.

                                        Please don't get me wrong, I love MySensors and very pleased with technology, documentation and support. This is just in my nature to attempt to clarify and optimize whatever I can. My colleagues at work hate me for this...

                                        mfalkviddM Online
                                        mfalkviddM Online
                                        mfalkvidd
                                        Mod
                                        wrote on last edited by
                                        #26

                                        @apl2017 the reason those examples are separate is that they require external libraries to be installed. So replacing them would not work.

                                        1 Reply Last reply
                                        0
                                        • mfalkviddM Online
                                          mfalkviddM Online
                                          mfalkvidd
                                          Mod
                                          wrote on last edited by
                                          #27

                                          Maybe I should expand on that.

                                          MySensors has two git repos:
                                          The MySensors library (https://github.com/mysensors/MySensors ) which contains the library and all examples that do not require external dependencies.
                                          https://github.com/mysensors/MySensorsArduinoExamples which contains examples that require external dependencies.

                                          The MySensors library can be installed from the Library Manager in the Arduino IDE. Installing the MySensors library won't break any of your existing non-MySensors sketches, or sketches from other libraries. All examples included in the MySensors library will work without installing other libraries.

                                          Installing MySensorsArduinoExamples (which must be done manually) can cause warnings or compile errors to your existing non-MySensors sketches. Example sketches in this repo requires the libraries included in the MySensorsArduinoExamples repo. In some cases, the libraries included in MySensorsArduinoExamples are incompatible with upstream versions of the same library, which will cause problems.

                                          Examples from both repos, and examples from openhardware.io, are listed on https://www.mysensors.org/build
                                          The examples that come from the git repos are linked, so the build page always displays the latest master version from github.

                                          The pages on https://www.mysensors.org/build that require external libraries have a note about requiring external libraries, and instructions on how to install them.

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


                                          25

                                          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