Giter VIP home page Giter VIP logo

chirpstack-application-server's Introduction

ChirpStack Application Server

Tests

ChirpStack Application Server is an open-source LoRaWAN Application Server, part of the ChirpStack open-source LoRaWAN Network Server stack. It is responsible for the node "inventory" part of a LoRaWAN infrastructure, handling of received application payloads and the downlink application payload queue. It comes with a web-interface and API (RESTful JSON and gRPC) and supports authorization by using JWT tokens (optional). Received payloads are published over MQTT and payloads can be enqueued by using MQTT or the API.

!!! ChirpStack v4 note !!!

With the release of ChirpStack v4, the source-code has been migrated to https://github.com/chirpstack/chirpstack/. Please refer to the v3 to v4 migration guide for information on how to migrate your ChirpStack v3 instance.

Architecture

architecture

Component links

Links

License

ChirpStack Application Server is distributed under the MIT license. See also LICENSE.

chirpstack-application-server's People

Contributors

brocaar avatar chopmann avatar comet-gmbh avatar dependabot[bot] avatar dominikb avatar dtony avatar fancar avatar freek avatar hcwhan avatar iegomez avatar jcampanell-cablelabs avatar jimcatsentosa avatar johnroesler avatar krasi-georgiev avatar ltfschoen avatar mjl- avatar mmrein avatar moznion avatar pticator avatar pululuk avatar r-rayns avatar sa-wilson avatar safrone avatar sagar-patel-sls avatar siscia avatar sophiekovalevsky avatar sylveon avatar tomasol avatar tsvehagen avatar v-zhuravlev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chirpstack-application-server's Issues

Node session information disappeared in web-interface

Good day,

Yesterday my colleague has registered two nodes into Lora server with ABP protocol. We entered the Network session key and Application session key. Today when we visited the web interface again, the node session information of one of the nodes has been disappeared. However, we can find the Network session key and Application session key of that node in PostgreSQL. We are wondering whether the node session is expired. In this situation, do we need to register the nodes again? Waiting for your answer.

Best Regards,
Sam

Feature Request: Search nodes by tag

Is it hard to implement additional field in the node structure and API GET /api/nodes/{tag}?
It allows ability to manage collections of nodes by some tags.

MQTT AppEUI

Hi Brocaar
After the "Update MQTT handler so that it uses name of app and node" 249fe86 change it's harder to deploy configuration when a few existing applications are subscribed to own topics for data in particular formats. And there are no more AppEUI even in payload.

So, could you please add AppEUI info. For example, as field in payload.

500 Error API /nodes/{devEUI}/activation error: redigo: nil returned

I have a question.

I registered a node and can view it in UI and get it by API.
But on call to the API /nodes/{devEUI}/activation I get the 500 Error.

{
  "devEUI": "d000000000001234",
  "appEUI": "a000000000001234",
  "appKey": "fade0e9e2fab676d60600161d054fade",
  "rxDelay": 0,
  "rx1DROffset": 0,
  "channelListID": "0",
  "rxWindow": "RX1",
  "rx2DR": 0,
  "name": "device_d000000000001234",
  "relaxFCnt": false,
  "adrInterval": 0,
  "installationMargin": 0,
  "description": "d1234",
  "isABP": false,
  "applicationID": "13",
  "isClassC": false,
  "useApplicationSettings": true
}

{
  "error": "rpc error: code = 2 desc = get node-session d000000000001234 error: redigo: nil returned",
  "code": 2
}

This node was not joined and so has no session.

So, the question is:
Should I handle the 500 Error with code 2 or there should be some another response?

how to show the rx data?

Hi, Brocaar,

i can use the app server api ,and show the rx data number ,but i can't find the rx data ,can you give some advice ??

CORS API

Hello brocaar,
I want to write my own lora-app-server that communicate with your on JSON REST API. When I send an ajax-request from my site, I get response
"XMLHttpRequest cannot load https://a.b.c.d:8080/api/node?limit=25&offset=0. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://a.b.c.d:3001' is therefore not allowed access. The response had HTTP status code 405."
I did not find the setting for cross-domain requests interaction. Could you add it?

Make HTTPS optional

Hi,

I actually love HTTPS, and I would need it anywhere user facing.

However in this case, I believe it is a little too much, it makes deploy more convoluted and complex.

I would suggest to have an option to disable HTTPS, so that HTTPS still remain the default option.

