Updating Things file with comments results in error: Could not remove element: null

My Thing file looks like this

181224-1800 MaxG: newly created; v2 bindings need these

Thing <binding_id>:<type_id>:<thing_id> "Label" @ "Location" [ <parameters> ]
binding : thing-type : name (default for systeminfo is machine name, rpi3ohv2; can be anything, here 'work', or could be 'thismachine', etc.)
Thing systeminfo:computer:local [interval_high=3, interval_medium=60]
Thing ntp:ntp:local [ hostname="au.pool.ntp.org", refreshInterval=600, refreshNtp=30 ]
Thing astro:sun:home  [ geolocation="-25.3164855,153.3701568", interval=60 ]
Thing astro:moon:home [ geolocation="-25.3164855,153.3701568", interval=60 ]
// https://www.openhab.org/addons/bindings/astro/
// not clear which set#start OH would use
Thing astro:sun:home [ geolocation="-25.3164855,153.3701568", interval=60 ] {
        Type start : set#start [

… and when removing all comments, it throws the following error

2018-12-25 10:46:52.756 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'max01.things'
2018-12-25 10:46:52.792 [WARN ] [ore.common.registry.AbstractRegistry] - Could not remove element: null
java.lang.NullPointerException: null

Any ideas how to fix this would be much appreciated.

I don’t know how well .things file supports multi line /* style comments.

The error is coming from the registry. I would expect the file either has a syntax error or somehow it got into a weird state. Have you tried restarting oh?

I saved an empty file; then a oneliner, which was the systeminfo, and then a second entry (astro:sun).
Tried another empty file, then astro:sun… works, added systeminfo and it throws the error.

Just restarted OH, but also changed to single line comments – no more errors on the things file.

(Silly me, what fixed it? restart or single line comment; ouch)

Thanks ! :slight_smile:

I tested this and added single and multiline comments in various lenghts and at different times to an existing .things file and got zero errors. Must have been somekind of catching error that got solved by restarting oh. Maybe it tried to delete a non existent thing.

Hi, mate,
i don’t know if this is the problem at all. But i read somewhere that if the Regional settings in Paper UI and the settings in the .things file do not match it can cause problems (or messages in the logger) as the paper UI tries to update the .things file and this is “read only”. I think it was a post of @Kai .
Merry x-mas to you and have fun in the summertimes
Cheers, Peter

1 Like

Yes, there are sometimes weird things happening, and I end up chasing ghosts.

Just had a rules file which threw an error; commented out all rules and brought them back one after the other. Mysteriously, the error was gone; yet the rules did not change. Go figure.

Yes, a more clear way could be to split the different “Things” in seperate files. This can reduce the time of troubleshooting.:wink:

1 Like