See post below - accidental post originally.
Sorry guys, some how I posted this and can’t delete it. In any case, I’m trying to setup a basic email rule, am fairly new to OH and found a similar example online but it’s not working and I’m not sure why.
Here’s the applicable rule:
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
var Timer waitTimer = null
var boolean sentTemperature = false
rule “Basement under-temp warning"
when
Item Basement_Temperature changed
then
if (!sentTemperature && Basement_Temperature.state < 11) {
sendMail("XXXXXXXX@gmail.com”, "It’s cold in the basement, "Temperature reported by OH is " + Basement_Temperature.state)
sentTemperature = true
waitTimer = createTimer(now.plusMinutes(15)) [|
sentTemperature = false
]
}
end
The rule IS triggering, but is only giving me the following error:
09:35:44 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Basement under-temp warning’: An error occured during the script execution: index=2, size=2
Any idea what I’m doing wrong?
Thanks
Not sure but try
float temp= Float.parseFloat(Basement_Temperature.state);
And also
Basement_Temperature.state.toString()
In mail massage.
Also please use code fences for better readability.
Code goes here
Now I feel stupid
sendMail("XXXXXXXX@gmail.com”, "It’s cold in the basement, "Temperature reported by OH is " +
I see a missing "
Whoops. Thanks for the assistance.