When multiple nodes are sending to the server it throws: drop packets and re-joining begins.

Feb 22 14:37:15 lora-server lora-app-server[1246]: time="2017-02-22T14:37:15+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 5, packet_fcnt: 4)" application_name=Dikberd dev_eui=0004a30b0019dcf0 node_name=PIR1-SR type=DATA_UP_FCNT
Feb 22 14:37:15 lora-server lora-app-server[1246]: time="2017-02-22T14:37:15+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b0019dcf0/error"
Feb 22 14:37:15 lora-server lora-app-server[1246]: time="2017-02-22T14:37:15+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 4, packet_fcnt: 3)" application_name=Dikberd dev_eui=0004a30b001a0e31 node_name=PIR-Type-9 type=DATA_UP_FCNT
Feb 22 14:37:15 lora-server lora-app-server[1246]: time="2017-02-22T14:37:15+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b001a0e31/error"
Feb 22 14:37:19 lora-server lora-app-server[1246]: time="2017-02-22T14:37:19+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 5, packet_fcnt: 4)" application_name=Dikberd dev_eui=0004a30b0019dcf0 node_name=PIR1-SR type=DATA_UP_FCNT
Feb 22 14:37:19 lora-server lora-app-server[1246]: time="2017-02-22T14:37:19+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b0019dcf0/error"
Feb 22 14:37:19 lora-server lora-app-server[1246]: time="2017-02-22T14:37:19+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 4, packet_fcnt: 3)" application_name=Dikberd dev_eui=0004a30b001a0e31 node_name=PIR-Type-9 type=DATA_UP_FCNT
Feb 22 14:37:19 lora-server lora-app-server[1246]: time="2017-02-22T14:37:19+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b001a0e31/error"
Feb 22 14:37:32 lora-server lora-app-server[1246]: time="2017-02-22T14:37:32+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 5, packet_fcnt: 4)" application_name=Dikberd dev_eui=0004a30b0019dcf0 node_name=PIR1-SR type=DATA_UP_FCNT
Feb 22 14:37:32 lora-server lora-app-server[1246]: time="2017-02-22T14:37:32+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b0019dcf0/error"
Feb 22 14:37:32 lora-server lora-app-server[1246]: time="2017-02-22T14:37:32+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 4, packet_fcnt: 3)" application_name=Dikberd dev_eui=0004a30b001a0e31 node_name=PIR-Type-9 type=DATA_UP_FCNT
Feb 22 14:37:32 lora-server lora-app-server[1246]: time="2017-02-22T14:37:32+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b001a0e31/error"
Feb 22 14:37:41 lora-server lora-app-server[1246]: time="2017-02-22T14:37:41+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 5, packet_fcnt: 4)" application_name=Dikberd dev_eui=0004a30b0019dcf0 node_name=PIR1-SR type=DATA_UP_FCNT
Feb 22 14:37:41 lora-server lora-app-server[1246]: time="2017-02-22T14:37:41+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b0019dcf0/error"
Feb 22 14:37:42 lora-server lora-app-server[1246]: time="2017-02-22T14:37:42+01:00" level=error msg="invalid FCnt or too many dropped frames (server_fcnt: 4, packet_fcnt: 3)" application_name=Dikberd dev_eui=0004a30b001a0e31 node_name=PIR-Type-9 type=DATA_UP_FCNT
Feb 22 14:37:42 lora-server lora-app-server[1246]: time="2017-02-22T14:37:42+01:00" level=info msg="handler/mqtt: publishing error notification" topic="application/1/node/0004a30b001a0e31/error"

make build with undefined migrations.AssetDir erro

detail error message:

command-line-arguments

cmd/lora-app-server/main.go:70: undefined: migrations.AssetDir
cmd/lora-app-server/main.go:262: undefined: static.AssetDir
cmd/lora-app-server/main.go:263: undefined: static.AssetInfo
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

how to fix this? thanks

Delete the content of the downlinkQueue

