Problem with ThingUpdated (Text Files)

Tags: #<Tag:0x00007f174f2d70e0> #<Tag:0x00007f174f2d6de8> #<Tag:0x00007f174f2d6c80>

While debugging my binding I have an issue where if I update the configuration of a thing it doesn’t always call ThingUpdated()

Sometimes i just get:

2021-02-23 12:22:10.132 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Sonoff.things'

Other times I get the full:

2021-02-23 12:22:10.132 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Sonoff.things'
2021-02-23 12:22:10.227 [DEBUG] [noff.internal.handler.AccountHandler] - Sonoff - Running dispose()

I’m not sure whether its a bug in the core or not or whether this is intended design.
Steps to reproduce:
1: Start fresh (clear cache etc) with value for bridge set to accessmode="local"
Binding starts and all is normal
2: Change things file to accessmode="cloud"
ThingUpdated() gets called and works
3: Change to another mode accessmode="mixed"
ThingUpdated() gets called and works
4: Change back to original value on startup accessmode="local"
ThingUpdated() doesn’t get called

It seems that The thing manager caches the original value and doesn’t call thingUpdated as its already there. Maybe this is a limitation of text files??

There is a known bug in openHAB where it doesn’t always properly refresh the Things contained within a Things file after that Things file has been saved. Perhaps this is the same issue? Here’s what I do as a workaround

Thanks for confirming @hafniumzinc
I didn’t think I was going mad… literally spent hours trying to iron this out :frowning:

And yes, the way i was working round was to corrupt the file and re-init.

Are the devs aware of this? (filed on github?)