Hi All, is there a smart way to search a single block of text for multiple strings in RM without defining a condition for each search?
eg, I use the OpenWeather Alerts to change my Powerwall battery reserve level when severe weather is predicted, but my brute force method is ugly AF eg
I'm afraid not directly, but the method I was going to recommend -- namely breaking an existing/result String var into pieces using Token -- probably won't apply (cleanly) to this use-case either. I'm leaning strongly toward recommending WebCoRE as an able(r?) alternative for its built-in text- and JSON-handling abilities, plus indexing( ).
But would you mind pasting a typical input, along with a screenshot or two of how you want the result(s) to look and what you've already tried in RM (even if it's ugly, lol)?
EDIT: OMG, at first I couldn't make out what your OP screenshot showed -- thinking it was just a sample input text block -- but I now recognize that it's a collection of OR'd actions in RM. Gonna need a microscope.
Maybe turn this off just so we can see your rule setup without the copies of the blob? I'm still working on a good answer for you, btw. Life intervened.
This is rough but it works, and does so in essentially N-time without much fuss, plus is easy to maintain by simply editing/adding more "MatchN" local string vars (with values like Damaging winds, etc.) to the rule along with its corresponding "Replace" action.
If you need the check to be done against attributes from more than one device, as suggested in your OP, simply duplicate the second Action and provide an InputB var for its target, then concatenate all the sources (Input, InputB, ..) back into Input early on.
Result is a scalable rule without thorny IF-THEN-ELSE, OR'ing or loops.
If you'd like me to expand on what's behind each step, just ask!