Hello brocaar,
i want to syncronize the realtime clock from my nodes with a generated downlink packet.
Now i have the problem that sometimes more than one packet is stored in the downlinkQueue.
The result is an old timestamp (the oldest packet in the queue , FIFO) and a wrong clocktime at my nodes.
So, i want to clear the downlinkQueue. I write a curl command direktly at the raspberry pi like this:
curl -X DELETE --insecure --header 'Accept: application/json' 'https://xxx.xx.xx.xxx:8080/api/downlinkQueue/0004a30b001a2c98'
The answer is:
{"Error":"strconv.ParseInt: parsing "0004a30b001a2c98": invalid syntax","Code":2}
after that the queue is not empty.
What is my mistake. Is there a better way to clean the queue?
It is possible to define only one entry size for the queue?
Thank you very much for help and for your nice work.

join request invalid MIC

trying to connect to the application server by sending publishing message on MQTT , but finding following error
join-request invalid mic" app_eui=0101010101010101 dev_eui=0202020202020202 mic=[188 107 2 31]

Application ID is increased even if parameters are invalid

in following POST message, channelListID is invalid:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Grpc-Metadata-Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJsb3JhLWFwcC1zZXJ2ZXIiLCJhdWQiOiJsb3JhLWFwcC1zZXJ2ZXIiLCJuYmYiOjE0OTAxOTI5NjEsImV4cCI6MTQ5OTY1MzMwMCwic3ViIjoidXNlciIsInVzZXJuYW1lIjoianVsaWVuIn0.JdL95G69U_27fArOFKy0toLgqmpHMH3CucRaPYs4f_s' -d '{ \
"adrInterval": 10, \
"channelListID" : "800", \
"description": "this application has color blue", \
"installationMargin": 2, \
"isABP": true, \
"isClassC": false, \
"name": "sensor-blue", \
"relaxFCnt": true, \
"rx1DROffset": 0, \
"rx2DR": 0, \
"rxDelay": 10, \
"rxWindow": "RX1" \
}' 'https://localhost:8080/api/applications'

If you repeat the HTTP request a couple of times then you fix the request, the Application ID is increased by the number of invalid tries.
I don't know yet how the FPort and the application id are linked, but maybe it could break something

Node list not returned

Hei

There seems to be some issue with retuning the node list.
current config: loraserver on 0.12.3 lora-app-server on 0.1.3

When requesting the node list (GET /api/node) the result should be as per description
{ "result": [ { "appEUI": "string", "appKey": "string", "channelListID": "string", "devEUI": "string", "name": "string", "relaxFCnt": true, "rx1DROffset": 0, "rx2DR": 0, "rxDelay": 0, "rxWindow": "RX1" } ], "totalCount": "string" }

unfortunately it only replies with
{ "totalCount": "7" }
It gets the count, but does not display the actual nodes.

adding the offset and limit (GET /api/node/0/100) returns not found. Doing the same in the 0.1.1 version server, works flawlessly.

Br,
Kuldar Loime

Changing ABP session parameters not working

Hi, In last 2 releases (starting from version 0.5.0) there's a bug with updating ABP session parameters.
When no ABP parameters are used you may set them and it's OK, but afterwards if you want to change it to another values there's an error message:
"Error rpc error: code = 13 desc = transport is closing (code: 2)"

level=error msg="handler/mqtt: tx payload unmarshal error: invalid character 'M' looking for beginning of value" data_base64="TVRJeg=="

hi, brocaar

i test the downlink for 433Mhz, use \ " fot the cmd :

mosquitto_pub -t "application/0101010101010101/node/be7a0000000002d1/tx" -m "{\ "reference\ ":\ "abc\ ",\ "confirmed\ ":false,\ "devEUI\ ":\ "be7a0000000002d1\ ",\ "fPort\ ":2,\ "data\ ":\ "YWJj\ "}"

it's ok ,but use not \ " the cmd 👍
mosquitto_pub -t "application/0101010101010101/node/be7a0000000002d1/tx" -m "{"reference":"abc","confirmed":false,"devEUI":"be7a0000000002d1","fPort":2,"data":"YWJj"}"

it's not ok?? how can i modify the code to use the second cmd?

thank you very much .

"make test" failure

run:
docker-compose run --rm appserver bash
make requirements ui-requirements

but run "make test" failure

log:

10 total assertions

--- PASS: TestValidateDevNonce (0.01s)
=== RUN TestGetCFListForNode

Given an application, node (without channel-list) and channel-list with 2 channels ✘

Failures:

  • /home/cxk/lora/AS555/src/github.com/brocaar/lora-app-server/internal/storage/node_test.go
    Line 67:
    Expected: nil
    Actual: 'ping database error: dial tcp 127.0.0.1:5432: getsockopt: connection refused'

