Initial startup: Rules with "sendNotification" don't work

If my theory is right it would only not work for a minute or so after a restart of OH which is what it sounded like was going on based on your original description.

If it is not working for many minutes or hours after a restart then that isn’t the problem and I’ve no idea what it is.

OH2 will not ignore a rule after an error. In fact, if the same error is persisting then you should see the same error in the log file every time the rule triggers.

In the past all rules with notifications worked perfectly. I didn’t change anything (just updating OH2 to the newest build from time to time). I can’t figure out the point that behavior changed.

Always, after restarting OH2 i manuell have to reload all rule-files with notifications in it. Without this the rules are not working - never! Strange if i’am the only with this problem.

1 Like

Having the same issue with build 443.
Any way in which can debug or troubleshoot this?
Thanks!

I also had this problem.
Got fixed by updating java version to oracle 1.8.0-101

Regards, S

Hi,
till weeks i’m running

java version "1.8.0_101"
Java™ SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot™ Client VM (build 25.101-b13, mixed mode)

Problem is still there.

Same here. I updated to build 463 and now have to save the rules-file - after that notifications start to work again.

Hi,
Same problem here with OH2b4 build 477. Java version is 1.8.0_101. Any solution besides reloading the rules?
Also, in SmartHome Designer, I’m getting the warning "The method sendNotification(String, String) is undefined. How can I fix this?
Regards.

SmartHome Designer is a little broken right now. Depending on when you downloaded it it is more or less broken. For example, mine will not recognize any Items, actions, or Joda classes. The rules run fine though. There are issues already submitted so it should get fixed but I wouldn’t spend too much time worrying about it until they get fixed.

That’s what happens to me in 0.9, but in 0.8 that’s the only waring I get. It already happened in OpenHAB Designer.

sendNotification has never worked, see https://github.com/openhab/openhab/issues/1164.
So just ignore the warning and keep using it…

Ok, this issue is not important, I can live with it :slight_smile:
But, any idea about why sendNotification doesn’t work until rules are reloaded?
By the way, @Kai, I think this is the first time I talk to you: thank you very much for all your work, openHAB is awesome!!!

Updated Java to 1.8.0_111 and the problem still persists.

doenst the issue just say it does not work in the designer?

currently its not working in OH2 … it throws errors on execution … it did work until something like 10 days or so? it stopped with one the latest builds

Thanks for the kudos, glad you like it :slight_smile:

Ok, sorry, my comment was only about the syntax markers in the designer.

Hm, then I doubt that it is about any code change because I am not aware of any changes in the past months that could be related to this.

What exactly is the exception that is thrown?

I have just upgraded from OpenHab 2b4 to latest snapshot today. And I was getting notifications just before the upgrade, and nothing after. Sendmail is working in rules, and access via myOpenhab.org is working.

I am checking the logs, but don’t seem to be getting an exception. The only thing I see is:
2016-10-29 15:50:48.970 [WARN ] [o.myopenhab.internal.MyOpenHABClient] - Jetty request 5111 failed: null

but that doesn’t coincide with when a notification should be sent.

This is my rule:
rule “Back Roboguard Triggered"
when
Item Roboguard_Back received update OPEN
then
if (Roboguard_Notification.state == ON) {
sendNotification("myemail@emailco.com”, “Back Roboguard triggered”)
}
end

Hi, I have updated from OH2 B3 to OH2 Build #560 (past B4).

Notifications did not work in any of the two versions

I have made a base installation, without any bindings or extra things. Just the necesary for notifications to work.
The rule is triggered and no error is logged, but notifications are not send and not even logged at my.openhab.com.

Can you provide the command so as to increase verbosity of notifications module or myopenhab module. Thanks
Regards.

Hi @Kai,
No exception is thrown. We’re getting this error:

2016-11-03 13:05:47.579 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Some rule': An error occured during the script execution: The name 'sendNotification(<XStringLiteralImpl>,<XStringLiteralImpl>)' cannot be resolved to an item or type.

If you force the reloading of the rules by editing the file, notifications start to work.
Regards.

Ok, I think I managed to resolve this issue. My guess is that it is due to the fact that the myopenhab bundle is loaded last and thus the rule parser does not know about its sendNotification action.

I have created https://github.com/eclipse/smarthome/pull/2451 as a fix. It should be available by the end of next week in the OH2 distro, watch out at https://community.openhab.org/c/openhab-2/news-important-changes where I’ll announce as soon as a new ESH update flows into OH2.

Hi @Kai I just encountered this again in 2.5.0M2 (not sure what to do with this now but thought id mention it)

Me neither, but thanks for mentioning it :roll_eyes: