Search code examples
thingsboard

How do I show all my customers on a widget in ThingsBoard?


Given that I have this kind of hierarchy in my Thingsboard:

-Root Customer
--Customer 1
---Child 1.1
--Customer 2
---Child 2.1
---Child 2.2

, where Customer 1 and Customer 2 have their own admin accounts I need to show all customers that a user has access to on a widget.

The problem is that I can not make a correct alias for a widget to get "all my customers" as a list.

  • Root Customer must see Customer 1 and Customer 2 and their children.
  • Customer 1 should see "Child 1.1" and "Child 1.2"
  • Customer 2 should see "Child 2.1" and "Child 2.2"

I have tried:

  • Entity list, but it there is no option to show all (or idk how to do it)
  • Entity name, but there is no wildcard of that I know, so I can only filter them, but not show all
  • Relation query, but it doesn't show Customers inside any chosen Customer

So question is: How do I make a proper alias to show "My Customers" in the widget


Solution

  • I found the answer myself.

    Ownership in Thingsboard is not a Relation. So you have to manually create those relations inside the entity as they are not automatically created.

    So even if Root Customer owns Customer 1, they are still not related unless you explicitly created that relation.

    So Customer Hierarchy page shows you hierarchy based on ownership, but widgets only show it by Relation.