Closed gutcZHAW closed 7 years ago
I forgot to add the files...
lora-network-server:
#!/bin/bash
NAME="lora-network-server"
ENABLED="yes"
[ -f /etc/default/$NAME ] && source /etc/default/$NAME
run_dir=/var/run/lora
conf_dir=/var/config/lora
conf_file=$conf_dir/lora-network-server.conf
conf_db=$conf_dir/lora-network-server.db
net_server=/opt/lora/lora-network-server
net_server_log=/var/log/lora-network-server.log
net_server_pidfile=$run_dir/$NAME.pid
#pkt_fwd=/opt/lora/basic_pkt_fwd
pkt_fwd=/opt/lora/poly_pkt_fwd
pkt_fwd_log=/var/log/lora-pkt-fwd-1.log
pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid
lora_us_id="MTAC-LORA-915"
lora_eu_id="MTAC-LORA-868"
read_card_info() {
# product-id of first lora card
lora_id=$(mts-io-sysfs show lora/product-id 2> /dev/null)
lora_eui=$(mts-io-sysfs show lora/eui 2> /dev/null)
# remove all colons
lora_eui_raw=${lora_eui//:/}
}
card_found() {
if [ "$lora_id" = "$lora_us_id" ] || [ "$lora_id" = "$lora_eu_id" ]; then
echo "Found lora card $lora_id"
return 0
else
return 1
fi
}
do_start() {
read_card_info
if ! [ -f $conf_file ]; then
echo "$0: $conf_file missing"
exit 1
fi
if ! card_found; then
echo "$0: MTAC-LORA not detected"
exit 1
fi
echo -n "Starting $NAME: "
mkdir -p $run_dir/1
# start network server
# start-stop-daemon --start --background --make-pidfile \
# --pidfile $net_server_pidfile --startas /bin/bash -- -c "exec $net_server \
# -c $conf_file --lora-eui $lora_eui --lora-path $run_dir --db $conf_db \
# --noconsole -l $net_server_log >> $net_server_log 2>&1"
# sleep 2
# start packet forwarder
start-stop-daemon --start --background --make-pidfile \
--pidfile $pkt_fwd_pidfile --exec $pkt_fwd -- \
-c $conf_dir -l $pkt_fwd_log
renice -n -20 -p $(pgrep lora-network-se)
renice -n -20 -p $(pgrep $(basename $pkt_fwd))
echo "OK"
}
do_stop() {
echo -n "Stopping $NAME: "
start-stop-daemon --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15
start-stop-daemon --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5
rm -f $net_server_pidfile $pkt_fwd_pidfile
echo "OK"
}
if [ "$ENABLED" != "yes" ]; then
echo "$NAME: disabled in /etc/default"
exit
fi
case "$1" in
"start")
do_start
;;
"stop")
do_stop
;;
"restart")
## Stop the service and regardless of whether it was
## running or not, start it again.
do_stop
do_start
;;
*)
## If no parameters are given, print which are avaiable.
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
lora-network-server.conf:
{
"lora": {
"netID": "010203", /* netID for beacon packets */
"frequencyBand": "868", /* US="915", EU="868" */
"channelPlan": "EU868",
"frequencyEU": 869500000,
"rx1DatarateOffset": 0, /* Datarate offset for mote rx window 1 sent in join response (0-3) */
"rx2Datarate": 12, /* Datarate for mote rx window 2 sent in join response (7-12) */
"maxTxPower": 14, /* Max Tx power (dBm), -6 to 26 */
"frequencyEU": 867500000 /* center freq for extra EU channels (Hz) */
},
"udp": {
"appPortUp": 1784, /* port for user-developed application use */
"appPortDown": 1786 /* port for user-developed application use */
},
"addressRange": {
"start": "00:00:00:01", /* address range used for mDots */
"end": "FF:FF:FF:FE"
},
"network": {
"public": false, /* set to false for private LoRa network with mDots + Conduit */
"leasetime": 0, /* time until mDot join expires (minutes) or 0 for no expiration */
"name": "ZHAW Test", /* configure network security */
"passphrase": "YOUR-NETWORK-PASSPHRASE"
},
"log" : {
"console" : true,
"syslog" : true,
"level" : 30, /* error=10, warn=20, info=30, debug=50, trace=60, max=100 */
"path": "/var/log/lora-network-server.log"
},
"mqtt": {
"enabled": true
}
}
After installation of the poly forwarder no packets are forwarded to the local lora server which tour mqtt command uses. You could try tcpdump to see the packet stream (not the data because that is encrypted) or attempt to modify your local_conf.json file to send packets to the local lora server as well.
Hello
At first thank you for supply the poly packet forwarder :)
I replaced the basic packet forwarder by the poly packet forwarder and it works well. My problem is, that the uplink from my nodes i'm developing sometimes doesn't reach the application server. When I debug the nodes, it seems to work well. Also I can see that something will be sent in the allowed frequency band (eu868) and with a sufficend level (checked with a spectrum analyzer). This problem also occurs with another gateway from a local LoraWan network provider (Swisscom).
To localize this bug, I need a LoraWAN sniffer which generate a log file. As I understand mosquitto is able to do that. But unfortunately the command
mosquitto_sub -t lora/+/+ -v
doesn't generate any output even when the uplink succeded. Do you have any Idea what i'm doing wrong?thank you for your help!
kind regards