Wpa_cli usage in shell script

I have mt7628-based device with both AP and STA configured; working. In case, the upstream AP is powered off, my device automatically retries continously to re-connect, flooding the log with

Sat Apr 19 15:39:28 2025 daemon.notice hostapd: handle_probe_req: send failed
Sat Apr 19 15:39:28 2025 daemon.notice hostapd: handle_probe_req: send failed
Sat Apr 19 15:39:28 2025 daemon.notice hostapd: handle_probe_req: send failed
Sat Apr 19 15:39:28 2025 daemon.notice hostapd: handle_probe_req: send failed

Although this is standard behaviour, it makes it very hard to connect to another upstream AP instead.
So, I would like to temp disable the auto scan of my STA using wpa_cli, which provides a suitable cmd: "sta_autoconnect 0/1". However, I have absolutely no idea how to enter this cmd either manually or from a script.
I.e.

root@mydevice:~# wpa_cli 'STA_AUTOCONNECT'
Selected interface 'global'
Invalid STA_AUTOCONNECT command - at least 1 argument is required.
root@mydevice:~# wpa_cli 'STA_AUTOCONNECT 0'
Selected interface 'global'
Unknown command 'STA_AUTOCONNECT 0'

Same result both for wpa_basic, and hostapd_basic/wpa_supplicant.
Any idea how to do it from shell script ?

by the looks of this, if i were to hazard a guess, you likely need to specify the interface name

try

wpa_cli 'STA_AUTOCONNECT' phy1-sta0  <-- or whatever interface you are targeting

and generally, what ever you type in cli can be directly entered into a script ..ie

echo "thats right !!!"

script version

#!/bin/sh

echo "thats right !!!"
echo "told you so :)"

One more of the lot of unsuccessful tries:
wpa_cli 'STA_AUTOCONNECT' phy0-sta0
Selected interface 'global'
UNKNOWN COMMAND

Oops, I did not want to list all the failing ones.

Please, only reply in case of tested solution, on 24.10.0

can I get you a side of fries and a drink well I am at it ?

My apologies for trying to be helpful.

good luck

First of all, problem is, that all variants of wpa_supplicant for openwrt are NOT built with support for AUTOSCAN.
Needs custom build from src, after patching/editing the config.

Has nothing to do with luck.

The syntax would be:
wpa_cli -i phy0-sta0 set STA_AUTOCONNECT 0

But looking at the man page and other forums, STA_AUTOCONNECT does not seem to be a valid variable as far as I can see.