RPi ethernet gateway doesn't send messages to the acuator



  • Last week I tinkered my setup together consisting of:

    • Controler: OpenHAB (Dockerized 2.1.0-snapshot) with MySensors binding and Influx persistence addon
    • Gateway: RPi running latest Raspbian with nrf24
    • Sensor: Arduino UNO providing temp/humidity

    All works perfectly and data is visible in OpenHAB / influx. The next step is to lay a foundation so I can send signals from OpenHAB to my sensor. I've added the 'receive()' function to my sensors code which only prints the message type and payload:

    void receive(const MyMessage &message) {
        Serial.print("Message type: ");
        Serial.println(message.type);
    
        String light = message.getString();
        Serial.print("Message payload: ");
        Serial.println(light);
    }
    

    This seems to works as expected as I'm seeing the "Message type" output in my Serial console when I boot the Arduino:

    Starting sensor (RNNNA-, 2.0.0)
    TSM:INIT
    TSM:RADIO:OK
    TSP:ASSIGNID:OK (ID=1)
    TSM:FPAR
    TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
    TSP:MSG:READ 0-0-1 s=255,c=3,t=8,pt=1,l=1,sg=0:0
    TSP:MSG:FPAR RES (ID=0, dist=0)
    TSP:MSG:FPAR (PPAR FOUND)
    TSP:MSG:PAR OK (ID=0, dist=1)
    TSM:FPAR:OK
    TSM:ID
    TSM:CHKID:OK (ID=1)
    TSM:UPL
    TSP:PING:SEND (dest=0)
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=ok:1
    TSP:MSG:READ 0-0-1 s=255,c=3,t=25,pt=1,l=1,sg=0:1
    TSP:MSG:PONG RECV (hops=1)
    TSP:CHKUPL:OK
    TSM:UPL:OK
    TSM:READY
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=ok:0100
    TSP:MSG:SEND 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=ok:2.0.0
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=ok:0
    TSP:MSG:READ 0-0-1 s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    Message type: 15
    Message payload: 
    TSP:MSG:READ 0-0-1 s=255,c=3,t=6,pt=0,l=1,sg=0:I
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=11,pt=0,l=22,sg=0,ft=0,st=ok:TemperatureAndHumidity
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=ok:1.1
    TSP:MSG:SEND 1-1-0-0 s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 1-1-0-0 s=1,c=0,t=6,pt=0,l=0,sg=0,ft=0,st=ok:
    TSP:MSG:SEND 1-1-0-0 s=2,c=0,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
    Request registration...
    TSP:MSG:SEND 1-1-0-0 s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=ok:2
    TSP:MSG:READ 0-0-1 s=255,c=3,t=27,pt=1,l=1,sg=0:1
    Node registration=1
    Init complete, id=1, parent=0, distance=1, registration=1
    TSP:MSG:SEND 1-1-0-0 s=1,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=ok:22.0
    T: 22.00
    TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=ok:59.0
    H: 59.00
    TSP:MSG:SEND 1-1-0-0 s=0,c=1,t=1,pt=7,l=5,sg=0,ft=0,st=ok:60.0
    H: 60.00
    

    However, when I send something (nothing relevant just yet) I'm seeing the following on my gateway (running with the debug flag) while nothing happens on the serial console of my sensor. What am I missing here?

    mysgw: Client 1: 1;2;1;0;2;1
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:1
    mysgw: Client 1:
    

    If more information is required please let me know and I will add it asap.


  • Mod

    Welcome to the MySensors community @sPENKMAN :)

    If you haven't already, see https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/
    That page lists the most common problem and has links to the log parser and how to interpret the log messages.

    NACK:1 means that the gateway did not get an acknowledgement from the node, which makes sense since the node didn't receive the message.

    The most common problem is power. You do have the recommended capacitor on both radios, right? If you are using the PA+LNA version, is the power supply sufficiently powerful and able to provide clean power?



  • @mfalkvidd said in RPi ethernet gateway doesn't send messages to the acuator:

    Welcome to the MySensors community @sPENKMAN :)

    If you haven't already, see https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/
    That page lists the most common problem and has links to the log parser and how to interpret the log messages.

    Thank you! I have been lingering around while planning the automation project but now was a good time to actually register ;) I actually did check the debug faq (which is very informative) but couldn't connect my issues to one of the problems.

    NACK:1 means that the gateway did not get an acknowledgement from the node, which makes sense since the node didn't receive the message.

    The most common problem is power. You do have the recommended capacitor on both radios, right? If you are using the PA+LNA version, is the power supply sufficiently powerful and able to provide clean power?

    I've have a 4,7uF capacitor on each side which are roughly 3-4 meters apart with only a bit of furniture in between. The power is being draw from the RPi 3.3v and arduino uno 3.3v () and I'm using the regular NRF24L01+ on both. I concur that the power issue would be most logical explanation if it weren't for the message my Arduino receives correctly at boot each and every time. If power where to be the issue I'm experiencing I would suspect to see more failures from gw -> node communications but that isn't the case so far.


  • Mod

    @sPENKMAN Great work.

    I agree that you should see more failures, at least over a large number of messages, if the problem was power related. But history/experience shows that a lot of factors can affect sending and receiving. Is your send done shortly after another send? If that's the case, the capacitor might not have had time to recharge. Try adding a wait(100) before your send and see if that helps.

    The length of the payload also affects the likelyhood that the message will get through, but since you're only sending a string of length 1 the message length shouldn't affect in this case.

    Does the receiving node use delay or sleep anywhere?


  • Mod

    Some threads that might be related, there have been some problems with the 3.3V output on Arduino boards not being stable enough:
    https://forum.mysensors.org/topic/1756/is-the-nano-a-good-ps-for-nrf24l01
    https://forum.mysensors.org/topic/2989/nrf24l01-range-of-only-few-meters



  • It's been some time but I tried to pick up this project again, now with some fresh ordered LD1117V33 regulators for my 3.3v needs. I setup a "power supply bread bord" where the LD1117V33 has a parallel 100uF capacitor on the Vin and Vout connected to the common ground. The multimeter agrees on the 3.3v Vout, so far so good.

    I've tried hooking up the nrf24 chip with the bread bord on the Arduino and on the PI and the results are identical... Everything works as expected until I actively try to send something from the controller throught the gateway to my actuator.

    In both cases the init goes well;

    pi@raspberrypi:/usr/src/MySensors $ sudo /usr/local/bin/mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.1.1
    mysgw: MCO:BGN:INIT GW,CP=RNNG---,VER=2.1.1
    mysgw: TSF:LRT:OK
    mysgw: TSM:INIT
    mysgw: TSF:WUR:MS=0
    mysgw: TSM:INIT:TSP OK
    mysgw: TSM:INIT:GW MODE
    mysgw: TSM:READY:ID=0,PAR=0,DIS=0
    mysgw: MCO:REG:NOT NEEDED
    mysgw: Listening for connections on 0.0.0.0:5003
    mysgw: MCO:BGN:STP
    mysgw: MCO:BGN:INIT OK,TSP=1
    

    I start the Arduino which starts sending data as seen on the raspberry pi gateway;

    mysgw: TSF:MSG:READ,1-1-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:BC
    mysgw: TSF:MSG:FPAR REQ,ID=1
    mysgw: TSF:PNG:SEND,TO=0
    mysgw: TSF:CKU:OK
    mysgw: TSF:MSG:GWL OK
    mysgw: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    mysgw: TSF:MSG:PINGED,ID=1,HP=1
    mysgw: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=11,pt=0,l=22,sg=0:TemperatureAndHumidity
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.1
    mysgw: TSF:MSG:READ,1-1-0,s=0,c=0,t=7,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:READ,1-1-0,s=1,c=0,t=6,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:READ,1-1-0,s=2,c=0,t=3,pt=0,l=0,sg=0:
    mysgw: TSF:MSG:READ,1-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    mysgw: TSF:MSG:SEND,0-0-1-1,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
    mysgw: TSF:MSG:READ,1-1-0,s=1,c=1,t=0,pt=7,l=5,sg=0:24.0
    mysgw: TSF:MSG:READ,1-1-0,s=0,c=1,t=1,pt=7,l=5,sg=0:54.0
    

    In the above output I see multiple TSF:MSG:SEND commands passing by without issues and receive data from the Arduino as well. This leads me to the conclusion that there is no power issue on either side and bidirectional communication is established (just like before).

    As soon as I try to toggle a light switch in OpenHAB the following lines show in the gateway log:

    mysgw: !TSF:MSG:SEND,0-0-1-1,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
    mysgw: Client 0:
    mysgw: Client 0: 1;2;1;1;2;0
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
    mysgw: Client 0:
    mysgw: Client 0: 1;2;1;1;2;0
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
    mysgw: Client 0:
    mysgw: Client 0: 1;2;1;1;2;0
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
    mysgw: Client 0:
    mysgw: Client 0: 1;2;1;1;2;0
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
    mysgw: Client 0:
    

Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.