Detecting whether a thing is discovered or created via .things

Anyone know if there is a way to determine if a thing was created via discovery or via a .thing file? I could do something annoying like setting a property in discovery that probably wouldn’t be set in a .thing file and check for that - but I’d rather not go that route but I can’t think of anything else right now…

Don‘t have a solution for you but would like to know why you need to have that information.
What makes the difference?

There may be a way but not sure easiest I know is remove your things files and see what’s left.
You could possibly look at the Jason dB also.

I guess he is developing a binding and wants change some attributes from within the binding.

1 Like

@job thanks I missed that. The question makes more sense now.

Check the things files if the thing exists in one of them…

I’m not sure how consistent the “editable” property is in practice (Things from files being "editable": false)

That would leave the problem of distinguishing “discovered” Things from those manually created in PaperUI.

1 Like

Would take way too long of a post to explain the why but I can give you a very high level view. The sony binding will discover a device, then discover all the channels specific to that device (which is a VERY costly operation). However, a user could override both of those by creating a .thing file (for the device with the specific channels they want). I was hoping to detect when they were using a .thing file. Without going into a bunch of details - most of the workarounds you’d suggest won’t work (ie detect channels being generated, thing type, nbr of channels and most other regular things) because I’d get too many false positives.

I’ve considered that but not sure if I want to do something so cumbersome (ie read each file and try to find the thing id). That’s kinda my last chance thing if I can’t find a better way

At the moment, setting a property in discovery (internalDiscovered or something like that) seems to be the most reasonable approach.


1 Like

Lol - I didn’t miss that but was looking around for it. Could you give me some context on this editable property? I can’t seem to find any good references to it…

I don’t know how you access it within a binding, any more than I do any other property.
It’s clearly visible if you use REST API to get a Thing, which should show you the structure.

I believe the ordinary use is to block PaperUI attempts to modify xxx.things file originating Things, because that would be a silly thing to attempt.
EDIT - reminded the description may be “managed” and “unmanaged” Things, may be more useful searching docs.