ttn-zh / ic880a-gateway

Reference setup for iC880a gateways running The Things Network
GNU General Public License v3.0
455 stars 210 forks source link

TTN V3 Migration #76

Open tobiascrackz opened 3 years ago

tobiascrackz commented 3 years ago

Hello all :) Is there already a guide on how to migrate this Gateway (Raspi + IC880) to TTN V3? Since there are always issues and migration differs from gateway to gateway this would be really awesome.

Gepro-TeusVerbeek commented 3 years ago

I just tried it. It seems very simple.

I have a local configuration so I just updated local_conf.json in /opt/ttn-gateway/bin. I changed the server address from router.eu.thethings.network to eu1.cloud.thethings.network.

If you have remote configuration configured you can change it in your remote file.

I think the script needs an update where the correct server address is selected whether you want to connect with stack V2 or V3. Or maybe the server address is automatically updated at some point so that the V3 stack gets the router.eu.thethings.network address.

gonzalocasas commented 3 years ago

Yes, the gateway migration is very simple but please do not do it generally just now. If you check the forum, or ttnmapper and many other resources, you'll find that applications need to be migrated first, otherwise, devices not compatible with v3 will stop being able to send data. So, we're actually postponing the gateway migration for a later time in the year.

dbrgn commented 3 years ago

There's a note now in the docs:

Since version 3.13 (released in May, 2021), The Things Network V2 routes traffic back and forth to The Things Stack Community Edition. When migrating your gateways to The Things Stack Community Edition, the coverage of the public community network won’t be impacted.

This means that we can start migrating our gateways now, right?

gonzalocasas commented 3 years ago

Oh cool! Yep, that might indicate so! Thanks for pointing it out!

hatyri commented 3 years ago

Is there an address specification somewhere else than Install.sh on line 182. If not, is it enough?

change

echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"$GATEWAY_EUI\",\n\t\t\"servers\": [ { \"server_address\": \"router.eu.thethings.network\", \"serv_port_up\": 1700, \"serv_port_down\": 1700, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >$LOCAL_CONFIG_FILE

to

echo -e "{\n\t\"gateway_conf\": {\n\t\t\"gateway_ID\": \"$GATEWAY_EUI\",\n\t\t\"servers\": [ { \"server_address\": \"eu1.cloud.thethings.network\", \"serv_port_up\": 1700, \"serv_port_down\": 1700, \"serv_enabled\": true } ],\n\t\t\"ref_latitude\": $GATEWAY_LAT,\n\t\t\"ref_longitude\": $GATEWAY_LON,\n\t\t\"ref_altitude\": $GATEWAY_ALT,\n\t\t\"contact_email\": \"$GATEWAY_EMAIL\",\n\t\t\"description\": \"$GATEWAY_NAME\" \n\t}\n}" >$LOCAL_CONFIG_FILE
colonelmoutarde68 commented 3 years ago

I tried to upgrade my gateway to TTN v3 by updating the server address to eu1.cloud.thethings.network, and then by recreating it (with a new name) and event reinstalling the whole thing, but no success, it always says "• Disconnected" !

umbertowski commented 2 years ago

I tried to upgrade my gateway to TTN v3 by updating the server address to eu1.cloud.thethings.network, and then by recreating it (with a new name) and event reinstalling the whole thing, but no success, it always says "• Disconnected" !

i have the same problem

gonzalocasas commented 2 years ago

the script is now updated to point to v3 by default. please try and let me know. Later this year, we'll do a bigger update and switch to basicstation.

Gerard880 commented 2 years ago

Hello Gonzalocasas, Where can i find the updated script? regards, Gerard.

TTNIdrija commented 2 years ago

$ cd ~/ic880a-gateway $ sudo ./install.sh

dbrgn commented 2 years ago

Full migration guide if you use local configuration:

If you use remote configuration, then I think you'll simply have to update your config in https://github.com/ttn-zh/gateway-remote-config instead, and point it to eu1.cloud.thethings.network, followed by sudo ./install.sh spi.

colonelmoutarde68 commented 2 years ago

Tried to reinstall the whole thing with the new script but still no luck (ic880a spi version)

dechantw commented 2 years ago

I don t know what s wrong. Using the latest setup script, its not possible to get the gateway connected.

MystikReasons commented 2 years ago

I have the exact same problem. The 880a is working just fine with the integrated test scripts on the RPI 4 but I can't get it connected to the TTN network.

And I noticed that the start.sh script isn't working, since the packet-forwarder does not exist like that anymore.

dechantw commented 2 years ago

Has somewone an idea where i can found the log files on the gateway. I m not so familar with Linux.

