Tested it with a different item / rules setup as you suggested rossko57:
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
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
[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.