I am just looking to see if there is an easier way of doing the below, before I spend ages adding code.
I have an if statement where I have several AND conditions included. At the end, if true, I have a light flash green and if false, flashes red. What I don't know is which of the conditions were false that triggered the red, so have to open the app and look at the rule to see. Is there a way to send a message to my phone on the output of the conditions for that if statement?
For example, if I had the statement below:
if X (true) and Y (false) and Z (true), then.......
I could have a message sent indicating that Y was the false. Even if it was a copy of what is shown in the action in the app, which shows the 'T' and 'F'' next to the action conditions. Else, the only way I can think of is adding several nested if statements with an action of sending the output next to each, so my 1 liner becomes many.
Thanks for any help.
It may help to see the rule as it is to suggest what to add where.
In the above, there are several conditions that are not met which would be good to know. This is basically notifying me if I closed/secured the doors/windows and switched the dumb lights off.
I wrote something similar but it's a brute force method. Instead of nested IF statements I use a series of simple conditions and append each true value (which is opposite to why it failed the initial condition) to it. You could also use the same condition and then make it NOT for the same result. For example, local variable is Status
Set Status to 'These items failed condition'
IF (Sensor - Contact (Tuya) - Front door closed) Set Status to '%Status% Front door'
IF (Sensor - Contact (Tuya) - Kitchen Window open) Set Status to '%Status% Kitchen window'
IF (Sensor - Contact (Xiaomi) - Back door closed) Set Status to '%Status% Back door'
IF (Sensor - Contact (Xiaomi) - Dining Room open) Set Status to '%Status% Dining Room'
Now you can send Status to your device and it'll include just the "failed" devices in one line.
Looking forward to see if someone offers a simpler solution!
Edit: I'm not sure why Back Door is all open. You might want to check that.
Thanks. Your way is better than I had in mind.
The door is "open" as its not actually the door but a security latch which is set and breaks the contact. But thanks for checking up.
I wasn't clear but I was referring to the "all." Usually I see that with multiple devices and you want all of them in a certain state for that particular condition to be true. I was just playing around with three contact sensors and selected "All of these?" I though it might keep the all when I removed two of the three sensors but it didn't. So I'm not sure if all is part of the evaluation or if it's part of the name.
Oh, yeah. That was from when I first set up the action and then later added to it, but didn't see an option to remove it. It still worked as intended so just kinda went with it.
I should probably add that I'm always in a rush to set these up so don't spend the time to do it properly