11 total assertions

--- FAIL: TestGetCFListForNode (0.01s)
=== RUN TestNodeMethods

Given a clean database with an application ✘

Failures:

  • /home/cxk/lora/AS555/src/github.com/brocaar/lora-app-server/internal/storage/node_test.go
    Line 118:
    Expected: nil
    Actual: 'ping database error: dial tcp 127.0.0.1:5432: getsockopt: connection refused'

12 total assertions

--- FAIL: TestNodeMethods (0.00s)
=== RUN TestUser

Given a clean database ✘

Failures:

  • /home/cxk/lora/AS555/src/github.com/brocaar/lora-app-server/internal/storage/user_test.go
    Line 20:
    Expected: nil
    Actual: 'ping database error: dial tcp 127.0.0.1:5432: getsockopt: connection refused'
    13 total assertions

--- FAIL: TestUser (0.01s)
FAIL
exit status 1
FAIL github.com/brocaar/lora-app-server/internal/storage 0.073s
? github.com/brocaar/lora-app-server/internal/storage/nsmigrate [no test files]
? github.com/brocaar/lora-app-server/internal/test [no test files]
? github.com/brocaar/lora-app-server/internal/test/testhandler [no test files]

Improve: Adding extra json field to db and api rest

Hi all,
I'm using this project and I would like to propose a tiny improvement that can consolidate future development and better decoupling loraserver data from end-user interfaces.

The idea is to add a postgresql json field [1] to all DB entries that can be retrieve and set using the rest API.

This can be used to store and retrieve additional and custom informations like ip for the gateways or tags for any device or other informations like tenant or acl for each entry, those informations are only stored "within" the entries and are used by upper-layer of the business logics.

Also #51 can be implemented on top of this feature without implement a custom field for each new request.

Thank you

  1. https://www.postgresql.org/docs/current/static/datatype-json.html

Letsencrypt SSL certificates

Using the letsencrypt service you can obtain the following files:
cert.pem chain.pem fullchain.pem privkey.pem

Can you please let me know which of these (and how) should be mapped onto the following environment variables?
HTTP_TLS_CERT
HTTP_TLS_KEY

Also, do any of the files .pem above need to be associated with the LoRaWAN server (or all associations need to be performed on the LoRa-app server)?

Thanks

Fail to make requirements ui-requirements

Hi, @brocaar

I try to build according to this procedure on docker.
However, make requirements ui-requirements command got following error

root@df1b6f81503b:/go/src/github.com/brocaar/lora-app-server# make requirements ui-requirements
Installing development tools
Installing UI requirements
/bin/sh: 1: npm: not found
Makefile:64: recipe for target 'ui-requirements' failed
make: *** [ui-requirements] Error 127

So, I modified Dockerfile as following and retry.
[Dockerfile]

RUN apt-get update
RUN apt-get -y install npm nodejs
RUN ln -s /usr/bin/nodejs /usr/bin/node

make requirements ui-requirements command succeeded.
However, make ui statics command got following error.

root@2c35fa3469fe:/go/src/github.com/brocaar/lora-app-server# make ui statics
Building ui

> [email protected] build /go/src/github.com/brocaar/lora-app-server/ui
> react-scripts build


/go/src/github.com/brocaar/lora-app-server/ui/node_modules/react-scripts/node_modules/cross-spawn/index.js:34
            throw new Error(
                  ^
Error: In order to use spawnSync on node 0.10 or older, you must install spawn-sync:

  npm install spawn-sync --save
    at Function.spawnSync [as sync] (/go/src/github.com/brocaar/lora-app-server/ui/node_modules/react-scripts/node_modules/cross-spawn/index.js:34:19)
    at Object.<anonymous> (/go/src/github.com/brocaar/lora-app-server/ui/node_modules/react-scripts/bin/react-scripts.js:22:22)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is most likely a problem with the ui package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts build
npm ERR! You can get their info via:
npm ERR!     npm owner ls ui
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.4.17-boot2docker
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! cwd /go/src/github.com/brocaar/lora-app-server/ui
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /go/src/github.com/brocaar/lora-app-server/ui/npm-debug.log
npm ERR! not ok code 0
Makefile:36: recipe for target 'ui' failed
make: *** [ui] Error 1

Network Operations Centre

It would be very cool if the lora-app-server would be able to provide an overview off the gateways reporting to it.

Key-metrics like rx/tx per minute per gateway or server wide. The average RSSI or SNR

What kind of metrics are more interesting to know about? Things like the cpu-load on the gateway would also be very nice; or the status of a certain GPIO pin (on a raspberry Pi) connected to a temperature sensor. Although these last metrics are not transmitted by default, they would be very cool to have :)

