Hi,
Is it possible to register LoRa node device without using Web UI ?
Hi,
Is it possible to register LoRa node device without using Web UI ?
Yes you can, by using the gRPC or REST API. See also: https://docs.loraserver.io/lora-app-server/integrate/rest/. You can also directly use the LoRa Server gRPC API. For the description of this API see: https://github.com/brocaar/loraserver/blob/master/api/ns/ns.proto
Can you please share link for any sample application
I don’t have sample applications, but when you use /api
as path instead on the same host as the Web UI (e.g. https://localhost:8080/api), you’ll get a web-interface / console for the REST api of LoRa App Server.
Okay. Thank you so much …I will try same and update
Hi
currently I am getting below mentioned log while running loraserver in system.
–
:/home/cpu# ./loraserver --net-id 010203 --band IN_865_867 --postgres-dsn postgres://loraserver_ns:dbpassword@/loraserver_ns?sslmode=disable --gw-server-jwt-secret i31egubGv9W1QnFYRmRrqdEHop8JRwO+kc58vWCt7bA=
INFO[0000] starting LoRa Server band=“IN_865_867” docs=“https://docs.loraserver.io/” net_id=010203 version=0.22.0
INFO[0000] setup redis connection pool url=“redis://localhost:6379”
INFO[0000] connecting to postgresql
INFO[0000] backend/gateway: connecting to mqtt broker server=“tcp://localhost:1883”
INFO[0000] setup application-server client pool ca_cert= tls_cert= tls_key=
INFO[0000] configuring join-server ca_cert= server=“http://localhost:8003” tls_cert= tls_key=
INFO[0000] no network-controller configured
INFO[0000] starting api server bind=“0.0.0.0:8000” ca-cert= tls-cert= tls-key=
INFO[0000] starting gateway api server bind=“0.0.0.0:8002” ca-cert= tls-cert= tls-key=
INFO[0000] backend/gateway: connected to mqtt server
INFO[0000] backend/gateway: subscribing to rx topic topic=“gateway/+/rx”
INFO[0000] backend/gateway: subscribing to stats topic topic=“gateway/+/stats”
How can I see incoming payloads from LoRa node for debugging at server side purpose?
When I am staring loaserver after starting lora-gateway-bridge ,I am getting below messages
ERROR: relation “gateway” does not exist at character 15
STATEMENT: select * from gateway where mac = $1
ERRO[0003] handle stats packet error: get gateway error: select error: pq: relation “gateway” does not exist
Can you please comment on the logs
sudo -u postgres psql
psql (9.4.5)
Type “help” for help.
postgres=# /dt
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------±--------------±----------±--------±------±----------------------
loraserver_as | loraserver_as | SQL_ASCII | C | C |
loraserver_ns | loraserver_ns | SQL_ASCII | C | C |
postgres | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
(5 rows)
postgres-# \c loraserver_ns
You are now connected to database “loraserver_ns” as user “postgres”.
loraserver_ns-# \dt
No relations found.
loraserver_ns-# \l
I am thinking like gateway named table is not created.- Is that the issue?
Is this version okay??
Hello,Do you feel that the table in database is not getting created because of psql version change?
Installation Requirement link says psql 9.6 and I deployed psql 9.4
Note that PostgreSQL 9.5+ is required
When your PostgreSQL version is below that version, it is very likely that this could be the cause. 9.5+ is a hard requirement. Please refer also to the log messages of LoRa (App) Server. They should give you some hints too.
Hi Brocaar,
Currently, I am using Postgres 9.6.6
but I am facing same issue
ERROR: relation “gateway” does not exist at character 15
STATEMENT: select * from gateway where mac = $1
ERRO[0003] handle stats packet error: get gateway error: select error: pq: relation “gateway” does not exist
–
Postgres verified using below command and out put for your reference
G18M:~$ psql -h localhost -U loraserver_as -W loraserver_as
Password for user loraserver_as:
psql (9.6.6)
Type “help” for help.
loraserver_as=>
loraserver_as=> \q
G18M:~$
Don’t forget to set the --db-automigrate
flag (this applies to both LoRa Server and Lora App Server, in case you’re also installing the latter). Please refer to the configuration documentation.
in case you’re also installing the latter
Sorry I didn’t understand your comment.
When I tried with --db-automigrate gateway does not exist message still getting
INFO[0170] gateway: stat packet received addr=192.168.4.155:47013 mac=aa555a0000000101
INFO[0170] gateway: sending udp packet to gateway addr=192.168.4.155:47013 protocol_version=2 type=PushACK
INFO[0170] backend: publishing packet topic=“gateway/aa555a0000000101/stats”
INFO[0134] backend/gateway: gateway stats packet received mac=aa555a0000000101
ERRO[0134] handle stats packet error: get gateway error: gateway does not exist
Can you please comment on something like in what context we may get this kind of message
You didn’t create the gateway but LoRa Server received stats for that gateway, hence the error it can’t handle it since it doesn’t know about the gateway MAC. Please see the --gw-create-on-stats
config. All config options: https://docs.loraserver.io/loraserver/install/config/
Ihave tried with below
1 ./lora-gateway-bridge --mqtt-server tcp://192.168.4.150:1883 &
2. ./loraserver --net-id 010203 --band IN_865_867 --db-automigrate --postgres-dsn postgres://loraserver_ns:dbpassword@/loraserver_ns?sslmode=disable --gw-server-jwt-secret pvReQM/cnxWNepAnVIZ+XlNuJ8YhFIx8yD9VIAhjYmI= --gw-create-on-stats
Log for your response
G18M:~$ INFO[0000] starting LoRa Gateway Bridge docs=“https://docs.loraserver.io/lora-gateway-bridge/” version=2.1.5
INFO[0000] backend: connecting to mqtt broker server=“tcp://192.168.4.150:1883”
INFO[0000] gateway: starting gateway udp listener addr=0.0.0.0:1700
INFO[0000] backend: connected to mqtt broker
INFO[0008] gateway: received udp packet from gateway addr=192.168.4.155:53568 protocol_version=2 type=PullData
INFO[0008] backend: subscribing to topic topic=“gateway/aa555a0000000101/tx”
INFO[0008] gateway: sending udp packet to gateway addr=192.168.4.155:53568 protocol_version=2 type=PullACK
INFO[0009] gateway: received udp packet from gateway addr=192.168.4.155:56658 protocol_version=2 type=PushData
INFO[0009] gateway: stat packet received addr=192.168.4.155:56658 mac=aa555a0000000101
INFO[0009] gateway: sending udp packet to gateway addr=192.168.4.155:56658 protocol_version=2 type=PushACK
INFO[0009] backend: publishing packet topic=“gateway/aa555a0000000101/stats”
G18M:~$ loraserver --net-id 010203 --band IN_865_867 --db-automigrate --postgres-dsn postgres://loraserver_ns:dbpassword@/loraserver_ns?sslmode=disable --gw-server-jwt-secret pvReQM/cnxWNepAnVIZ+XlNuJ8YhFIx8yD9VIAhjYmI= --gw-create-on-stats
INFO[0000] starting LoRa Server band=“IN_865_867” docs=“https://docs.loraserver.io/” net_id=010203 version=0.22.0
INFO[0000] setup redis connection pool url=“redis://localhost:6379”
INFO[0000] connecting to postgresql
INFO[0001] backend/gateway: connecting to mqtt broker server=“tcp://localhost:1883”
INFO[0001] setup application-server client pool ca_cert= tls_cert= tls_key=
INFO[0001] configuring join-server ca_cert= server=“http://localhost:8003” tls_cert= tls_key=
INFO[0001] no network-controller configured
INFO[0001] applying database migrations
INFO[0001] backend/gateway: connected to mqtt server
INFO[0001] backend/gateway: subscribing to rx topic topic=“gateway/+/rx”
INFO[0001] backend/gateway: subscribing to stats topic topic=“gateway/+/stats”
INFO[0001] migrations applied count=0
INFO[0001] starting api server bind=“0.0.0.0:8000” ca-cert= tls-cert= tls-key=
INFO[0001] starting gateway api server bind=“0.0.0.0:8002” ca-cert= tls-cert= tls-key=
INFO[0018] gateway: received udp packet from gateway addr=192.168.4.155:53568 protocol_version=2 type=PullData
INFO[0018] gateway: sending udp packet to gateway addr=192.168.4.155:53568 protocol_version=2 type=PullACK
INFO[0028] gateway: received udp packet from gateway addr=192.168.4.155:53568 protocol_version=2 type=PullData
INFO[0028] gateway: sending udp packet to gateway addr=192.168.4.155:53568 protocol_version=2 type=PullACK
INFO[0038] gateway: received udp packet from gateway addr=192.168.4.155:53568 protocol_version=2 type=PullData
INFO[0038] gateway: sending udp packet to gateway addr=192.168.4.155:53568 protocol_version=2 type=PullACK
INFO[0039] gateway: received udp packet from gateway addr=192.168.4.155:56658 protocol_version=2 type=PushData
INFO[0039] gateway: stat packet received addr=192.168.4.155:56658 mac=aa555a0000000101
INFO[0039] backend: publishing packet topic=“gateway/aa555a0000000101/stats”
INFO[0039] gateway: sending udp packet to gateway addr=192.168.4.155:56658 protocol_version=2 type=PushACK
INFO[0027] backend/gateway: gateway stats packet received mac=aa555a0000000101
INFO[0027] gateway created mac=aa555a0000000101
INFO[0048] gateway: received udp packet from gateway addr=192.168.4.155:53568 protocol_version=
gateway does not exist error is not coming now.
Thank you for your valuable input
Hi Brocaar,
I am very new to REST apis .
Can you please give some more guidance to use the grPC API.I am using Krogoth Yocto Linux distribution(ARM platform).I have only Linux console. So I would like to explore more on node creation ,receiving data without WebUI.
Hi Brocaar, Can you suggest me that for getting data from LoRa END device(without webui) which APIs need to be checked gRPC or REST in my Linux platform.