Syntax for "is any of" comparison, specifically with a variable for "Compare to"


#1

1) Give a description of the problem
I am making a Piston to control my window shades and only lower them if it’s going to be a sunny day.

2) What is the expected behavior?
I’m calling $weather.conditions.current_observation.weather and it’s returning strings like ‘Clear’ and ‘Scattered Clouds’, this is exactly what I want.

3) What is happening/not happening?
I am setting the current weather to a variable, i.e. string current_weather = ‘Scattered Clouds’, this works just fine.

I understand how to compare my variable against a single string value, i.e. ‘Clear’ to have a true branch in my if statement to close my shades. However, I want to also allow ‘Scattered Clouds’ and I’m not sure what the right syntax is for the “is any of” comparison.

What would I put in my “Compare to” field? Can I just use a comma delimited string? Ideally, I’d like to compare it against a variable because I have my else branch send an email telling me that the piston decided not to lower the shades because the current_weather value doesn’t match my condition. I’d like to have the email notification say {current_weather} is not in {allowed_weather_conditions} such that allowed_weather_conditions is something like [‘Clear’, ‘Scattered Clouds’].


#2

You can do what you are trying with one IF statement:

You can list out as many conditions as you want then. Just put your window controls in “THEN”; I just logged to console to verify it worked as expected.