Connection State Diagnostic Tag True/False Evaluation for Alarm

I’m trying to evaluate whether a location in the field is connected or not with Connection Status diagnostic tag and then prompt an alarm if it’s disconnected.

The alarm is set to start for true.
I tried the following to configure the alarm but it’s not working:

conn =“PumpingStation/Connection State.Value”)
if (conn = “Disconnected”, true, false)

If I test print this line in the script console, it returns ok the state connected or disconnected:“PumpingStation/Connection State.Value”)

Any advice please?

You’re mixing up expressions and scripting.
If you’re inside of an alarm, you’re almost certainly using expressions - so the expression would be:

if({PumpingStation/Connection State} = "Disconnected", True, False)

The equivalent script would be:

conn ="PumpingStation/Connection State").value
if conn == "Disconnected":
	return True
	return False