Rule not working correct after change a item

Hello all :slight_smile:

  • Platform information:
    • Hardware: Raspberry Pi 4 Model B Rev 1.1
    • OS: openhabian
    • openHAB version: 3.0.1 - Release Build

If I change a item, the rule will not work correct. Here I show you my steps, at the beginnig everything is fine:
Item file:

Switch SW_Test                      
String Str_Test                     // { expire="5s,Noooo" }

Rule file:

rule "Test Rule"
when
    Item SW_Test changed
then
    Str_Test.sendCommand("Yesss")
end

After SW_Test changed I got these Log:

23:39:19.316 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'Test.rules'
23:39:25.161 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'SW_Test' received command ON
23:39:25.168 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SW_Test' changed from OFF to ON
23:39:25.176 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Str_Test' received command Yesss

Til now OK :slight_smile:
And then I change the item Str_Test to:

String Str_Test          { expire="5s,Noooo" }

In Test Rule nothing changed and the Log look like this:

23:44:15.368 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'Test.items'
23:46:06.284 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'SW_Test' received command OFF
23:46:06.289 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SW_Test' changed from ON to OFF

Why does not change the item Str_Test?
Now I must change something in the rule file that Test.rules is loading und after that it works fine.

rule "Test Rule" // tutututut
when
    Item SW_Test changed
then
    Str_Test.sendCommand("Yesss")
end
23:51:48.124 [INFO ] [del.core.internal.ModelRepositoryImpl] - Loading model 'Test.rules'
23:51:55.023 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'SW_Test' received command ON
23:51:55.031 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'SW_Test' changed from OFF to ON
23:51:55.042 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Str_Test' received command Yesss
23:52:00.304 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Str_Test' changed from Yesss to Noooo

That means whenever I change a item I must reload all rule files? It can’t really be, can it?
I allready clean the cache and reboot the Raspberry. I also replaced sendCommand with postUpdate but the same behaviour :frowning:
Regards
Steffen

Yes. Editing an file created Item causes a loss of “connection” to file created rule triggers.

For now, to recover you edit/reload the rules file.

Avoid doing that if you can, it generally causes more problems at the next restart until populated again.

Thank you. Good to know that I’m not alone :slight_smile:
I already thought I had forgotten everything about items and rules again.