# Not receiving MQTT message for Gateway status topic

**URL:** <https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215>\
**Category:** The Things Stack v3\
**Tags:** gateways, mqtt\
**Created:** [May 25, 2022, 1:34pm UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215 "2022-05-25T13:34:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmonji](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tmonji/32/35697_2.png) [@tmonji](https://www.thethingsnetwork.org/forum/u/tmonji)\
**Post date:** [May 25, 2022, 1:34pm UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215/1 "2022-05-25T13:34:21Z")

</div>

I’m new to MQTT and I try to subscribe to `gateway status` topic from my local running typescript program but it doesn’t receive any message for `gateway status` topic at all. This program also subscribe to another topic and messages for that topic is properly received. I login to TTN console to check gateway information and found that gateway status is published every 30 seconds. I thought it maybe because of permission problem, so I added `Grant all current and future rights` to API Key of Application but still no message for gateway status topic have received.  
This is the topic I use to subscribe to gateway status `v3/<gateway-id>@ttn/status`. I get gateway-id from TTN console.

![gateway-id](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/b/4/b4a940b02d5f6224ecf6e29a052c192262e249b9.png)

![gateway_status_log](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/8/d/8d276f0579260a02364424d7d3cfacbe777895be.png)

Additional Info:  
I found that there is no `View gateway status` right in API Key for Application but Gateway and Organization’s API Key. So I generated Organization’s API Key with `Grant all current and future rights` and tried to connect with `<Organization ID>@ttn` as an username and Organization’s API Key as a password but rejected. So I Tried to connect with `<Application ID>@ttn` as an username and Organization’s API Key as a password then it was successfully connected but still having same result. Receiving only messages for another topic but message for `gateway status` is still not received ☹

---

<div class="post-metadata">

**Author:** ![htdvisser](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/htdvisser/32/45312_2.png) [@htdvisser](https://www.thethingsnetwork.org/forum/u/htdvisser)\
**Post date:** [May 27, 2022, 6:45am UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215/3 "2022-05-27T06:45:23Z")

</div>

There is no such thing as a “gateway status” topic on our MQTT API. The [documentation](https://www.thethingsindustries.com/docs/integrations/mqtt/#subscribing-to-upstream-traffic) lists the different topics you can subscribe to.

The “Live data” for gateways that you see in the Console is retrieved using the [Events API](https://www.thethingsindustries.com/docs/reference/api/events/), which is a gRPC API (with an HTTP SSE API trough our gRPC gateway). These kind of events are not and will not be available over MQTT.

---

<div class="post-metadata">

**Author:** ![tmonji](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tmonji/32/35697_2.png) [@tmonji](https://www.thethingsnetwork.org/forum/u/tmonji)\
**Post date:** [May 27, 2022, 9:47am UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215/4 "2022-05-27T09:47:36Z")

</div>

In [here](https://www.thethingsindustries.com/docs/reference/api/gateway_server_mqtt/#gateway-status-messages) it talks about “gateway status” topic. I cannot subscribe to it? Or to subscribe to it, I need to let my gateway publish `v3/<gateway-id>@ttn/status` topic first? then I can subscribe to it?

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [May 27, 2022, 1:12pm UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215/5 "2022-05-27T13:12:09Z")

</div>

That is for gateways that use MQTT to send messages to the Gateway Server rather than using Packet Forwarder or Basic Station software. It’s between the gateway & the TTI stack only.

---

<div class="post-metadata">

**Author:** ![bertrik](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bertrik/32/35697_2.png) [@bertrik](https://www.thethingsnetwork.org/forum/u/bertrik)\
**Post date:** [May 28, 2022, 10:33am UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215/6 "2022-05-28T10:33:55Z")

</div>

I wrote a Java program to connect to the gateway event API, receive events and log them to a CSV file. This is not MQTT though. Basically it receives the same kind of events that you see in the gateway live view in the console. Perhaps that can help/inspire you to create what you need. Code is at:

> **[GitHub - bertrik/ttn-gateway-collector: Collects data from multiple TTN (v3)...](https://github.com/bertrik/ttn-gateway-collector)**
>
> Collects data from multiple TTN (v3) gateways for LoRaWAN traffic analysis - GitHub - bertrik/ttn-gateway-collector: Collects data from multiple TTN (v3) gateways for LoRaWAN traffic analysis

To read the event stream, you need the id of the gateway and an API key with permission ‘Read gateway traffic’.

---

<div class="post-metadata">

**Author:** ![Johan\_Scheepers](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/johan_scheepers/32/46550_2.png) [@Johan\_Scheepers](https://www.thethingsnetwork.org/forum/u/Johan_Scheepers)\
**Post date:** [May 28, 2022, 1:44pm UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215/7 "2022-05-28T13:44:27Z")

</div>

There are two other API but they are more basic information around gateways.

~[https://mapper.packetbroker.net/api/v2/gateways?distanceWithin[latitude]=-\*\*latitude\*\*&distanceWithin[longitude]=\*\*longitude\*\*&"distance"Within[distance]=\*\*distance\*\*&netID=000013&tenantID=ttn](https://mapper.packetbroker.net/api/v2/gateways?distanceWithin%5Blatitude%5D=- **latitude** &distanceWithin%5Blongitude%5D= **longitude** &%22distance%22Within%5Bdistance%5D= **distance** &netID=000013&tenantID=ttn)

This is to find all gateways from latitude & longitude with in a distance (distance units is meters)

[https://mapper.packetbroker.net/api/v2/gateways?distanceWithin[latitude]=53.57500181643252&distanceWithin[longitude]=-2.4573224889439444&distanceWithin[distance]=15000&netID=000013&tenantID=ttn](https://mapper.packetbroker.net/api/v2/gateways?distanceWithin%5Blatitude%5D=53.57500181643252&distanceWithin%5Blongitude%5D=-2.4573224889439444&distanceWithin%5Bdistance%5D=15000&netID=000013&tenantID=ttn)

```auto
,{"netID":"000013","tenantID":"ttn","id":"swinton-iot-balticbroadband","eui":"313532352F006100","clusterID":"eu1.cloud.thethings.network","updatedAt":"2022-05-28T13:24:01.692752Z","location":{"latitude":53.50798297588821,"longitude":-2.338129878044129,"altitude":12,"accuracy":0},"antennaPlacement":"OUTDOOR","antennaCount":1,"online":true}
,{"netID":"000013","tenantID":"ttn","id":"swinton-iotltd","eui":"313532352F006100","clusterID":"eu1.cloud.thethings.network","updatedAt":"2022-01-29T12:17:08.171899Z","location":{"latitude":53.50784682420188,"longitude":-2.336736668898618,"altitude":8,"accuracy":0},"antennaCount":1,"online":false}
,{"netID":"000013","tenantID":"ttn","id":"living-lab-gateway-2","clusterID":"eu1.cloud.thethings.network","updatedAt":"2022-01-26T18:17:31.57097Z","location":{"latitude":53.53912914816647,"longitude":-2.619622349739075,"altitude":0,"accuracy":0},"antennaCount":1,"online":false}
]

```

~[https://mapper.packetbroker.net/api/v2/gateways/netID=000013,tenantID=ttn,id=\*\*id](https://mapper.packetbroker.net/api/v2/gateways/netID=000013,tenantID=ttn,id=**id)\*\*

This is to get a bit of details of a gateway.

[https://mapper.packetbroker.net/api/v2/gateways/netID=000013,tenantID=ttn,id=g-s3-testgw042-ttig-bl3-hp10](https://mapper.packetbroker.net/api/v2/gateways/netID=000013,tenantID=ttn,id=g-s3-testgw042-ttig-bl3-hp10)

`{"netID":"000013","tenantID":"ttn","id":"g-s3-testgw042-ttig-bl3-hp10","eui":"58A0CBFFFE803658","clusterID":"eu1.cloud.thethings.network","updatedAt":"2022-02-14T20:11:45.523223Z","location":{"latitude":53.56933,"longitude":-2.461042,"altitude":130,"accuracy":0},"antennaPlacement":"INDOOR","antennaCount":1,"online":false,"frequencyPlan":{"region":"EU_863_870","loraMultiSFChannels":[868100000,868300000,868500000,867100000,867300000,867500000,867700000,867900000]},"rxRate":659.8765,"txRate":13.466868}`

> [@New API for gateway mapping, status and info](https://www.thethingsnetwork.org/forum/t/new-api-for-gateway-mapping-status-and-info/49778/21):
>
> A Node-red tool around the TTN Gateway Radius and Gateway API [image]

---

<div class="post-metadata">

**Author:** ![system](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/6/2/6250ea44fd2b0d6259489e1a92748df681e1f970.png) [@system](https://www.thethingsnetwork.org/forum/u/system)\
**Post date:** [May 30, 2022, 4:54pm UTC](https://www.thethingsnetwork.org/forum/t/not-receiving-mqtt-message-for-gateway-status-topic/57215/8 "2022-05-30T16:54:34Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
