Comparison always seems to return TRUE

10 views
Skip to first unread message

Daryl Sargent

unread,
Jan 31, 2026, 1:29:29 AMJan 31
to TasmotaUsers
I have the following very simple rule that compares a RFCode with a string.  It uses an IF statement and always seems to return true regardless of the value:

07:22:07.312 MQT: stat/bridge/RESULT = {"Rule2":{"State":"ON","Once":"OFF","StopOnError":"OFF","Length":77,"Free":434,"Rules":"ON RfReceived#Data DO IF (%value% == E7510A) Var1 TRIGGERED ENDIF ENDON BREAK"}}
07:22:48.958 CMD: var1 ""
07:22:48.963 RSL: RESULT = {"Var1":""}
07:22:57.887 RSL: RESULT = {"Time":"2026-01-31T07:22:57","RfReceived":{"Sync":13980,"Low":460,"High":1350,"Data":"E7510E","RfKey":"None"}}
07:22:57.916 RUL: RFRECEIVED#DATA performs 'IF (E7510E == E7510A) Var1 TRIGGERED ENDIF'
07:22:57.922 RSL: RESULT = {"If":"Done"}
07:22:58.139 RSL: RESULT = {"Var1":"TRIGGERED"}

I assume I've got the syntax wrong somewhere.  Any suggestions please?

Daryl Sargent

unread,
Jan 31, 2026, 2:01:27 AMJan 31
to TasmotaUsers
Ignore this "==" compares them as numbers, "=" compares them as strings.  Which is explained in the docs in the trigger comparison section, not in the bit on conditional rules.... 

Philip Knowles

unread,
Feb 2, 2026, 4:50:25 AMFeb 2
to Daryl Sargent, TasmotaUsers
I know you've solved it but you don't need to use IF for what you are doing

ON IrReceived#Data=E7510A DO var1 TRIGGERED ENDON

From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of Daryl Sargent <daryl....@gmail.com>
Sent: 31 January 2026 07:01
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: Re: Comparison always seems to return TRUE
 
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/sonoffusers/4e7b9a4e-67aa-467d-b48a-31a02400692bn%40googlegroups.com.

Daryl Sargent

unread,
Feb 2, 2026, 5:45:51 AMFeb 2
to TasmotaUsers
Yep - worked that out but what I need is to compare a list of codes in the one rule.  All working fine now - so thanks for your response.

Philip Knowles

unread,
Feb 2, 2026, 6:52:05 AMFeb 2
to Daryl Sargent, TasmotaUsers
You still don't need to use if
ON IrReceived#Data=E7510A DO var1 TRIGGERED BREAK
ON IrReceived#Data=E7510E DO var1 Something else BREAK
ON IrReceived#Data DO var1 Invalid input ENDON
Is all one rule. And it will 'break' for each input on the way. The final one will catch ones that you're not looking for


Sent: Monday, February 02, 2026 10:45
Reply all
Reply to author
Forward
0 new messages