dbrgn commented 2 years ago

You should be able to follow the log in real-time with sudo journalctl -u ttn-gateway -f. Use sudo journalctl -u ttn-gateway -r to view the logfile in reverse order. Or sudo journalctl -u ttn-gateway --since="1h ago" to view the log of the last hour.

dechantw commented 2 years ago

Thats the log, I don t know what it means. On the other side I have tried to add a sensor under v3, its close to my gateway, but also no success. ttn@ttn-gateway:~/ic880a-gateway $ sudo journalctl -u ttn-gateway -f -- Logs begin at Thu 2016-11-03 18:16:42 CET. -- Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # RF packets forwarded: 0 (0 bytes) Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # PUSH_DATA datagrams sent: 1 (220 bytes) Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # PUSH_DATA acknowledged: 100.00% Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: ### [DOWNSTREAM] ### Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # PULL_DATA sent: 3 (100.00% acknowledged) Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # PULL_RESP(onse) datagrams received: 0 (0 bytes) Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # RF packets sent to concentrator: 0 (0 bytes) Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # TX errors: 0 Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: ### [GPS] ### Aug 29 20:33:56 ttn-gateway ttn-gateway[377]: # Invalid gps time reference (age: 1630262036 sec)

lostall2 commented 2 years ago

i had the same problem like @dechantw : --> # Invalid gps time reference (age: 1630262036 sec)

The ic880a has no gps module, so I turned GPS off in: cd opt/ttn-gateway/bin --> global_conf.json

Now it's working!

lostall2 commented 2 years ago

Now I have a new problem. After a few hours, the online status of the gateway in the TTS stack only shows "Receive Gateway Status". No more messages are received. Reset pin is set correctly. Anyone have an idea? Unbenannt

BerndGaykema commented 2 years ago

Yes, the gateway migration is very simple but please do not do it generally just now. If you check the forum, or ttnmapper and many other resources, you'll find that applications need to be migrated first, otherwise, devices not compatible with v3 will stop being able to send data. So, we're actually postponing the gateway migration for a later time in the year.

It is now "later in the year". I really like to migrate the gateway to V3. My json file (for automatic configuration) is still the original version from 4 years ago, pointing to router.eu.thethings.network.

Do I have to be more patient or is the Zurich team on the edge to update there stuff to make migration peace a cake?

gonzalocasas commented 2 years ago

Yes, now is "later in year". Go for it! ;) Updating is trivial, just update the server to the new V3 servers.

BerndGaykema commented 2 years ago

Sorry for being stupid, but how do I do that? I just created the gateway again, using the step-by-step instructions here. It is using the JSON file, found here.

How do I update this remote json file? It is only you who can do that? It is this one (B827EBFFFE0060A9.json). I also understand that this file is no longer up-to-date regarding what is required by V3: it requires more modern stuff, see here.

I was hoping on an updated step-by-step guidance so that it is possible for me to have the gateway activated again, but now on V3.

I would be very grateful if you could help me (and others I suppose who build the Zurich-gateway) here. Thank you very much.

sprokkie commented 2 years ago

i have the same question, how to perform the update ?

Gerard880 commented 2 years ago

Hello, My 2 cents. Deleted the V2 Gateway entry. Downloaded raspberry sw (raspios-buster-armhf-lite.img). installed on new SDcard using Balena etcher. Adjusted manually the settings like SSH/Memory size/ Wifi using:sudo raspi-config. Pi used is a model 3B. Then connected the ic880a module. Followed the "Zurich" script. Made a new Gateway entry and its working fine. I work with sensors who are reporting airpollution and they use LoRa after my update of the gateway V2 to V3 they still come in fine without any adjustments on their side. Regards.

sprokkie commented 2 years ago

there must be a simpler way ill gues, Gonzalocasas says update. Ill hope he will tell the "trick"

dbrgn commented 2 years ago

@sprokkie did you read the thread above?

Full migration guide if you use local configuration:

  • Create gateway in the new backend (https://console.cloud.thethings.network/)
  • On the Raspberry Pi, use "git pull" to fetch the latest version of the setup script
  • Run sudo ./install.sh spi (or without "spi" if you have the non-SPI version)
  • Ensure that the gateway shows up as connected in the new backend
  • Remove gateway from old backend

If you use remote configuration, then I think you'll simply have to update your config in https://github.com/ttn-zh/gateway-remote-config instead, and point it to eu1.cloud.thethings.network, followed by sudo ./install.sh spi.

sprokkie commented 2 years ago

i cannot change anything in the https://github.com/ttn-zh/gateway-remote-config changed the remote config json file on the pi, that did not work

Tried the update still no result. now wait until my config file is updated

tried the guide above got this error: fatal: destination path '/home/pi/ic880a-gateway' already exists and is not an empty directory. after the git clone

Julianb663 commented 2 years ago

Hi All I too have an 880a and i too have tried every trick i can think of but still the gateway is showing as disconnected I have the correct updated Json file but is there a way of seeing why the TTN server is rejecting requests to log on ? If i run the sudo journalctl -u ttn-gateway -f command i see the following , Not sure if this helps anyone

There is a failure in the log but im not sure what it means and how to fix it

Oct 22 16:36:17 ttn-gateway ttn-gateway[288]: ln: failed to create symbolic link '/opt/ttn-gateway/bin/local_conf.json': File exists

pi@ttn-gateway:~ $ sudo journalctl -u ttn-gateway --since="1h ago" -- Logs begin at Fri 2021-10-22 16:34:57 BST, end at Fri 2021-10-22 16:44:48 BST. -- Oct 22 16:35:16 ttn-gateway systemd[1]: Started The Things Network Gateway. Oct 22 16:35:18 ttn-gateway ttn-gateway[288]: [TTN Gateway]: Waiting for internet connection... Oct 22 16:36:03 ttn-gateway ttn-gateway[288]: /opt/ttn-gateway/gateway-remote-config /opt/ttn-gateway/bin Oct 22 16:36:14 ttn-gateway ttn-gateway[288]: Already up to date. Oct 22 16:36:15 ttn-gateway ttn-gateway[288]: HEAD is now at 4a52d38 Merge pull request #1659 from df1qq/master Oct 22 16:36:15 ttn-gateway ttn-gateway[288]: /opt/ttn-gateway/bin Oct 22 16:36:17 ttn-gateway ttn-gateway[288]: [TTN Gateway]: Use Gateway EUI B827EBFFFE09A31A based on eth0 Oct 22 16:36:17 ttn-gateway ttn-gateway[288]: ln: failed to create symbolic link '/opt/ttn-gateway/bin/local_conf.json': File exists Oct 22 16:36:50 ttn-gateway ttn-gateway[288]: Poly Packet Forwarder for Lora Gateway Oct 22 16:36:50 ttn-gateway ttn-gateway[288]: Version: 2.1.0 Oct 22 16:36:50 ttn-gateway ttn-gateway[288]: Lora concentrator HAL library version info Oct 22 16:36:50 ttn-gateway ttn-gateway[288]: Version: 3.1.0; Options: native;

sprokkie commented 2 years ago

How did you update the json file ?

Julianb663 commented 2 years ago

Hi All I think i may have fixed my issue
I copied the Json file from the TTN console page ....

and pasted into the empty !!! local_conf.json file its located in opt/ttn-gateway/bin directory

hope that helps

BerndGaykema commented 2 years ago

I'll wait for an updated "from zero to LORAWAN in a weekend", including a modified json file if needed. It gives me too much headache to find all the puzzle pieces on the www.

sprokkie commented 2 years ago

Hi All I think i may have fixed my issue I copied the Json file from the TTN console page ....

and pasted into the empty !!! local_conf.json file its located in opt/ttn-gateway/bin directory

hope that helps

I changed that file, after reboot it was back to the wrong server address :(

BerndGaykema commented 2 years ago

I had my modified json file merged into the master (thanks gonzalocasas). I started from scratch and rebuild the SD-card for my RPi, using the new global json file.

The gateway is on air again. I see the gateway data in my newly created gateway V3.

One thing was not clear, and that is the FREQ PLAN. Which to use? There are more EU options to choose from. I took SF9 for RX2 (recommended), but there is also a SF12 for RX2. What is the difference?

Last point is "CLAIM GATEWAY". Is this recommended to do?

fuma01 commented 2 years ago

hello all,

for me, the following procedure worked to migrate the ic880a gateway to V3:

  1. modify your json file on https://github.com/ttn-zh/gateway-remote-config and change server to "eu1.cloud.thethings.network"
  2. connect you gateway with ssh and go to directory cd /opt/ttn-gateway/gateway-remote-config
  3. check the server in your json file with nano B827EBXXXXXXXXXX.json, at my case the old ttn server was written here
  4. remove the whole directory "gateway-remote-config" with cd .. and sudo rm -r gateway-remote-config
  5. clone the modified repository sudo git clone https://github.com/ttn-zh/gateway-remote-config
  6. now also the "local_conf.json" at cd /opt/ttn-gateway/bin should be updated with the new server
  7. restart sudo reboot
  8. gateway is connected at "eu1.cloud.thethings.network/console"