Rules are not performed after some uptime

Please use the code fences

Also please refer to: How to ask a good question
Items: 1, 8, 10, 11
Post your items and any relevant logs

thank you for yor not helpful and arrogant post.

It is very helpful, kind and polite

It helps a lot with less waste and more focused approach that assists you first of all

1 Like

ok, new start.
I was NOT posting my Items because I dont think there is any problam with it.
The rule itself IS WORKING, but after some time it is no longer working.
Also there is just nothing relevant in the log except “Item sz_r_sw changed to x”

therefore I asked for the recomended debug settings.

You can also set the log to TRACE, maybe that will provide additional info to help resolve your issue. Can’t do much about the flooding messages though,:expressionless: just hope you get what’s needed quick so it can be turned off.

2 Likes

Hello,
This is the arrogant and rude person trying to help you help yourself.

Is it the only rule that stops or do they all stop?
Do you use rules with while loop, Thread::sleep and or timer?
See: Why have my Rules stopped running? Why Thread::sleep is a bad idea

I answered your post because I want to help you.
Your post didn’t have any information apart from your badly formatted rule.
So I (politely) asked for more info.

If you are going to have that attitude with volunteers who give their free time to help, go on twitter or facebook.

4 Likes

Ty, I really appreciate ANY help. I was hoping that there is a specific trace for this case (like enabling traces for bindings)

@vzorglub I will add my Items / Log in the first Post.

Only This rule stoped working others are doing fine, and after I edit the rule and the file is refreshed the rule is working again.
I have one rule in place with “createTimer(now.plusSeconds(20)” but even if I delete this rule the problem stays.

I dont habe any problems with helpful people but in EVERY forum the first post to noobs is… read rules, did u searched. do this and this.
Of course I did perform a search…
And of course I did read the rules.

My intention was to ask for the best TRACE / DEBUG for this because in the Logs is just nothing. But I will post my log.

Best regards

rule "sz_r"
    when

I don’t recall if using special characters in the rule name has an effect or not but maybe try changing the name, e.g. sz_r to szr.

If you could, post the items that are associated with the rule. Guy’s like @vzorglub are good at spotting the little things that can cause issues.

Thanks

Save the rule file and monitor openhab.log at the same time.
What do you get?

Just “refreshing SZ.rule”
No error or warning

Is that the only rule in this file?
If yes, delete the file or move it.
And then recreate it or move it back.
If not, put this rule in it’s own file.

There is nothing in the Rule itself that looks like it would cause a problem.

Add some logInfo statements to the Rule. Importantly make the first line of the Rule be a logInfo and then watch both events.log and openhab.log and make sure that every time sz_r_sw changes state your see at least that first log statement.

Also add an else with a logWarn or logError in case sz_r_sw.state isn’t one of the indicated options.

All of this is to figure out whether indeed the Rule isn’t triggering, or whether the Rule is triggering but not doing anything because sz_r_sw is not in an expected state.

Finally, because I can’t help myself, the code would be easier to read if you use a switch:

    logInfo("Rollershutter", "About to process a new sz_r_sw.state")
    var rsVal = 0
    switch(sz_r_sw.state) {
        case "0": rsVal = 0
        case "1": rsVal = 65
        case "2": rsVal = 80
        case "3": rsVal = 100
        default: {
            logError("Rollershutter", "Unexpected value for sz_r_sw: " + sz_r_sw.state)
            return;
        }
    }

    sz_r.sendCommand(rsVal)

@rlkoshak Will try both of your suggestions, I was not aware that your way is also possible, Much easier.
Maybe tomorrow or sunday I will have the issue again.

@vzorglub Single rule file, and already recreated

THX and regards

It’s me again. Issue reoccoured.
This is my log:

21:05:33.151 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'sz_r_sw ' received command 1
21:05:33.161 [INFO ] [smarthome.event.ItemStateChangedEvent] - sz_r_sw  changed from 3 to 1

21:05:37.766 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'sz_r_sw ' received command 2
21:05:37.773 [INFO ] [smarthome.event.ItemStateChangedEvent] - sz_r_sw  changed from 1 to 2

and my rule:

then
logInfo("sz_r.rules", "begin")
        if (sz_r_sw .state == "0") {
                logInfo("sz_r.rules", "0")
                sz_r.sendCommand(0)  }
        else if (sz_r_sw .state == "1") {
                logInfo("sz_r.rules", "1")
                sz_r.sendCommand(65)  }
        else if (sz_r_sw .state == "2") {
                logInfo("sz_r.rules", "2")
                sz_r.sendCommand(80)  }
        else if (sz_r_sw .state == "3") {
                logInfo("sz_r.rules", "3")
                sz_r.sendCommand(100)  }
        else
        logInfo("sz_r.rules", "nothing")
end

so the rule is NOT executed. strange.
Wil now try @rlkoshak s rule format

There are TWO logs. The contents of the logInfo go to openhab.log, not events.log. What is in openhab.log?

Double check that your rule name is unique.
I experienced trouble with duplicated rule names.

nothing in oh.log

Try changing the rule trigger and use the receivedCommand implicit variable

rule "sz_r"
when
    Item sz_r_sw received command
then
    logInfo("sz_r.rules", "begin")
    val String swState = receivedCommand
    if (swState == "0") {
        logInfo("sz_r.rules", "0")
        sz_r.sendCommand(0)
    }
    else if (swState == "1") {
        logInfo("sz_r.rules", "1")
        sz_r.sendCommand(65)
    }
    else if (swState == "2") {
        logInfo("sz_r.rules", "2")
        sz_r.sendCommand(80)
    }
    else if (swState == "3") {
        logInfo("sz_r.rules", "3")
        sz_r.sendCommand(100)
    }
    else logInfo("sz_r.rules", "nothing")
end

The name ‘recievedCommand’ cannot be resolved to an item

same problem with your better readable rule