jrule icon indicating copy to clipboard operation
jrule copied to clipboard

Module actions

Open seime opened this issue 1 year ago • 3 comments

Resolves #82

seime avatar Jul 16 '24 20:07 seime

Module loading is dynamic, and not all modules may be present at the time of JRule startup.

Any good ideas on how to solve this? Except for changing startlevel to 81 or more?

seime avatar Jul 16 '24 20:07 seime

Maybe it is a good idea to make sure JRule starts late (changing start level) Otherwise maybe we can schedule a reinit later if it fails to start (not sure we can detect that)

seaside1 avatar Aug 20 '24 16:08 seaside1

+1 Now i have to change this manually after each upgrade of openhab

Kind regards, good job

Willy

Op di 20 aug. 2024 18:48 schreef seaside1 @.***>:

Maybe it is a good idea to make sure JRule starts late (changing start level) Otherwise maybe we can schedule a reinit later if it fails to start (not sure we can detect that)

— Reply to this email directly, view it on GitHub https://github.com/seaside1/jrule/pull/204#issuecomment-2299308697, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHBGG4KEXX6BBVZJ5W5EZ4DZSNXNJAVCNFSM6AAAAABK7JLUH6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJZGMYDQNRZG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

wollyd avatar Aug 20 '24 18:08 wollyd

Would this do as an example? @seime @querdenker2k

## Example 45 - Send a push-notification through myOpenhab module action

Use case: receive push notification on mobile phone about important events

```java
package org.openhab.automation.jrule.rules.user;

import org.openhab.automation.jrule.rules.event.JRuleEvent;
import org.openhab.automation.jrule.rules.JRuleName;
import org.openhab.automation.jrule.rules.JRuleWhenThingTrigger;
import org.openhab.automation.jrule.rules.JRule;
import org.openhab.automation.jrule.generated.moduleactions.JRuleModuleActions.notificationSendExtendedBroadcastNotification;

public class MyOpenhabNotification extends JRule {
    @JRuleName("Send Push-Notification over MyOpenhab")
    @JRuleWhenThingTrigger(from = JRuleThingStatus.ONLINE)
    public void notifyAboutOnlineThing(JRuleEvent event) {
        notificationSendExtendedBroadcastNotification("a thing went online", "lightbulb", "thingOnlineNotification")
    }
}

Edit: I didn't manage to paste the markdown as code. The best I could do is this updated form missing the closing ```

jberggg avatar Apr 29 '25 18:04 jberggg