We're working on an IOT device connected to a ThingsBoard panel.
The goal is that a user must be able to modify the settings of that device in 2 different ways:
- Direct connection through wifi
- Using a widget on ThingsBoard
The first way has already been implemented. Anyone using a smartphone or computer can connect to the wifi gateway of the device and display the settings in a web browser. Those settings are organized using a Json schema describing the UI of the webpage. The schema is using the standard format react-schema-form.
To implement the ThingsBoard widget, I'd like to use the same schema. That schema would be part of the widget, to describe its UI. Keeping the same schema is obviously to avoid maintaining 2 different definitions of the same settings.
I've been researching a way to do that in a widget but haven't found any answer. What I want to do is basically the same thing as what the Settings schema of a widget is doing. A Settings schema describes the UI of the settings. And I want to use a schema to describe the main UI of the widget. The Gateway widget is a good example of what I'm looking for. The UI of that widget is defined into a context ctx, which I guess embed a schema describing that UI. But I'm not sure how to find the schema embedded into ctx, and also not sure if that would help me doing what I want.
So the question is: How to define the UI of a ThingsBoard widget using a Json schema? I will have to declare the schema as a var into the Javascript section of the widget. Then, how to use that var to display the related UI?
Thanks for your help.