Somethings wrong with AND and OR in a IF statement

@josh and @James I’m encountering a issue with the AND and OR expression in a if statement. Here is a test rule I made to test it. It fails the IF statement.

Can you share the relevant rule logs?

With a further test I switched the locks out for switches and it worked.



OK. If you’d like help troubleshooting the original rule, I would need to see the Rule Logs including the details for the IF Condition line which will show you what your hub was reporting the state as for each of the locks.

Based on your original rule screenshot, the rule would be triggered when your ‘Test Toggle’ device switches on or off and would always send the notification which would have the ‘Test Toggle’ device as the title and the value (on or off) as the body. Only then would it check the IF Condition where it looks at the lock state for the ‘Back Door Lock’ and ‘Front Door Lock’ and it would only proceed to the THEN part where it sets the variable if both of those locks were reporting their state as locked.

If either of those locks are reporting a value other than ‘locked’, then the condition will fail and go to the ELSE part where it does nothing.

That’s correct, the push notification was just to make sure the rule was being triggered.

It appears the attribute from the hub is empty.

If you believe SmartThings should have a status for this device, can you send a note to support@sharptools.io with the Rule ID so we can take a closer look?

I sent the email with the rule Id you requested.

​We pushed an update this morning which should resolve this issue.

​The issue was that the lock attribute was being reported on both the lock and lockCodes capabilities and in the case of an overlap, the system was using the ‘last one in’ as the priority. We added some logic to prioritize attribute values that are explicitly set (with timestamps) over those that are null/unset rather than the last one in.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.