Rule from OH1 not working with OH2 - 2.4

This rule was working with OH1 1.8. After install OH2 this rule is not working anymore:

// Kühlschrank Überwachung ####################################################
rule “Kühlschrank Temperatur HOCH”
when
Item temp_kuehl changed
then
if (temp_kuehl.state > 3)
{
sendMail(“mxxxxx@onxxxx.de”, “openHAB Nachricht”, “Kühl/Gefrierschranktemperatur zu hoch! " + temp_kuehl.state + " Grad”)
}
end

The logfile shows the following message:
16:00:01.618 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule ‘Kühlschrank Temperatur HOCH’: Script interpreter couldn’t be obtain

Permissions issue with the script location?

After the upgrade run openhabian tool and try fix permissions then stop OH, clean the cache, and reboot.

I think people have issues with the mail v1 bindings and have moved on to a new version. Searching the forum here should provide some clues.

By the way, as I post this, 2.5 stable is being compiled to be released later today.

https://ci.openhab.org/job/openhab-release/68/

The OH2 is installed from scratch no upgrade. All bindings from OH2, only the rules from are separated from one rulefile to separated rules.
My OH is running on Windows 10 64bit with Java™ SE Runtime Environment (build 1.8.0_221-b11).
All other functions are working as well. Btw: When the System is starting I send a Mail without any issue like this:

// Systemstart ################################################################
rule “Initialize”
when
System started
then
sendMail(“mxxxlf@xxxx.de”, “Nachricht von openHAB”, “openHAB gestartet.”)
sendBroadcastNotification(“openHAB gestartet…”)
end

If you prefer to stay on OH 2.4 maybe try upgrading the binding. Here is a 2.5 snapshot that may work https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/addons/bundles/org.openhab.binding.mail/2.5.0-SNAPSHOT/

Place the jar file in usr/share/openhab2/addons and restart OH.

Try putting this part in your first rule, comment out the other message, and see if it works. If it works the problem is in the message your trying to send…something changed with the syntax???

Now I have this simplified rule:

rule “Kühlschrank Temperatur HOCH”
when
Item temp_kuehl changed
then
if (temp_kuehl.state > 3)
{
sendMail(“mxxxxxx@xxxxxx.de”, “openHAB Nachricht”, “Kühl/Gefrierschranktemperatur zu hoch!”)
}
end

Now I’m waiting for the temp_kuehl change.

For the sake of time you could change the value to something smaller.:wink:

The temp_kuehl change was done but now Mail was sent.:frowning_face:

The mail was sent or was not sent?

If mail was sent then the issue is this line:

sendMail(“mxxxxx@onxxxx.de”, “openHAB Nachricht”, “Kühl/Gefrierschranktemperatur zu hoch! " + temp_kuehl.state + " Grad”)

Maybe the item needs to be defined as a number in the message.

Example:

sendMail(“mxxxxx@onxxxx.de”, “openHAB Nachricht”, “Kühl/Gefrierschranktemperatur zu hoch! " + temp_kuehl.state as Number + " Grad”)

Sorry, no Mail was sent.

Now the string for sending the Mail is below:
sendMail(“mxxxxxx@xxxxxx.de”, “openHAB Nachricht”, “Kühl/Gefrierschranktemperatur zu hoch!”)

I have the variable removed.

Looking at a few other topics that are similar I recommend to use openhabian tool and select install needed packages, fix permissions, ect… then clean the cache and restart OH. Hopefully this will help b/c I’m out of ideas.:upside_down_face:

Please use a logInfo just before the sendMail line in order to see if you really get inside the if statement.
Maybe the temperature isn’t just a number anymore? Topic to look at UnitsOfMeasurement.

2 Likes

I thought about this also but as OP mentioned the rule worked before so I was assuming the item has been defined as a Number.:expressionless: But you make a good point and thanks for helping.

I’m not sure you understood what Bruce was recommending. The sendMail Action you are trying to use is a legacy Action. And indeed, people were having issues getting it to work properly. That Action has been replaced with a 2.x version binding, but that binding was released after 2.4 release.

I recommend that you wait a day, install OH 2.5, and then use the 2.5 Mail binding instead of the now deprecated Mail Action.

As for your error, my only recommendation is to double check that the Mail Action is in fact installed.

1 Like

Ok. I think I have time to wait until OH 2.5 is released. It was only an incident because of my defective Frozer. With OH1 I was able to repair the Froster until Temperature was too high then I’ve got an EMail. Last time it was too late.