LTE Signal Lights; uqmi problem

Old thread for reference:

So yes it is straightforward to write a script to poll uqmi --get-signal-info to turn LEDs on or off based on the received signal strength on a QMI modem. But then a problem occurs:

I also have to work around a bug in uqmi: It does not lock the device it is working with. If the signal strength script and the LuCI status page code call it at the same time it locks up. I'm thinking of a wrapper script that puts a semaphore in place.

This is indeed still the case. The LED script will crash if another process calls uqmi. The author there did develop a solution but didn't post it. Can someone who is good at ash suggest how to do it?