I am new to openHAB2, but have worked with Karaf in the past and I’m familiar with OSGi in general.
I am writing a binding for a legacy lighting gateway. When first configuring the binding to communicate with the gateway over an http REST api, the first step is to press a sync button on the lighting gateway, then make a rest API call from openHAB to generate a long lived token that will be used by openHAB for all requests to the gateway in the future (including after an openHAB restart, so it can’t only be in memory).
I have a configuration defined for my lighting gateway as a bridge, and right now I am setting an empty property called “token” in the thing.
When I create the bridge, I can see in the jsondb that it has stored an empty value for my token property.
However, in my code, after getting the access token in the bridge handler, I do this:
And if I view my thing in the UI, and press the “show properties” button, it correctly shows my token.
But in the jsondb, I never see the token property of my bridge thing updated to the value I set programtically, and if I restart openHAB, it reverts back to the blank value stored in the json db.
How do I get my in memory change of the property to persist to the db?