How can I get a topic subscribe for a certain organizaiton or special applicationID?

we have some some organizations and each organization have some applications. We want to use mqtt subscibe for certain app to get the data of one organization and even a special application. But we found that in the config file can only designed like this:

MQTT integration backend.

[application_server.integration.mqtt]

Event topic template.

event_topic_template=“application/{{ .ApplicationID }}/device/{{ .DevEUI }}/event/{{ .EventType }}”

Command topic template.

command_topic_template=“application/{{ .ApplicationID }}/device/{{ .DevEUI }}/command/{{ .CommandType }}”

how can we make a specail topic for a certain organization? And we found that every organization may have an applicationID=1 , and how can we distinct which organization is from the topic?

This is currently not possible.

And we found that every organization may have an applicationID=1 , and how can we distinct which organization is from the topic?

That is not possible. Each application record has an unique ID in the PostgreSQL database :slight_smile:

Sorry for topic revival but the ability to subscribe to all organization devices is really a nice feature because chirpstack has the great ability to have multiple organizations so not subscribing to one of these is a missing option.
Of course I can subscribe to each appID of the organization but it become complicated in our case since we have multiple org with multiple app and each time we add an app we need to add a subscription topic is not the easiest way.

Any chance to expose OrganizationID field so we can do something like that?

  # MQTT integration backend.
  [application_server.integration.mqtt]
  # Event topic template.
  event_topic_template="organization/{{ .OrganizationID }}/device/{{ .DevEUI }}/event/{{ .EventType }}"

  # Command topic template.
  command_topic_template="organization/{{ .OrganizationID }}/device/{{ .DevEUI }}/command/{{ .CommandType }}"

and of course still have application if needed

  # MQTT integration backend.
  [application_server.integration.mqtt]
  # Event topic template.
  event_topic_template="organization/{{ .OrganizationID }}/application/{{ .ApplicationID }}/device/{{ .DevEUI }}/event/{{ .EventType }}"

  # Command topic template.
  command_topic_template="organization/{{ .OrganizationID }}/application/{{ .ApplicationID }}/device/{{ .DevEUI }}/command/{{ .CommandType }}"

@hallard

You can use MQTT wildcards for device data follow the below blog of MQTT wild cards.

Like: application/+/device/+/event/#

Using the above topic, you will receive all the messages from all the devices

MQTT Topics, Wildcards, & Best Practices - MQTT Essentials: Part 5 (hivemq.com)

1 Like

thanks @sagarpatel, I’m aware of this and my issue as stated by this post is that I need to subscribe to all devices of a specific organization (that may contains one or more applications) not all devices of all organizations

This is currently not supported (yet).

@brocaar, awesome, yet, does this mean only in V4 ?

Hi @brocaar
Any hints on this one, I’ve got more and more applications and organization and it’s becoming hard to maintain table with which applications belongs to organization.

Thanks

I’m happy to look into this if this can be added to v4. Could you please create a GitHub issue for this (GitHub - chirpstack/chirpstack: ChirpStack open-source LoRaWAN Network Server).

Thanks,

That’s done on this one

1 Like