1

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.

Guillaume
  • 33
  • 5
  • Have you seen this section in the documentation? https://thingsboard.io/docs/user-guide/contribution/widgets-development/#settings-schema-section - It's worth noting that any UI generation from JSON Schema is library specific and not a stanadard. – Relequestual Apr 29 '21 at 09:04
  • Yes, I've been looking at that part of the documentation carefully. That's exactly what I would like to do, but those "Settings schema" sections are related to specific Settings UI. I would like to do the exact same thing, but to display the UI of the widget. – Guillaume May 04 '21 at 04:46
  • Everyone keeps saying "look at the tb widget development guide" when it's extremely scarce on explanation and how all these modules interact with each other. The documentation gives a bare bones explanation on how to format and that's it. – jabroni Jul 24 '23 at 01:18

0 Answers0