Payload receive wrong?

Hi

I have a problem, i am sending the payload "AAAAAA" and I get this

{"devEUI":"0012000000000001","time":"2016-11-22T21:39:24.860463Z","fPort":50,"gwCount":1,"rssi":-52,"data":"qqqqqg=="}
qos : 0, retain : false, cmd : publish, dup : false, topic : application/70b3d57ed0000dd4/node/0012000000000001/rx, messageId : , length : 173, Raw payload : 123341001011186985733458344848495048484848484848484848484934443411610510910134583450484954454949455050845049585157585052465654485254519034443410280111114116345853484434103119671111171101163458494434114115115105345845535044341009711697345834113113113113113103616134125

¿"qqqqqg==" not is equal to AAAAAA in base64?

Thanks

Starting the web interface

Hello everyone,
first of all thanks a lot for your great work,
I'm using a windows environment to set up the LoRaWAN backend,
So,i tried to use the CloudMQTT as a mqtt broker.The Bridge is working nicely and it handles to state of my Microchip Gateway.
For the two other element (loraserver and lora-app-server) i can't open the "inventory"interface.
I used the command to create a tls certification and key then i put them in the both directory of the loraserver and the lora-app-server.
When i try to access from my browser to the localhost:8080,i get a TLS handshake error in the lora-app-server line command.
I think i'm mistaking something somewhere.
Thanks in advance for any help
Mohammed.

Error pq: relation "gateway" does not exist (code: 2)

After upgrading loraserver to 0.16.1 and lora-app-server to 0.7.0 i get the following error on the "Manage Gateway" page, it appears like the gateway table in the database is not created correctly in the migration.

Error pq: relation "gateway" does not exist (code: 2)

port 8080 Unable to connect

cmd:
root@416d013cbef4:/go/src/github.com/brocaar/lora-app-server/build# ./lora-app-server
web:
https://192.168.1.103:8080/

         Unable to connect      
         Firefox can't establish a connection to the server at 192.168.1.103:8080.

log:
INFO[0000] starting LoRa App Server docs="https://docs.loraserver.io/" version=0.6.0
INFO[0000] connecting to postgresql
INFO[0000] setup redis connection pool
INFO[0000] handler/mqtt: connecting to mqtt broker server="tcp://mosquitto:1883"
INFO[0000] connecting to network-server api ca-cert= server="127.0.0.1:8000" tls-cert= tls-key=
INFO[0000] applying database migrations
INFO[0000] handler/mqtt: connected to mqtt broker
INFO[0000] handler/mqtt: subscribling to tx topic topic="application/+/node/+/tx"
INFO[0000] grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 127.0.0.1:8000: getsockopt: connection refused"; Reconnecting to {127.0.0.1:8000 }
INFO[0000] migrations applied count=0
INFO[0000] starting application-server api bind="0.0.0.0:8001" ca-cert= tls-cert= tls-key=
INFO[0000] starting client api server bind="0.0.0.0:8080" tls-cert="/etc/lora-app-server/certs/http.pem" tls-key="/etc/lora-app-server/certs/http-key.pem"
INFO[0000] registering rest api handler and documentation endpoint path="/api"
INFO[0001] grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 127.0.0.1:8000: getsockopt: connection refused"; Reconnecting to {127.0.0.1:8000 }

Data not received with MQTT !!

Hi Brocaar :) ,

Please i have a problem, i can't receive data with MQTT , the device join network OTAA without any problems then send data is successful but to see data with moquitto_sub doesn't work :/ please where is exactly the problem?

Thanks Brocaar :)

501 error when post or get using the api

when I try to use the api to create a new gateway, server returns the 501 error. Nevertheless, I can use the api to create new users.

Response Body
{
"error": "unknown method CreateGateway",
"code": 12
}
Response Code
501

This error confused me, and how can I solve it?

Let make build generate ui and statics if they haven't been generated yet

Hi
I am trying to run from master both docker compose and go build but those import are unreachable

	"github.com/brocaar/lora-app-server/internal/migrations"
	"github.com/brocaar/lora-app-server/internal/static"
main.go:36:2: cannot find package "github.com/brocaar/lora-app-server/internal/migrations" in any of:
...
main.go:37:2: cannot find package "github.com/brocaar/lora-app-server/internal/static" in any of:
...

"api/applications" only return "totalCount"

Hello brocaar,

When I try RESTful JSON Api: "api/applications". It return only the totalCount of applications and does not return the result set of the applications. How to make it also return the result set of the applications including application id, description, etc?

Thank you very much.

How to config DB table?

kakaotalk_20170220_205312006

When I try to access with web browser, after setup lora-app-server I got code:13 error message.
If I want to access app-server page, how to configure DB setting?

JWT, I need instructions or it is broken?

Hi,

I am having a lot of problem with JWT, I either need instruction or it is broken.

Let's move with order.

  1. To generate the JWT I use jwt-go, doing something like this:
$ cat key
secret
$ cat api.json 
{    "admin": true,                
    "apis": ["*"],          
    "apps": ["*"],  
    "nodes": ["*"]                 
}
$ jwt -key key -alg HS256 -sign api.json
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6dHJ1ZSwiYXBpcyI6WyIqIl0sImFwcHMiOlsiKiJdLCJub2RlcyI6WyIqIl19.46ppnIA4qJ4GgEC5awYMU3Km3qekVNUv6dGY4lhe6Pk
$ jwt -key key -alg HS256 -sign api.json | jwt -show -
Header:
{
    "alg": "HS256",
    "typ": "JWT"
}
Claims:
{
    "admin": true,
    "apis": [
        "*"
    ],
    "apps": [
        "*"
    ],
    "nodes": [
        "*"
    ]
}
$ jwt -key key -alg HS256 -sign api.json | jwt -key key -verify -
{
    "admin": true,
    "apis": [
        "*"
    ],
    "apps": [
        "*"
    ],
    "nodes": [
        "*"
    ]
}
$ jwt -key key -alg HS256 -sign api.json | jwt -debug -key key -verify -
Token len: 153 bytes
Header:
map[alg:HS256 typ:JWT]
Claims:
map[admin:true apis:[*] apps:[*] nodes:[*]]
{
    "admin": true,
    "apis": [
        "*"
    ],
    "apps": [
        "*"
    ],
    "nodes": [
        "*"
    ]
}

Everything seems correct, however JWT.io don't authorize the token.
Not sure where is the problem but I have reported it to jwt-go: dgrijalva/jwt-go#154 (comment)

Unfortunately lora-app-server doesn't recognize the token neither.

On top of that I am not able to provide an expiration time for the token, it fails to parse, it is recognized as a float and is not parsed into the int64.

Now, it is just me doing something wrong, or JWT as really some problem?

TX data queue never clears?

This weekend I brought up the lora-gateway-bridge, lora-app-server, and loraserver components on a Raspberry Pi 3, with a Haxiot Micro LoRaWAN Gateway. I'm using RN2903's for clients. Everything is playing nicely (including OTAA!), with one problem I haven't been able to resolve.

When I queue up a packet for transmission via MQTT, it gets sent to the client, but it gets sent every time the radio transmits. As far as I can tell, the data should only be sent once.

The only deviation in my installation is that I'm running the MQTT server on another machine. I'm able to receive and transmit packets from that server, so I don't think it's anything related to that.

Do I need to enable something in the radio to acknowledge it? I'm happy to provide any additional debugging output, if someone can indicate what they'd like to see.

Move node configuration to application

  • Move the node configuration to the application (so that all nodes part of an application use the same configuration)
  • Allow override of the configuration per node (toggle button?)

Question: Receive/send data over REST API

Hi brocaar

Thank you very much for sharing your great solution!

I set up your project and it runs without problems. Now I would like to visualize the received sensor data on a website. The easiest way would be to receive and send data over the REST API, because it is plattform independent.

Is there any possibility to get the data over the REST API and if not, what would be the best way? Is it planned to extend the REST API as suggested or not?

Thank you very much!
crdn

JWT token for the REST API interactive console

The REST API interactive console wont work since 0.6.0 update.

Response Body

{
  "error": "authentication failed: get token from context error: no authorization-data in metadata",
  "code": 16
}

Seems like have to set the Grpc-Metadata-Authorization header field according to the documentation.

Possible issue with frame count reaching 65535

