Connection status is not checked

I’m trying to check the signal level of the modem, in particular rssi. It’s pretty easy to do.

:put ( [/interface lte monitor lte1 as-value once ] -> "rssi")

But I can’t check for a signal. In theory, if you check the data type like this

:put [:typeof ( [/interface lte monitor lte1 as-value once ] -> "rssi")]

will be either “num” or “nothing”.
But when I do this check

:if ( :typeof [ [/interface lte monitor lte1 as-value once ] -> "rssi"] = "nothing") do={ :put "No rssi"} else={ :put "Yes rssi"}

The “if” condition is constantly triggered so that I don’t set the check: “num” or “nothing”. And this does not depend on whether the modem is turned on or not.

Use the correct syntax… and provide RouterOS version, everytime…

:if ([ :typeof [ ([/interface lte monitor lte1 as-value once ] → “rssi”)] = “nothing”) do={ :put “No rssi”} else={ :put “Yes rssi”}

If must be a number, check if is a number, not if is nothing (or nil, etc.)

Write on simple way and indexed, is more easy to find errors and problems.

{
    /interface lte
    :local rssi ([monitor lte1 as-value once]->"rssi")
    :if ([:typeof $rssi] = "num") do={
        :put "RSSI is $rssi"
    } else={
        :put "RSSI NOT returned"
    }
}

Thank you.I haven't used Mikrotik for six months. I forget, plus inattention.

Will try

What difference does it make what to check: a number or nothing?

I thought that the shorter the line, the smaller the size of the script. In many languages, code size is critical. Even Mikrotik has limitations, like 4MB. Although I don’t remember what exactly the restriction was. And I didn't want to introduce an additional variable.