Gateway stops communicating (again)



  • Re: RPI MQTT gateway stops communicating

    My problem is similar, if not the same. Over some period of time, a week or so, the actuators that are part of the gateway stop receiving commands. The aforementioned topic indicates an unstable network, yet I ssh into the RPi and use systemctl to restart mysgw and the gateway starts acting on the sent commands. The RPi zero W does not have an ethernet port.

    Because I can still ssh into the RPi, I don't think it's a network problem. At the moment, all is fine. What can I do to debug this problem next time it happens?

    Thanks for your help,

    OSD

    My system is:
    Raspberry Pi Zero W Rev 1.1
    MySensors Library v2.4.0-alpha
    configuration: --spi-driver=SPIDEV --my-gateway=mqtt --my-controller-ip-address=192.168.1.142 --my-port=1883 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-transport=rf24 --my-rf24-channel=121 --my-rf24-pa-level=RF24_PA_MAX



  • Hm, maybe the problem is that your rPI has a short interruption in the WIFI connection, the MQTT TCP connection is interrupted and does not autostart again. Maybe there is something in the logs. Maybe you can find something about reconnects in one of these:

    journalctl --unit=systemd-networkd
    journalctl --unit=wpa_supplicant
    

    You could try to run wpa_cli in daemon mode to react to disconnects and connects. Create a script like this:

    #!/bin/bash
    
    case "$2" in
        CONNECTED)
            <your command to start the gateway>;
            ;;
        DISCONNECTED)
            <your command to stop the gateway>;
            ;;
    esac
    
    

    then, start wpa_cli in deamon mode:

    wpa_cli -a /path/to/your/script #use sudo if your gateway commands need sudo
    

    If that helps, you could create a service from this command.

    Regards, Edi


Log in to reply
 

Suggested Topics

0
Online

11.4k
Users

11.1k
Topics

112.6k
Posts