Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OH3 - Rule missing in Main UI - therefore not beeing triggered #2138

Closed
DJPsycho82 opened this issue Jan 20, 2021 · 8 comments
Closed

OH3 - Rule missing in Main UI - therefore not beeing triggered #2138

DJPsycho82 opened this issue Jan 20, 2021 · 8 comments

Comments

@DJPsycho82
Copy link

Platform information:
Hardware: Raspberry Pi 4B 2GB
OS: Openhabian 1.6.2 64Bit
Java Runtime Environment: Java 11
openHAB version: 3.1.0 Testing

Issue of the topic: Rules aren’t triggered, do not show in main UI, after saving the file, the rule shows in main UI and can be triggered again.

Today a rule wasn’t triggered so I checked the main UI what the rule was doing there and it didn’t exist there (happened after reboot). So I saved the rule file again (after adding a clear line) and the rule popped up and was to be executed. I don’t have any log errors or warnings about this.

Happened multiple times now after reboot, i.e. for several rules / files. The total count of rules in the Main UI does change when the rule is added after save. I have 215 rules in total, but maybe a bit more if some aren’t calculated at this moment. Every rule in my files start with 1 - , 2 - , 3 - , 4 - , etc. The reason I did this is it’s easier to bug fix because of the error in openhab.log [Script execution of rule with UID ‘test-1’ failed:] > the first rule in that file. Some of my files have 15 rules, so it’s more easy to find :slight_smile:

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/oh3-rule-missing-in-main-ui-therefore-not-beeing-triggered/114806/10

@Rossko57
Copy link

Possible simple (repeatable?) demo of problem here
https://community.openhab.org/t/rules-disappear-when-items-are-reloaded/114984

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/rules-disappear-when-items-are-reloaded/114984/3

@kaikreuzer
Copy link
Member

If there is a reproducible test case, please provide it here with the issue description.
Also provide the distro build number to make sure that it already includes #2077.

@DJPsycho82
Copy link
Author

How can I check my build number? I upgraded to Testing version, but when I login with SSH i supposed to get the build number but it says 3.0.0 release build.

this was a reproducible test case for me:

Create one Item in test.items:

Switch Test_Switch “Test Switch”

And one Rule in test.rules:

rule “Switch Changed”
when
Item Test_Switch changed
then
logInfo("", “Test_Switch changed”)
end

Add a space to test.items and save.

Logs:
2021-01-21 21:05:55.140 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘test.items’
2021-01-21 21:07:10.739 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘test.rules’
2021-01-21 21:07:37.524 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘test.items’

Look at the rules and “Switch Changed” has disappeared.

@DJPsycho82
Copy link
Author

DJPsycho82 commented Jan 23, 2021

If there is a reproducible test case, please provide it here with the issue description.
Also provide the distro build number to make sure that it already includes #2077.

Tested it with a different item / rules setup as rossko57 suggested on the community page:

I created in my test.items an extra test item, so I have there:

Switch      TestLed                     "Test LED"                                  [ "Switchable" ]
Dimmer      TestDimmer                  "TestDimmer"
Number      OutputPreset                "Preset audio apparaat"
String      OutputName                  "Uitvoer apparaat" 
Switch      Testschakelaar              "Alleen voor test"                                          <siren>
Switch      Testschakelaar2             "Alleen voor test"                                          <siren> 

I created an extra test2.rules file, so I have test.rules and test2.rules. In both rules files I use items from test.items and test2.items. And both rules files have multiple rules which use items from test and test2.

Tested a couple of situations:

  • change and save the test2.items file (Only testschakelaar2 item exist in this file)
    > result > only the rules from test2.rules disappear >> This time I did NOT use testschakelaar2 in test.rules

  • change and save the test2.items file (Only testschakelaar2 item exist in this file)
    > result > only the rules from test2.rules disappear >> I DID use testschakelaar2 in test.rules

  • change and save the test.items file (testschakelaar item and others exist in this file)
    > result > only the rules from test.rules disappear >> I DID use some items in test2.rules

So for me it's clear. If the items filename is the same as the rules filename and the items file is changed if only an extra space, ALL the rules from the file with that same name are deleted from the main UI. They come back when the rule file is saved and loaded again. I tested this with my normal setup and when I save an item file with the same name as a rules file, all my rules disappear in the main UI.

I didn't notice earlier that all the rules where gone, but that's not very strange I think. A lot of my item files don't change, so those rules (files) don't get messed up. A lot of my item files have different name then the rules files so there is also nothing going wrong. Some item files have the same names but mostly when I change something in my setup, I first add the item due to the loadtimes which are a bit long on a Raspberry pi 4b. While i'm coding everything is loading, after that i'm saving the rules file, everthing is good. But sometimes I change an item because of a typo in the label, another icon, adding to a group, etc. That item file is the same as a rules file, but I didn't do anything with those rules that day, so it feels like it's random when rules disappear but it isn't :slight_smile:

I'm gona rename my xxxx.rules files to xxx_ma.rules. for the simple reason I'm currently building a master slave setup and I want to use some of the files from the master on the slave but with minor changes (if master is down > then execute, kind of stuff). I know i'm gonna copy a lot of files upcoming weeks so it's better to have different names because of a f*ckup overwrite :slight_smile:

[something different I encountered]
while testing with 2 items, 2 item files, 2 rules files and total of 4 rules. The system just doesn't like the same rules copied with different titles. I'm sure nobody has exactly!! the same rules copied with different titles, but it's strange. 2 Of them load, 2 other identical (except title) didn't load.

@DJPsycho82
Copy link
Author

This is solved in 3.0.1

@sqw534
Copy link

sqw534 commented Feb 13, 2021

This is solved in 3.0.1

Are you sure? Just upgraded from 2.5 to 3.0.1 and stumbeld over exact this issue. Luckely does your comments helped me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants