Storing Data locally in Raspberry-Pi with Lorawan Gateway

Hi @xoseperez ,

I am facing problem in TC_TRUST. What exactly I have put Value in TC_TRUST variable? Can you help me with that?

Thanks in Advance!!!

The TC_TRUST is the server certificate created by the Ths Things Stack instace on first boot (or when some of the important variables change, like TTS_DOMAIN). You can fetch that certificate using the get_certificate command from within the container like stated here: GitHub - xoseperez/the-things-stack-docker: The Things Stack LoRaWAN Network Server (Open Source Edition) on a Raspberry Pi using docker

Hi @xoseperez,

As you suggested I have run the Command ( ```
docker exec stack ./get_certificate.sh


 basicstation:
    image: xoseperez/basicstation:latest
    container_name: basicstation
    restart: unless-stopped
    privileged: true
    network_mode: host
    labels:
        io.balena.features.kernel-modules: '1'
        io.balena.features.firmware: '1'
        io.balena.features.dbus: '1'
        io.balena.features.supervisor-api: '1'
        io.balena.features.balena-api: '1'
    environment:
        MODEL: RAK5146
        TC_KEY: NNSXS.XS2ECSUDA4D3QS2G2AFADNQKT6VAJED5USINVRY.PP3ICMNOYOBFRT7AXRBZQ5KJQGPYISRBEKEGQGBX44DC6NUDGXBQ
        TC_TRUST: -----BEGIN CERTIFICATE-----
                            MIIDvDCCAqSgAwIBAgIUCcpBuBXyY/it8GmWNq5nQ+Bb/WwwDQYJK                                                                                                    oZIhvcNAQELBQAwZDELMAkGA1UEBhMCRVMxEjAQBgNVBAgTCUNhdGFsdW55YTESMBAGA1 
UEBxMJQmFyY                                                                                                             2Vsb25hMRYwFAYDVQQKEw1UVE4gQ2F0YWx1bnlhMRUwEwYDVQQDEwwxOTIuMTY4LjAuODAwHhcNMjMwN                                                                                                             jE1MTMxOTAwWhcNMjgwNjEzMTMxOTAwWjBkMQswCQYDVQQGEwJFUzESMBAGA1UECBMJQ2F0YWx1bnlhM                                                                                                             RIwEAYDVQQHEwlCYXJjZWxvbmExFjAUBgNVBAoTDVRUTiBDYXRhbHVueWExFTATBgNVBAMTDDE5Mi4xN                                                                                                             jguMC44MDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMn0osPehGlxqnOr+ToSVpalBe859                                                                                                             lrzno4Adw8ImcSGO262u8r0wr+wOUq4B5M3HIcZELrPmDx3pbN2C42MiS40dnF4tPGMsbRcYWUXT5LCq                                                                                                             zt7PwBUS5h5hl/2jUnWMFtnHxGX1QeFy3dmkrDpwN94tqDBcyEL/zTwxRHPnlOEigSgvnJxjVjH02rBj                                                                                                             jUVHPggV63L7bK4z9Tq9w+Kf7FPpDmpyXEdKG/o/J4J3aPCynGCg9YbUrO7raSSwWfkYnEqy/YTaxga5                                                                                                             bw1FWLdwIr9iJqYW+7Ua+SNwQmr7rsEhfFy4MBE9bBpOuk5WhZzHHIoSC68F9VgQvf8gW6tp5MCAwEAA                                                                                                             aNmMGQwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQIwHQYDVR0OBBYEFC45r7XJ7c9I5                                                                                                             sTchiMfD4iNnQWIMB8GA1UdIwQYMBaAFC45r7XJ7c9I5sTchiMfD4iNnQWIMA0GCSqGSIb3DQEBCwUAA                                                                                                             4IBAQB9FvEvWP5BGf8jWByNtFqQwNkf2GFEH65kmJtdVyG8VyQgCDTikAAbc0mmlDWbtakC07bmKsdME                                                                                                             zmM+mc8cteWLBp74IvRxH5ECjP1zLoXiIm2SkSNaSnNdR8fwtqxFVd9huK2DhTbOiBlW1Mh5lqMJXKXA                                                                                                             jl/IjxOM3QkvTmLzhY9zJWV4980ngxfcbGFWHYoJNNAyK5+YNSzS+DtiMsURRQu/0gUkuBH7xxtfO/7z                                                                                                             f7Jk6MaS94yByZo57jxPMFGk9iaEBBi3+AKfvqztnpRqEUJXrTk4YKymTng0kY2jvrf53H7xAVEVJt9k                                                                                                             
          P67Gyh6LjVCBLrFB3lj8wIHAqLh
           -----END CERTIFICATE-----
        TLS_SNI: "false"

But then also, I am facing the same problem, Can you please help me?
Sorry for the trouble!!

Thanks in advance!!

You are trying to connect the basicstation service to the local network server, so you have to set the TC_URI to the local IP, something like:

TC_URI: "wss://192.168.1.150:8887"

Make sure you mount the 8887 port in your TTS service.

Also, all text variables should be quoted with double quotes.

Hi @xoseperez ,

Thank you so much for the help!

Now, it is connecting to TTN locally.

Great! Congratulations :grinning:

Hi @xoseperez ,

Thank you so much!!

Sorry, for one more doubt, How can I use Infux Db, because, In Node-Red, I have created a flow, where I used MQTT IN Node and Now I want to store data in Influx Db, but when I am writing the command it showin error. So, how can I use that?

Thanks in advance!!

The easiest way is to use the influxdb node for Node-RED: node-red-contrib-influxdb (node) - Node-RED. You have a few examples on how to use it in the node documentation from within Node-RED

Hi @xoseperez ,

I am trying to install influx db and node-red on raspberry-pi [Because I don’t want to use the from balena], but when I start the node-red it showing error that, node-red is already running. I had commented all the lines of influx db and node-red, in docker-compose.yml, but then also it is showing me error. So, How can, I stope both influx db and node red completely, which is there in your docker.
Can you please help me with this?

Thanks in advance!!!

Well, this goes beyond the scope of what we do at RAK :slight_smile:

First you should find out the running instance, if it’s a docker container it will show up with docker ps -a, then you can kill it and remove it. You can also remove it if you brought it up with docker-compose by typing docker compose down while at the folder with the docker-compose.yml file.

Hi @xoseperez ,

As you guided for downloading Things Stack Locally in Raspberry pi. It was working properly. But, Suddelny Now Gateway is not connecting. Below, I am attaching the error, Can you please help me this?

Thanks in advance!

Maybe the gateway changed the IP?
It’s recommended to have a fixed IP or, even better, a fixed server name (i.e. lns.myhome.com). The certificates in the TTS service are bundled with the domain name (TTS_DOMAIN variable).