Push Notification with Javascript

Hi Everyone,
I want to send Notification like Email Notifications, Push Notifications and Log Notifications and sometimes put an icon and / or a severity with JavaScript in scripts but but I did several tests without success.
I tried with the official codes like this :

Can someone help me by telling me exactly what code to put ?
Thanks in Advance

Which JacaScript? In JSScripting see JavaScript Scripting - Automation | openHAB.

If Nashorn, are you using the helper library?

Check out these blocks and create a rule with then and the look at the code that is generated:

1 Like

I use the ECMA - 262 Edition 5.1 JS !
In your link there is the option ECMAScript 262 Edition 11 but i don’t have this option in my openhab, my version is 3.2.0. And i don’t know what is Nashorn ?
Thanks for your help but the code in your link doesn’t work in ECMA - 262 Edition 5.1.:grimacing:
Good afternoon! :slight_smile:

Usually that’s what I do but I don’t have the notifications option in Blocky :sob:.
Good afternoon. :slight_smile:

You need to be on 3.2 Release. They are pretty new. One good reason to upgrade :wink:

This is what I had just done and there was still no notifications option but now it has finally appeared, push and log notifications are working but not emails! Thank you very much for your help :smiley: :smiley:.

1 Like

Are you aware that email notifications cannot be sent to anyone via the notification API (and therefore the blocks) but only to emails that are users on openHAB cloud?

Nashorn is the JavaScript that comes with OH by default, ECMAScript 5.1. JS Scripting is a separate add-on which provides ECMAScript 11 and comes with a library that makes writing rules much easier. But the two work differently which is why it’s important to know.

The Nashorn Helper Library changes things too.

Note that the Mail binding is currently broken too.

Yes, in the meantime, I realized it! Thank you :grinning:

Ok, thank you for this information. :grinning: