mpous / basicstation

LoRa Basicsâ„¢ Station - The LoRaWAN Gateway Software
https://doc.sm.tc/station
60 stars 30 forks source link

Send heart beat so TTN knows it's alive? #36

Closed marcelstoer closed 3 years ago

marcelstoer commented 3 years ago

If this is the wrong place to ask just tell me. I was considering the Balena forums but I thought since it's specific to this project GH would be more appropriate.

Just set up a Basics Station on Pi 4 with RAK2287 for the first time. I'm sold to Balena 😄 Apart from some stuff in the logs I don't yet understand (see at the bottom) the gateway seems to run fine.

However, I am a bit irritated about the TTN console showing "Last seen 30 minutes ago". The gateway is currently sitting idle on my desk (indoor) with no nodes around. Hence, no activity, no messages. The last data reported by the TTN console was the UP message

"22:00:46 Receive gateway status Versions firmware"2.0.4"package"2.0.4"platform"corecell - Firmware 2.0.4 - Protocol 2"...

By looking at the TTN console I can't be sure the GW is really up since the last status message was receive a long time ago. I have another Pi GW (non-Balena, DIY, IMST) on TTN v3 that still uses the old Semtech packet forwarder. That stack sends a status message every 30s. Hence, the TTN console knows immediately whether the GW is still around.

How about sending a heart beat i.e. GW status every 30s with this Basics Station as well?

Logs

 main  2021-08-17 20:00:49.465 [S2E:VERB]   TX power: 16.0 dBm EIRP
 main  2021-08-17 20:00:49.465 [S2E:VERB]             27.0 dBm EIRP for 869.4MHz..869.65MHz
 main  2021-08-17 20:00:49.465 [S2E:VERB]   JoinEui list: 0 entries
 main  2021-08-17 20:00:49.465 [S2E:VERB]   NetID filter: FFFFFFFF-FFFFFFFF-FFFFFFFF-FFFFFFFF
 main  2021-08-17 20:00:49.465 [S2E:VERB]   Dev/test settings: nocca=1 nodc=1 nodwell=1
 main  2021-08-17 20:01:30.423 [SYN:INFO] MCU/SX130X drift stats: min: -7.6ppm  q50: -18.1ppm  q80: -25.7ppm  max: -230.3ppm - threshold q90: -27.1ppm
 main  2021-08-17 20:01:30.423 [SYN:INFO] Mean MCU drift vs SX130X#0: -27.9ppm
 main  2021-08-17 20:01:48.278 [SYN:INFO] Time sync qualities: min=131 q90=189 max=1672 (previous q90=2147483647)
 main  2021-08-17 20:02:11.381 [SYN:INFO] MCU/SX130X drift stats: min: -7.6ppm  q50: -18.1ppm  q80: -26.2ppm  max: -374.0ppm - threshold q90: -26.7ppm
 main  2021-08-17 20:02:11.381 [SYN:INFO] Mean MCU drift vs SX130X#0: -35.7ppm
 main  2021-08-17 20:02:27.136 [SYN:VERB] Time sync rejected: quality=1468 threshold=189
 main  2021-08-17 20:02:50.239 [SYN:INFO] Time sync qualities: min=131 q90=185 max=1468 (previous q90=189)
 main  2021-08-17 20:02:54.440 [SYN:INFO] MCU/SX130X drift stats: min: -7.6ppm  q50: -17.6ppm  q80: -19.5ppm  max: -31.4ppm - threshold q90: -26.7ppm
 main  2021-08-17 20:02:54.440 [SYN:INFO] Mean MCU drift vs SX130X#0: -17.5ppm
 main  2021-08-17 20:02:56.541 [SYN:VERB] Time sync rejected: quality=205 threshold=185
 main  2021-08-17 20:03:10.193 [SYN:VERB] Time sync rejected: quality=190 threshold=185
 main  2021-08-17 20:03:32.247 [SYN:VERB] Time sync rejected: quality=1122 threshold=185
 main  2021-08-17 20:03:34.347 [SYN:VERB] Time sync rejected: quality=266 threshold=185
 main  2021-08-17 20:03:41.700 [SYN:INFO] MCU/SX130X drift stats: min: -6.7ppm  q50: -22.4ppm  q80: -26.7ppm  max: -27.6ppm - threshold q90: -27.1ppm
mpous commented 3 years ago

Hello @marcelstoer looks like the websocket connection has been lost maybe between the TTS and your gateway. With UDP (the old packet forwarder) the only way to maintain a connection opened was to feed it with messages, in theory websockets should solve this, but sounds like it's not being solved. Maybe we should add someone from The Things Industries here to solve this?

marcelstoer commented 3 years ago

In hindsight I don't remember why I created this issue here. I now think it's unrelated to the Balena Basics Station but a more general usability issue maybe between Basics Station and the TTN console. Feel free to close it.

On the gateway overview both devices look fine as you've got that "connected" statement.

TTN-console-GW-overview

On the detail page you get confirmation the old device is really alive as it sends a UDP datagram every 30s.

TTN-console-UDP-status

The detail page for devices connected over websockets left me puzzled at first (coming from the UDP experience). The "last seen" time being far in the past to me suggested the device might have disappeared. Only the little blue dot indicates the device is still connected. Hence, my suggestion to send status messages regularly.

TTN-console-web-socket-status
mpous commented 3 years ago

Yes! I agree that the experience is completely different and maybe frightening :)

I'm going to close the issue at the moment, and keep checking if the device keeps online with the websockets even the last seen is from hours ago.