Rules who check if a Word is in a string item

Hi I try to make a rules who check if a word is in a string item

Exemple i have a string item with state “This is a test from my computer”

When item string1 state changed

If string.state == test

Do something

.contains looks useful

So I try this and it doesn’t work :

rule "Contains"
when
Item KodiSState changed
then
if(KodiSTitle.state.toString.contains(super)) {
sendCommand (Srgbw, OFF)
}

end

use:
contains(“super”)
the string to search for needs to be in quotation marks.

What error messages do you see?
Is the rule ever triggered? (add a logInfo to find out)
What is the content of the mystery variable super? (add a logInfo to find out)
Did you perhaps want to search for the string “super” instead?
What is the content of your Item? (add a logInfo tofind out)

1 Like