From 730d32c3c9bb7a7257a5a7c943205abb9fa4b956 Mon Sep 17 00:00:00 2001 From: Eric Bodden Date: Wed, 25 Dec 2024 10:19:57 +0100 Subject: [PATCH 1/6] Added example now to hide notifications again Signed-off-by: Eric Bodden --- bundles/org.openhab.automation.jsscripting/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bundles/org.openhab.automation.jsscripting/README.md b/bundles/org.openhab.automation.jsscripting/README.md index 14b3300a9d4..94d74455656 100644 --- a/bundles/org.openhab.automation.jsscripting/README.md +++ b/bundles/org.openhab.automation.jsscripting/README.md @@ -800,6 +800,13 @@ actions.notificationBuilder('Hello World!').logOnly().send(); // Sends a simple log notification with icon and tag actions.notificationBuilder('Hello World!').logOnly() .withIcon('f7:bell_fill').withTag('important').send(); + +//sends a notification about a temperature change... +actions.notificationBuilder(str).withIcon("oh:temperature").withTag("Temperature change").withReferenceId("living room").send(); +//and clears it again after 10 minutes +setTimeout(() => { + actions.notificationBuilder().withReferenceId("living room").hide().send(); +}, 10 * 60 * 1000); ``` See [openhab-js : actions.NotificationBuilder](https://openhab.github.io/openhab-js/actions.html#.notificationBuilder) for complete documentation. From f9f5b6af2d266add436864b0b45a35403d0a07c5 Mon Sep 17 00:00:00 2001 From: Eric Bodden Date: Wed, 8 Jan 2025 08:10:28 +0100 Subject: [PATCH 2/6] Update bundles/org.openhab.automation.jsscripting/README.md Co-authored-by: Florian Hotze Signed-off-by: Eric Bodden --- bundles/org.openhab.automation.jsscripting/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.automation.jsscripting/README.md b/bundles/org.openhab.automation.jsscripting/README.md index 94d74455656..8d082d99a9d 100644 --- a/bundles/org.openhab.automation.jsscripting/README.md +++ b/bundles/org.openhab.automation.jsscripting/README.md @@ -801,7 +801,7 @@ actions.notificationBuilder('Hello World!').logOnly().send(); actions.notificationBuilder('Hello World!').logOnly() .withIcon('f7:bell_fill').withTag('important').send(); -//sends a notification about a temperature change... +// Sends a notification about a temperature change ... actions.notificationBuilder(str).withIcon("oh:temperature").withTag("Temperature change").withReferenceId("living room").send(); //and clears it again after 10 minutes setTimeout(() => { From 4b97657e99cfa90339d217f0daf03a9a5a08c71d Mon Sep 17 00:00:00 2001 From: Eric Bodden Date: Wed, 8 Jan 2025 08:12:46 +0100 Subject: [PATCH 3/6] Update bundles/org.openhab.automation.jsscripting/README.md Co-authored-by: Florian Hotze Signed-off-by: Eric Bodden --- bundles/org.openhab.automation.jsscripting/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.automation.jsscripting/README.md b/bundles/org.openhab.automation.jsscripting/README.md index 8d082d99a9d..90a1ba07c01 100644 --- a/bundles/org.openhab.automation.jsscripting/README.md +++ b/bundles/org.openhab.automation.jsscripting/README.md @@ -805,7 +805,7 @@ actions.notificationBuilder('Hello World!').logOnly() actions.notificationBuilder(str).withIcon("oh:temperature").withTag("Temperature change").withReferenceId("living room").send(); //and clears it again after 10 minutes setTimeout(() => { - actions.notificationBuilder().withReferenceId("living room").hide().send(); + actions.notificationBuilder().hide().withReferenceId("living room").send(); }, 10 * 60 * 1000); ``` From 19f0867c84359a561678cbcd3c308e112bb17181 Mon Sep 17 00:00:00 2001 From: Eric Bodden Date: Wed, 8 Jan 2025 08:13:01 +0100 Subject: [PATCH 4/6] Update bundles/org.openhab.automation.jsscripting/README.md Co-authored-by: Florian Hotze Signed-off-by: Eric Bodden --- bundles/org.openhab.automation.jsscripting/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.automation.jsscripting/README.md b/bundles/org.openhab.automation.jsscripting/README.md index 90a1ba07c01..fee830672a5 100644 --- a/bundles/org.openhab.automation.jsscripting/README.md +++ b/bundles/org.openhab.automation.jsscripting/README.md @@ -803,7 +803,7 @@ actions.notificationBuilder('Hello World!').logOnly() // Sends a notification about a temperature change ... actions.notificationBuilder(str).withIcon("oh:temperature").withTag("Temperature change").withReferenceId("living room").send(); -//and clears it again after 10 minutes +// ... and hides it after 10 minutes setTimeout(() => { actions.notificationBuilder().hide().withReferenceId("living room").send(); }, 10 * 60 * 1000); From e4992701cffb8d9380e51010b5e9f8801c879f74 Mon Sep 17 00:00:00 2001 From: Eric Bodden Date: Wed, 8 Jan 2025 17:36:24 +0100 Subject: [PATCH 5/6] Implemented suggestions Signed-off-by: Eric Bodden --- bundles/org.openhab.automation.jsscripting/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.automation.jsscripting/README.md b/bundles/org.openhab.automation.jsscripting/README.md index fee830672a5..158a21ef035 100644 --- a/bundles/org.openhab.automation.jsscripting/README.md +++ b/bundles/org.openhab.automation.jsscripting/README.md @@ -802,10 +802,10 @@ actions.notificationBuilder('Hello World!').logOnly() .withIcon('f7:bell_fill').withTag('important').send(); // Sends a notification about a temperature change ... -actions.notificationBuilder(str).withIcon("oh:temperature").withTag("Temperature change").withReferenceId("living room").send(); -// ... and hides it after 10 minutes +actions.notificationBuilder(str).withIcon('oh:temperature').withTag('Temperature change').withReferenceId('livingRoom').send(); +// ... and hides it again after 10 minutes setTimeout(() => { - actions.notificationBuilder().hide().withReferenceId("living room").send(); + actions.notificationBuilder().hide().withReferenceId('livingRoom').send(); }, 10 * 60 * 1000); ``` From cae49e92608c4a431076cc8ee47e114b5a10e022 Mon Sep 17 00:00:00 2001 From: Eric Bodden Date: Wed, 8 Jan 2025 17:38:25 +0100 Subject: [PATCH 6/6] Minor fix Signed-off-by: Eric Bodden --- bundles/org.openhab.automation.jsscripting/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.automation.jsscripting/README.md b/bundles/org.openhab.automation.jsscripting/README.md index 158a21ef035..89d4fb4b463 100644 --- a/bundles/org.openhab.automation.jsscripting/README.md +++ b/bundles/org.openhab.automation.jsscripting/README.md @@ -802,7 +802,7 @@ actions.notificationBuilder('Hello World!').logOnly() .withIcon('f7:bell_fill').withTag('important').send(); // Sends a notification about a temperature change ... -actions.notificationBuilder(str).withIcon('oh:temperature').withTag('Temperature change').withReferenceId('livingRoom').send(); +actions.notificationBuilder('new temperature: xyz').withIcon('oh:temperature').withTag('Temperature change').withReferenceId('livingRoom').send(); // ... and hides it again after 10 minutes setTimeout(() => { actions.notificationBuilder().hide().withReferenceId('livingRoom').send();