Make gateway transmit via LoRa on loss of Internet backhaul

In the real world, gateways tends to suffer various failures, two common ones being loss of Internet backhaul connection especially but not only when it is provided by LTE/GSM/etc, and loss of power. When a gateway dissappears, it can be really useful to know which has happened.

To that end, I’m trying to make it so that a gateway which has lost connection to the Internet, but which still has power, could start transmitting alert packets via LoRa which other gateways could hopefully pick up and report in.

We tend to run Lora-Gateway-Bridge on the gateway itself, so as near as I can tell, a packet forwarder talking the Semtech UPD protocol doesn’t actually know that it has no backhaul to LoRa Server, since it gets its acks from the local bridge. We do have other watchdog tasks running on the box (for example, we have something that does an MQTT subscription to our own stats topic, and will ultimately reboot if it does not see those reflected back). And I’ve been able to send raw LoRa gateway-to-gateway pings just by publishing suitable MQTT packets to have one gateway transmit on an uplink frequency with appropriate IQ polarity.

But it’s unclear that there’s any path to injecting something into the gateway when the bridge is not in contact with the MQTT broker, other than by either hacking the packet forwarder to have an additional listening port or to transmit upon receiving a unix signal (ie, kill -USR1 pid##), taking down the packet forwarder and running something else, or modifying the Lora-gateway-bridge to add this capability.

Any thoughts about how best to do that?

At a simple level it could be nothing more than sending a fixed packet with part of the gateway ID every n seconds if the MQTT connection has been broken more than m seconds. But it would be nice to do it in a way extensible to actually running a proper LoRaWAN node on the gateway and creating proper messages that would come through at application level rather than need a custom task watching the raw feed for them - which probably means having a way to inject the transmit packets from an independent program which calculates them.