rule "Front Door Notification" do
changed Apartment_FrontDoor, to: OPEN
run do
- notify("Front door was opened!", email: "me@email.com")
+ Notification.send("Front door was opened!", email: "me@email.com")
end
end
```
-See [notify](https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Actions.html#notify-class_method)
+See [Notification.send](https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Actions/Notification.html#send-class_method)
:::
when
Item Apartment_Window changed to OPEN
then
- sendBroadcastNotification("Apartment window was opened!", "window", "HIGH")
+ sendBroadcastNotification("Apartment window was opened!", "window", "Door")
end
```
rules.when().item('Apartment_Window').changed().to('OPEN').then(() => {
actions.notificationBuilder('Apartment window was opened!')
.withIcon('window')
- .withSeverity('HIGH')
+ .withTag('Door')
.send();
}).build('Open Window Notification');
```
::: tab JRuby
-Broadcast notification is performed by calling [notify](https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Actions.html#notify-class_method) without providing an email address.
+Broadcast notification is performed by calling [Notification.send](https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Actions/Notification.html#send-class_method) without providing an email address.
```ruby
rule "Open Window Notification" do
changed Apartment_Window, to: OPEN
run do
- notify("Apartment window was opened!", icon: "window", severity: "HIGH")
+ Notification.send("Apartment window was opened!", icon: "window", tag: "Door")
end
end
```
rules.when().item('Apartment_MotionSensor').changed().to('ON').then(() => {
actions.notificationBuilder('Motion detected in the apartment!')
.withIcon('motion')
- .withTag('motion-tag')
+ .withTag('Motion Tag')
.withTitle('Motion Detected')
.withReferenceId('motion-id-1234')
.withMediaAttachment('https://apartment.my/camera-snapshot.jpg')
- .addActionButton('Turn on the light=command:Apartment_Light:ON')
+ .addActionButton('Turn on the light', 'command:Apartment_Light:ON')
.send();
}).build('Motion Detected Notification');
```
rule "Motion Detected Notification" do
changed Apartment_MotionSensor, to: ON
run do
- notify "Motion detected in the apartment!",
- icon: "motion",
- tag: "motion-tag",
- title: "Motion Detected",
- attachment: "https://apartment.my/camera-snapshot.jpg",
- buttons: { "Turn on the light" => "command:Apartment_Light:ON" }
+ Notification.send "Motion detected in the apartment!",
+ icon: "motion",
+ tag: "Motion Tag",
+ title: "Motion Detected",
+ id: "motion-id-1234"
+ attachment: "https://apartment.my/camera-snapshot.jpg",
+ buttons: { "Turn on the light" => "command:Apartment_Light:ON" }
end
end
```