Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Persistent data for a binding
Persistent data for a binding [message #1753954] Mon, 13 February 2017 10:25 Go to next message
David Bennett is currently offline David BennettFriend
Messages: 5
Registered: February 2017
Junior Member
How do I make a persistent data result for a binding? Can I change the configuration of the binding and then save it out to persistent storage? I am using editConfiguration but it seems to not save the data back out to persistent storage. Is there a way to make this happen? Or should I store this in something else?

Thanks,
David.
Re: Persistent data for a binding [message #1754056 is a reply to message #1753954] Tue, 14 February 2017 08:19 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
It depends on what data you want to store. You can access the "userdata" space through ConfigConstants.getUserDataFolder() and create a subdirectory if you need complex data. If it is about changing thing configurations, you can do so within your handler (but note that it will only be persisted, if the Thing is defined in the database and not in a static *.things file).
Re: Persistent data for a binding [message #1754134 is a reply to message #1754056] Tue, 14 February 2017 16:32 Go to previous messageGo to next message
David Bennett is currently offline David BennettFriend
Messages: 5
Registered: February 2017
Junior Member
I want to change the bridge configuration. I do have it defined in a things file though... Tricky Wink If I do it without it being in a thing file, can I setup the config pieces in code so when you go to add the bridge it will show the config requests? It is an access key I have for an oauth connection. I need to store it somewhere so I can get it back next time. There is no way to persist the config when it is in a thing file? I can see other config options that the user changes are persisted in there, just not the data I am trying to set in the code.
Re: Persistent data for a binding [message #1754197 is a reply to message #1754134] Wed, 15 February 2017 09:01 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
The user has to decide: Either he provides the configuration himself (incl. the OAuth token) in a things file OR he stores the Thing in the database (by creating it e.g. through the Paper UI) and manages it through UI/code.

If you use e.g. a credentials OAuth flow, that might be ok: You have the credentials within the static thing configuration and get a new access token during runtime (which is kept in memory and not persisted, but that's fine).
For other cases, the recommendation to the user should probably be to NOT define the Things statically, but rather use discovery and creation through a UI.
Re: Persistent data for a binding [message #1755399 is a reply to message #1754197] Thu, 02 March 2017 21:58 Go to previous messageGo to next message
David Bennett is currently offline David BennettFriend
Messages: 5
Registered: February 2017
Junior Member
I am making all my stuff through discovery. I don't like config files at all which is why I am writing these bindings in the first place. I hate to write a config file, because it is more maintenance to keep them up to date. This means I was making the thing through the discovery setup but it was still not writing the value out. I ended up using the zwave technique of writing my own separate file, as you pointed out above, but really it would be better if the config saved itself out.
Re: Persistent data for a binding [message #1755416 is a reply to message #1755399] Fri, 03 March 2017 07:59 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
How did you edit the configuration? If you call editConfiguration() and updateConfiguration() from within your ThingHandler, it should definitely be persisted. If this is not the case, please enter an issue about it!
Previous Topic:Build failed Eclipse SmartHome Model Items
Next Topic:How to Pre-populate "Location Field" for Thing in Paper UI's autodiscover Inbox
Goto Forum:
  


Current Time: Tue Apr 16 15:58:58 GMT 2024

Powered by FUDForum. Page generated in 0.72617 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top