Message Send Returns False, but message send


  • Hardware Contributor

    I tried to make a reliable send process, so I loop the send message while the send does not return true, with a little wait in between! This works great and I'm able to have good send every time! The problem is that I get several false returns from the send, but if I sbscribe to the MQTT topic I can see that that the message are published even when the function returns false.

    What can be the cause?
    Shouldn't the return be only to the hardware communication success?

    I'm sending the messages with ack requests, but I'm only testing the send function, not waiting for the ack response!

    Thank you


  • Mod

    Did you check in node debug if you see any NACKs?


  • Hardware Contributor

    I'm sure it appears NACK, but to be sure I'll try again when I get home and post back here the results!


  • Mod

    If you see NACKs on node of course you will get a false from send and it is plausible the gateway gets the message correctly. In your case could be low signal on node side or a power issue on the gateway radio but you need to have several nodes to make a comparison.


  • Hardware Contributor

    I have 3 nodes at the moment... All of them with the same problem! The gateway is a sensebender gateway, it can be a power issue on the gateway... It uses a mobile charger... And it's not a official one... It can have problems... Any ideias on how can I test if the problem is on the charger? Or the only way is trial and error?

    Thank you


  • Mod

    Did you put a capacitor on the radio module?


  • Hardware Contributor

    Yes I did! On the nodes... On the gateway, no... The sensebender allready has it... Does it not?

    This is my nodes https://www.openhardware.io/view/83/Smart-Light-Switch-220v

    Thank you


  • Mod

    There should be one but since you are getting NACKs on all nodes I'd try adding an extra one to radio module. You could try to swap radios between node and gateway and see if problem is the same. Are you running max power for nrf24?


  • Hardware Contributor

    I did try to replace the radios, but I didn't see any improvements. For example... I send the messages in this while loop:

    #define REPEAT_DELAY 50
    
    void messageRepeat(MyMessage &message, bool ack = true) {
      int repeat = 1;
      int repeats = 10;
      int repeatdelay = 0;
      boolean sendOK = false;
    
      SerialPrint("Sending message of child ");
      SerialPrintln(message.sensor);
    
      while ((sendOK == false) and (repeat < repeats)) {
        if (send(message, ack)) {
          sendOK = true;
          SerialPrint("Send OK");
        } else {
          sendOK = false;
          SerialPrint("Send ERROR ");
          SerialPrint(repeat);
          repeatdelay += REPEAT_DELAY;
        }
    
        if (ack == true) {
          SerialPrintln(" With ack ");
        } else {
          SerialPrintln(" Without ack ");
        }
    
        repeat++;
        wait(repeatdelay);
      }
    }
    

    It tries to send a message and incresses the timer of the wait on 50ms on every try
    (idea adapted from the @zzz-teo code on https://forum.mysensors.org/topic/7786/about-ack/2 at the moment I don't need to process the ack response, so I adapted it to work only with the send)

    Sometimes I can make it go on the fist try, sometimes it takes 5 tries, and sometimes it takes the max 10. But almost every times I can see the messages appearing in the MQTT topic. I made this topic code from information's on https://forum.mysensors.org/topic/3346/discussion-reliable-delivery/19 of @mfalkvidd and @hek

    At the moment I didn't change the power of the NF24 radios. Do you think that it could help to try and bost the power? Who can I do this?

    I'm using after the HLK-PM01 2 capacitors, a 0.1 uF Capacitor and a 100uF Capacitor, and on my radios a capacitor after the 3v regulator, a 4.7uF Capacitor, I can try to add a extra one or a bigger one to the radio, don't know if it could help, any ideas on the capacity?

    Thank You


  • Hardware Contributor

    I ordered a new power supply to my sensebender gateway try to rule out power problems, this one is 5v 2.5A and I know that they are good because I use them on my raspberry pi's.


  • Plugin Developer

    @Soloam that's some great code, mind if I copy it for my nodes?

    // Ah, wait, that's blocking code isn't it. Not technically, with the wait() function. But it would stop the rest of my node from running until the process is complete?


Log in to reply
 

Suggested Topics

  • 3
  • 6
  • 5
  • 6

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts