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. 1.4 Beta

1.4 Beta

Scheduled Pinned Locked Moved Announcements
1.4betahelp
129 Posts 18 Posters 87.1k Views 4 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.
  • DammeD Damme

    I've tried the lib for a while now and found the following:

    Then using ack=1 the returned message is exacly the one I sent. No way of knowing if its a request or an ACK.

    example:
    Client sends
    3;255;3;6;0 (Give me configuration 0 (btw, why not leave config as a byte 0-255 instead of hardcoing it? I could have plenty of uses for configuration-values.)
    Gateway responds: 3;255;3;6;M and requests ack
    client sends
    3;255;3;6;M
    my software tried to lookup config id 'M' (Not a big deal for letter, but what if its a number?)
    maybe ACK should be some sort of incremental number in return in special message type. I dont really know what is best.
    It would be great if GW resends the messsage automatically a couple of times (configurable) if ACK = 1.

    I've also noticed during DEBUG enabled that the message gets overwritten by old one, i.e.

    send: 3-3-0-0 s=255,c=0,t=18,pt=0,l=15,st=fail:1.4b1 (18848a2)
    send: 3-3-0-0 s=255,c=3,t=11,pt=0,l=4,st=ok:test1 (18848a2)
    send: 3-3-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:2.0t1 (18848a2)
    (message 2: test1, message 3: 2.0)

    Edit; One more thing
    Do I really need one gw.process(); before each gw.send(..); in the loop? I seam to loose messages if I dont do like that.

    void loop()
    {
    delay(dht.getMinimumSamplingPeriod());

    gw.process();
    float temperature = dht.getTemperature();
    gw.send(msgTemp.set(temperature, 1));

    gw.process();
    float humidity = dht.getHumidity();
    gw.send(msgHum.set(humidity, 1));

    // gw.sleep(SLEEP_TIME); //Seems to break recieing message, loosing ~75%

    }

    DammeD Offline
    DammeD Offline
    Damme
    Code Contributor
    wrote on last edited by
    #21

    @Damme said:

    // gw.sleep(SLEEP_TIME); //Seems to break recieing message, loosing ~75%

    me just dumb here, delay(SLEEP_TIME); works. gw.sleep puts radio in sleep I guess.

    hekH 1 Reply Last reply
    1
    • DammeD Damme

      @Damme said:

      // gw.sleep(SLEEP_TIME); //Seems to break recieing message, loosing ~75%

      me just dumb here, delay(SLEEP_TIME); works. gw.sleep puts radio in sleep I guess.

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

      @Damme said:

      me just dumb here, delay(SLEEP_TIME); works. gw.sleep puts radio in sleep I guess.

      gw.sleep() puts both Arduino and radio to sleep.

      1 Reply Last reply
      0
      • YveauxY Yveaux

        @Damme Other wireless protocols usually have a counter which is increased with each message. Returning the counter as an ack would be sufficient to correlate the ack and the original message.
        Returning the whole message seems like overkill indeed...

        The send-methods could e.g. return the Id counter of the message sent, and an app waiting for an ack on that message should check for this value in any ack received (using some timeout)

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

        @Yveaux said:

        The send-methods could e.g. return the Id counter of the message sent, and an app waiting for an ack on that message should check for this value in any ack received (using some timeout)

        That mean you might have to rememeber the original message. The idea is to have all the information necessary in the callback.
        In my example sketches (e.g. RelayActuator) the ack message actually changes the relay status when the ack comes back from gateway. If not full message came in you would have to keep buffers with sent messages and start matching counter-values. Much more complicated.

        But a message counter will probably be necessary if/when we start encrypting messages to prohibit replay attacks.

        @Damme
        I actually thought about having a bit in the message header which says if the message is an ack or not. With that implemented you would just call a msg.isAck() to determine if the incoming message is an ack message. Would that be ok?

        You shouldn't need to call gw.process() after each send. It is only necessary in the loop() section if you expect incoming messages or have enabled repeater mode.

        I don't understand what you mean with messages getting overwritten with DEBUG enabled. Could you explain it a bit more (with an example?).

        YveauxY DammeD 2 Replies Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by hek
          #24

          @Yveaux

          To pick up the discussions about existence or not of getTemp().
          A better solution would probably be to create a MySensorsATMega328-subclass of the library which contains AtMega specific stuff such as sleep() and potentially getTemp().
          This class should also implement the EEPROM specifics.

          YveauxY 1 Reply Last reply
          0
          • hekH hek

            @Yveaux said:

            The send-methods could e.g. return the Id counter of the message sent, and an app waiting for an ack on that message should check for this value in any ack received (using some timeout)

            That mean you might have to rememeber the original message. The idea is to have all the information necessary in the callback.
            In my example sketches (e.g. RelayActuator) the ack message actually changes the relay status when the ack comes back from gateway. If not full message came in you would have to keep buffers with sent messages and start matching counter-values. Much more complicated.

            But a message counter will probably be necessary if/when we start encrypting messages to prohibit replay attacks.

            @Damme
            I actually thought about having a bit in the message header which says if the message is an ack or not. With that implemented you would just call a msg.isAck() to determine if the incoming message is an ack message. Would that be ok?

            You shouldn't need to call gw.process() after each send. It is only necessary in the loop() section if you expect incoming messages or have enabled repeater mode.

            I don't understand what you mean with messages getting overwritten with DEBUG enabled. Could you explain it a bit more (with an example?).

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

            @hek said:

            That mean you might have to rememeber the original message.

            You have to remember it anyway when you regard the message as lost after some time without an ack and you decide to send the message again. Only for a simple sensor node which sends a sensor value with ack, waits for an ack reply and then continues with the next sensor value this wouldn't be necessary. When a single node has multiple messages with ack 'in flight', you definately need message buffering.
            This is independent from the ack message format IMHO.

            I also think message buffering and retrying, when implemented, should be part of the MySensors library.
            This improves realiability even more than with the NRF24 ack's enabled and avoids putting the retry-burden on the clients of the library.

            http://yveaux.blogspot.nl

            1 Reply Last reply
            0
            • hekH hek

              @Yveaux said:

              The send-methods could e.g. return the Id counter of the message sent, and an app waiting for an ack on that message should check for this value in any ack received (using some timeout)

              That mean you might have to rememeber the original message. The idea is to have all the information necessary in the callback.
              In my example sketches (e.g. RelayActuator) the ack message actually changes the relay status when the ack comes back from gateway. If not full message came in you would have to keep buffers with sent messages and start matching counter-values. Much more complicated.

              But a message counter will probably be necessary if/when we start encrypting messages to prohibit replay attacks.

              @Damme
              I actually thought about having a bit in the message header which says if the message is an ack or not. With that implemented you would just call a msg.isAck() to determine if the incoming message is an ack message. Would that be ok?

              You shouldn't need to call gw.process() after each send. It is only necessary in the loop() section if you expect incoming messages or have enabled repeater mode.

              I don't understand what you mean with messages getting overwritten with DEBUG enabled. Could you explain it a bit more (with an example?).

              DammeD Offline
              DammeD Offline
              Damme
              Code Contributor
              wrote on last edited by
              #26

              @hek said:

              I don't understand what you mean with messages getting overwritten with DEBUG enabled. Could you explain it a bit more (with an example?).

              here is a serial output from one of my nodes
              repeater started, id 3
              send: 3-3-0-0 s=255,c=0,t=18,pt=0,l=15,st=fail:1.4b1 (18848a2)
              send: 3-3-0-0 s=255,c=3,t=6,pt=1,l=1,st=fail:0
              send: 3-3-0-0 s=255,c=3,t=11,pt=0,l=4,st=fail:test1 (18848a2)
              send: 3-3-0-0 s=255,c=3,t=12,pt=0,l=3,st=fail:2.0t1 (18848a2)
              send: 3-3-0-0 s=0,c=0,t=7,pt=0,l=15,st=fail:1.4b1 (18848a2)
              send: 3-3-0-0 s=1,c=0,t=6,pt=0,l=15,st=fail:1.4b1 (18848a2)
              send: 3-3-0-0 s=2,c=0,t=3,pt=0,l=15,st=fail:1.4b1 (18848a2)
              send: 3-3-255-255 s=255,c=3,t=7,pt=0,l=0,st=fail:1.4b1 (18848a2)

              and the sketch has: gw.sendSketchInfo("test", "2.0");

              yes, I know they all failed, I'm using the microwave oven atm, it kills the channel 76 (usually uses 21 but forgot to change last time, works better for me here..)

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

                @Damme said:

                send: 3-3-0-0 s=255,c=3,t=12,pt=0,l=3,st=fail:2.0t1 (18848a2)

                Ahh.. The strings-payloads don't seem to be terminated correctly.

                1 Reply Last reply
                0
                • hekH hek

                  @Yveaux

                  To pick up the discussions about existence or not of getTemp().
                  A better solution would probably be to create a MySensorsATMega328-subclass of the library which contains AtMega specific stuff such as sleep() and potentially getTemp().
                  This class should also implement the EEPROM specifics.

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

                  @hek said:

                  A better solution would probably be to create a MySensorsATMega328-subclass of the library

                  I wouldn't restrict to the Atmega328. Quite some AVR's have this or simular behaviour and it would be nice to have a single library usable for all (e.g. using #ifdef's if absolutely necessary).
                  Seems like you're trying to move towards board- and cpu-support packages, like Linux does...

                  Another way to tackle it is to create a separate library to read the AVR's internal 'sensors' like the temperature sensor and e.g. the VCC voltage (as I did in https://github.com/Yveaux/arduino_vcc) and another one for persistent storage (EEPROM), and one for power management (sleep). This approach seems to follow the Arduino-way of creating a library for every 'function'.

                  It all depends on whether you think big and target different hardware (MPU) platforms or if you want to stick with the Arduino (or even only the ATmega328). When porting MySensors to the RPi it would be very nice if the MySensors library and examples would directly compile on both platforms.
                  This requires libraries to have a clear interface which doesn't limit portability to one platform or architecture.

                  http://yveaux.blogspot.nl

                  1 Reply Last reply
                  0
                  • DammeD Offline
                    DammeD Offline
                    Damme
                    Code Contributor
                    wrote on last edited by
                    #29

                    Hello

                    I was looking in the nrf24l01 datasheet and found "Setup of Automatic Retransmission"
                    Is this something that mysensors use?

                    YveauxY 1 Reply Last reply
                    0
                    • DammeD Damme

                      Hello

                      I was looking in the nrf24l01 datasheet and found "Setup of Automatic Retransmission"
                      Is this something that mysensors use?

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

                      @Damme at least in the 1.4beta release. I think it's disabled in 1.3

                      http://yveaux.blogspot.nl

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

                        Yep, as @Yveaux says we use it it 1.4.

                        1 Reply Last reply
                        0
                        • L Offline
                          L Offline
                          lodewyk
                          wrote on last edited by
                          #32

                          Hi guys,

                          I just got relays working with but struggling requesting a variable value on Beta 1.4.

                          My set variable commands looks as follow.

                          Switching On - > 1;1;1;0;2;1 (work as expected)
                          Off -> 1;1;1;0;2;0 (work as expected)

                          Request variable for the same relay -> 1;1;2;0;2; (sets the relay to 0 ???)

                          Can someone confirm if my request variable command is correct and if not what should it be?

                          Thanks

                          DammeD hekH YveauxY 3 Replies Last reply
                          0
                          • L lodewyk

                            Hi guys,

                            I just got relays working with but struggling requesting a variable value on Beta 1.4.

                            My set variable commands looks as follow.

                            Switching On - > 1;1;1;0;2;1 (work as expected)
                            Off -> 1;1;1;0;2;0 (work as expected)

                            Request variable for the same relay -> 1;1;2;0;2; (sets the relay to 0 ???)

                            Can someone confirm if my request variable command is correct and if not what should it be?

                            Thanks

                            DammeD Offline
                            DammeD Offline
                            Damme
                            Code Contributor
                            wrote on last edited by Damme
                            #33

                            @lodewyk I use this:
                            void incomingMessage(const MyMessage &msg) {
                            // We only expect one type of message from controller. But we better check anyway.
                            if (msg.type==V_LIGHT) {
                            if (strlen(msg.getString())==0) {
                            gw.send(message.setSensor(msg.sensor).setType(V_LIGHT).set(digitalRead(msg.sensor-1+RELAY_1)?RELAY_ON:RELAY_OFF));
                            } else {
                            digitalWrite(msg.sensor-1+RELAY_1, msg.getBool()?RELAY_ON:RELAY_OFF);
                            gw.saveState(msg.sensor, msg.getBool());
                            }
                            }
                            }

                            (How do i use [code] ?? I start to hate this forum :P)

                            1 Reply Last reply
                            0
                            • L lodewyk

                              Hi guys,

                              I just got relays working with but struggling requesting a variable value on Beta 1.4.

                              My set variable commands looks as follow.

                              Switching On - > 1;1;1;0;2;1 (work as expected)
                              Off -> 1;1;1;0;2;0 (work as expected)

                              Request variable for the same relay -> 1;1;2;0;2; (sets the relay to 0 ???)

                              Can someone confirm if my request variable command is correct and if not what should it be?

                              Thanks

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

                              @lodewyk

                              The relay example does not support requesting state. You must add some code in incomingMessage() to handle incoming request-messages (and reply to them).

                              To reply incoming request-command in incomingMessage for the RelayActuator-example do something like this (note I have not compiled/tested this)

                              if (mGetCommand(msg) == C_REQ) {
                                   mSetCommand(msg, C_SET);
                                   msg.setDestination(msg.getSender());
                                   msg.set(gw.loadState(msg.getSensor());
                                   gw.send(msg); 
                              } else (
                                  // Do the normal stuff here
                              }
                              
                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                lodewyk
                                wrote on last edited by
                                #35

                                @DAMME and @HEK

                                Thanks , very helpful.

                                I got so occupied with the commands and never thought about the sensor code.

                                Thanks

                                1 Reply Last reply
                                0
                                • L Offline
                                  L Offline
                                  lodewyk
                                  wrote on last edited by
                                  #36
                                  This post is deleted!
                                  1 Reply Last reply
                                  0
                                  • L Offline
                                    L Offline
                                    lodewyk
                                    wrote on last edited by
                                    #37
                                    This post is deleted!
                                    1 Reply Last reply
                                    0
                                    • hekH Offline
                                      hekH Offline
                                      hek
                                      Admin
                                      wrote on last edited by
                                      #38

                                      @Damme said:

                                      (How do i use [code] ?? I start to hate this forum :P)

                                      This forum uses markdown. If you need help, press the little questionmark-icon in the compose window. http://daringfireball.net/projects/markdown/syntax

                                      To decorate your codeblock use 4 spaces or one tab character first on each line.

                                      1 Reply Last reply
                                      0
                                      • L lodewyk

                                        Hi guys,

                                        I just got relays working with but struggling requesting a variable value on Beta 1.4.

                                        My set variable commands looks as follow.

                                        Switching On - > 1;1;1;0;2;1 (work as expected)
                                        Off -> 1;1;1;0;2;0 (work as expected)

                                        Request variable for the same relay -> 1;1;2;0;2; (sets the relay to 0 ???)

                                        Can someone confirm if my request variable command is correct and if not what should it be?

                                        Thanks

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

                                        @lodewyk hey man, you've got -2 posts.... How's that possible?

                                        http://yveaux.blogspot.nl

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

                                          Pushed a few new changes/bugfixes. Sorry for the slow progress. Had to wait until we got home and had the chance to do some verification.

                                          • Ack bit in header indicating if message is an ack (see RelayWithButton for an example how to read it out).
                                          • Sleep functions now takes unsigned long. This allows sensor to sleep for than 30 sec ;)
                                          • Corrected string termination

                                          https://github.com/mysensors/Arduino/commits/development

                                          DammeD marceltrapmanM 3 Replies Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          7

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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