I have the same issue since upgrading from 2.5.0 S1776 to 2.5.0 (general release)
I have tried:
restarting openhab
stopping openhab, clearing the cache, starting openhab
deleting my smtp server thing and recreating it
uninstalling the binding, restarting openhab, and reinstalling the binding
backing up with openhab-cli, purging openhab with apt, installing openhab, restoring backup
my rule
val mailActions = getActions("mail","mail:smtp:989680e0")
rule "Garage door lock status updates"
when
Item Door_Lock_Alarm changed
then
switch(transform("JSONPATH", "$.type", Door_Lock_Alarm.state.toString)) {
case "17", case "23", case "26" : mailActions.sendMail("me@example.com", "Door lock jammed", "Front Door lock jammed")
case "18", case "21", case "24", case "27" : Door_Lock.postUpdate(ON)
case "19" : {
val userID = transform("JSONPATH", "$.value", Door_Lock_Alarm.state.toString)
var userName = ""
switch(userID) {
case "1": userName = "Bill"
case "2": userName = "Ted"
default: userName = "Unknown"
}
mailActions.sendMail("me@example.com", "Door lock opened by code", "Door lock opened by " + userID + " " + userName)
Door_Lock.postUpdate(OFF)
}
case "22", case "25" : Door_Lock.postUpdate(OFF)
case "161" : mailActions.sendMail("me@example.com", "Door lock bad code attempt", "Someone entered a bad code at the front door lock")
case "167" : {
if(Door_Lock_Battery_Timer.state.toString <> "ON") {
Door_Lock_Battery_Timer.sendCommand(ON)
mailActions.sendMail("me@example.com", "Door Lock Battery Low", "Low battery in the front door lock")
}
}
}
end
the error
2019-12-15 22:07:16.121 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Garage door lock status updates': 'sendMail' is not a member of 'org.eclipse.smarthome.core.thing.binding.ThingActions'; line 18, column 25, length 120
Because you are “grabbing” the action to a global reference outside of your rule, it needs to be available at the moment the rules file is parsed. If it isn’t, there is no recovery.
We know openHAB files load sequence is umm a bit iffy.
I would restructure to improve your chances.
rule "Garage door lock status updates"
...
then
val mailActions = getActions("mail","mail:smtp:989680e0")
...
Thanks both of you for your suggestions, I really appreciate it.
@rossko57 , your idea worked. It used to work when I declared it globally in the past, but maybe between S1776 and the release something changed in the way rules are loaded. I’ve also added rules, so maybe having more rules to load caused this issue and it was unrelated to the version change.
I suggest you restart openHAB without another cleared cache after the restart and clear the cache. (Yes, another restart after the first one.) I have to do this every time after any version upgrade to get sendmail to work. Yes, I almost always forget to do this, then sendmail fails (also killing the rest of the rule execution so something doesn’t work), then I notice it, then I restart openHAB and it starts working again.
I’ll give this a try, I just updated to 2.5.3-1 the other day and it seems my sendMail is not working. I cleared cache, rebooted, and have now removed & readded the binding as well as my SMTP server. I’ll reboot again as I still get the error:
‘sendMail’ is not a member of ‘org.eclipse.smarthome.core.thing.binding.ThingActions’
whenever a rule triggers a send. I’ll also try reordering the val under the “then” statement in all of my rules.
Yep, it just started working again after another reboot.
When I removed the binding, my OH web interface went sideways and required a restart then too. It is back and working again. I created the mail server thing via PaperUI this time too.
Not sure what triggered this to start failing, it was working a few days ago but I only have email rules trigger every now and then. The last one was before my OH update from 2.5.3 -> 2.5.3-1 but that may have been a coincidence.
Possibly the clear cache causes this problem. Upgrades do a clear cache in the background. That’s my theory. Could be wrong. But a 2nd restart always seems to fix it for me.
I received the ‘sendMail’ is not a member … error. I’m on 2.5.8, but I’m adding this comment because I found this thread when I searched for the error.
Based on the suggestions in this thread, I rebooted (sudo reboot) my Pi 4, which resolved the problem for me.