Get device data using API

Hello,

I have installed ChirpStack and connected my gateway.
I have two temperature sensor on this gateway and would like to get those devices data when they updated.
I want to get the temperature of each sensor every 20 minutes.

I read the documentation about API. However, I did not manage to get the datas.
Does anyone know how to get the data through the API ?

Please use one of the integrations. By default all this data is published over MQTT, but there are other integrations that you can setup too (e.g. POST to HTTP endpoint, …).

I tried using MQTT but I only get my Gateway.
I want to get the sensor’s value.
When I do:

mosquitto_sub -d -t "gateway/#"   #I get information about the gateway
mosquitto_sub -d -t "application/2/#"  #I do not have any information about my sensor, nothing happen 

How should I do this ?

I do not know if this can help, but here is the part of the config file that talks about event and such:

  # Event topic template.
  event_topic_template="gateway/{{ .GatewayID }}/event/{{ .EventType }}"

  # State topic template.
  state_topic_template="gateway/{{ .GatewayID }}/state/{{ .StateType }}"

  # Command topic template.
  command_topic_template="gateway/{{ .GatewayID }}/command/#"

And in the log of my gateway I have:

user.err chirpstack-gateway-bridge[15633]: time="2022-07-04T09:26:14Z" level=error msg="integration/mqtt: subscribe gateway error" error="execute command topic template error: template: event:1:36: executing \"event\" at <.CommandType>: can't evaluate field CommandType in type struct { GatewayID lorawan.EUI64 }" gateway_id=SomeID

These are the gateway events (GW <> NS). What you probably are looking for is the application/# MQTT topic (from the MQTT integration). This topic is for the AS <> end-application communication.