[closed] Problem with String Rule

Hallo,

I use a Foscam Cam vor Motion detection. On The Sitemap it Workshop, when a movement is detected the Item on the sitemap shows bewegung.
For showing bewegung instead of 2 i use a map.

Now i created a rule that openhab send me a Mail.
I tried a lot of rules but it i receive no Mails.

 rule foscambewegung
when
 Item Foscam_Motion  received update
then
 if (Foscam_Motion.state == 2){
 sendMail("mailadresse", "Info", "Bewegung")
 }
 if (Foscam_Motion.state == 'bewegung'){
 sendMail("mailadresse", "Info", "Bewegung")
 }
 if (Foscam_Motion.state.toString == "bewegung")
 sendMail("mailadresse", "Info", "Bewegung")
 }
end

~
The Foscam_Motion is Type String, The mailadresse is a placeholder for my private mailadress.

Has anyone an idea

Do you know if your mail configuration is correct? Can you send an email from a simple rule like

rule TestMail
when
  Item TestSwitch received command
then
  sendMail(...)
end

The Mail config works fine another rule.

The question is, what is the correct rule

You are missing a { here, so perhaps the whole rule isn’t parsing correctly?

I Could resolve the problem with die line

if (Foscam_Motion.state == “2”){

and yes i forgot the }