Hi there

I have been running a test mote for a few days now and today I started getting the following error with devEUI:

{"devEUI":"0000000079250001","type":"DATA_UP_MIC","error":"invalid MIC"}

The log entries are as follows:

Oct 27 10:28:52 iotlab02 lora-app-server[15272]: time="2016-10-27T10:28:52+02:00" level=error msg="invalid MIC" dev_eui=0000000079250001 type=DATA_UP_MIC
Oct 27 10:28:52 iotlab02 lora-app-server[15272]: time="2016-10-27T10:28:52+02:00" level=info msg="handler/mqtt: publishing error notification" topic="application/0000000000000000/node/0000000079250001/error"
Oct 27 10:28:52 iotlab02 loraserver[15233]: time="2016-10-27T10:28:52+02:00" level=error msg="processing rx packet error: invalid MIC" data_base64="QAEAJXmAdg4BvV+qY82d0bcu7h9xMFhIAqm1iO3qCremu1DlZeztNWHaDsvqUCWZKg=="

The only thing I noticed is that on the Lora-app-server, the frame counter seemed to have stopped at 65535.

Restarting the mote resets the frame counter, and all transmissions resumed as normal.

Could the frame counter be overflowing, thereby causing the error.

I'm using version 0.12.3 for the loraserver and 0.1.3 for the apps server.

About SSL generated by openssl

I think it's very necessary to notice that SSL Certificates generated by openssl is in a illegal-format.

And for developers it is easy to get a legal SSL Certificates with tool in crypto/tls/generate_cert.go

about http-tls-cert

Hello brocaar:
I want to know func "mustGetHTTPHandler" create httpHandler is for grpc?
I don't have "http-tls-cert" and "http-tls-key" . so the mustGetJSONGateway return err.

tls: first record does not look like a TLS handshake

When i try to connect to client api server through default port 8080 i got this.

lora-app-server_1 | 2017/01/23 13:23:56 http: TLS handshake error from 172.19.0.1:55770: tls: first record does not look like a TLS handshake
lora-app-server_1 | 2017/01/23 13:24:07 http: TLS handshake error from 172.19.0.1:55772: EOF

I have those environments variables configured on lora-app-server docker instance.
- HTTP_TLS_CERT=/app/cert/lora-app-server.pem
- HTTP_TLS_KEY=/app/cert/lora-app-server.pem

The docker initialization log is this:

lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="starting LoRa App Server" docs="https://docs.loraserver.io/" version=0.2.0
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="connecting to postgresql"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="setup redis connection pool"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="handler/mqtt: connecting to mqtt broker" server="tcp://mosquitto:1883"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="connecting to network-server api" ca-cert= server="loraserver:8000" tls-cert= tls-key=
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="applying database migrations"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="handler/mqtt: connected to mqtt broker"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="handler/mqtt: subscribling to tx topic" topic="application/+/node/+/tx"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="migrations applied" count=0
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="starting application-server api" bind="0.0.0.0:8001" ca-cert= tls-cert= tls-key=
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=warning msg="client api authentication and authorization is disabled (set jwt-secret to enable)"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="starting client api server" bind="0.0.0.0:8080" tls-cert="/app/cert/lora-app-server.pem" tls-key="/app/cert/lora-app-server.pem"
lora-app-server_1 | time="2017-01-23T13:23:51Z" level=info msg="registering rest api handler and documentation endpoint" path="/api"

I've imported the corresponding p12 to the browser i'm using to connect to the api server.

Data is not decrypted in MQTT

When subscribing to the tx topic from a particular sensor the data is encrypted.
example:

{
  "applicationID" : "1",
  "applicationName" : "Test",
  "nodeName" : "TesT",
  "devEUI" : "0004a30b00196799",
  "rxInfo" : [ {
    "mac" : "008000000000b6a9",
    "time" : "2017-02-21T09:50:58.195271Z",
    "rssi" : -63,
    "loRaSNR" : 11.2
  } ],
  "txInfo" : {
    "frequency" : 868100000,
    "dataRate" : {
      "modulation" : "LORA",
      "bandwidth" : 125,
      "spreadFactor" : 8
    },
    "adr" : true,
    "codeRate" : "4/5"
  },
  "fCnt" : 54,
  "fPort" : 2,
  "data" : "ESJxAyAAAyABI0VjVkiIgQ=="
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.