Using Wildcards in Compare to Value


#1

1) Give a description of the problem
I have an automation that runs if the weather forecasts snow. The weather app has many ways of signaling this including snow, snowing, snow shower, etc. I would like to use a wildcard so I can catch them all (example snow). Is thi sfeasible (it hasn’t snowed since I made the automation)

2) What is the expected behaviour?
For weather that includes snow in its variable, trigger the automation.

3) What is happening/not happening?
Not tested yet

**4) Post a Green Snapshot of the piston![image|45x37]


#2

Have not tested but you could compare the expression
contains([Weather : weather],‘Snow’)
changes to
true


#3

Thanks. I’ll give that a try. It is supposed to snow tomorrow.


#4

I set everything up as string values in the ‘define’ of the piston:

Just want to add that I may have gotten this from @WCmore


#5

My first attempt failed. I had it set up as a condition and that didn’t work. So now I set a boolean that sets to true if Weather contains snow. Then the condition is whether that boolean changes to true. Do I need to subscribe it to anything (Weahter:weather), or will it trigger property? I won’t get a “changes to” until it moves away from the current state of snow showers.


#6

Now that I think about it, might be worthy of a different approach. If looking for multiple weather conditions, I would define in a string variable and search that list to see if it includes current conditions.


Temperature Sensor 1 being the Weather device


#7

@fieldsjm - Thanks for pointing me in the right direction. My automation worked perfectly last night. Weather changed to Snow Showers. The expression picked up snow and turned on the heat pads on my front steps.