TTN API changed to include protocol in url.
Only pass hostname to mp_kt_fwd.
This commit is contained in:
parent
e5bab78e3f
commit
20144c87f8
9
run.py
9
run.py
@ -12,6 +12,10 @@ import time
|
||||
import uuid
|
||||
import json
|
||||
import subprocess
|
||||
try:
|
||||
import urlparse
|
||||
except:
|
||||
import urllib.parse as urlparse
|
||||
try:
|
||||
import RPi.GPIO as GPIO
|
||||
except RuntimeError:
|
||||
@ -104,8 +108,9 @@ if(os.getenv('SERVER_TTN', True)):
|
||||
frequency_plan_url = ttn_config.get('frequency_plan_url', "https://account.thethingsnetwork.org/api/v2/frequency-plans/EU_863_870")
|
||||
|
||||
if "router" in ttn_config:
|
||||
router = ttn_config['router'].get('mqtt_address', "router.dev.thethings.network:1883")
|
||||
router = router[:router.index(':')] #strip port from url, as this is added by mp_pkt_fwd
|
||||
router = ttn_config['router'].get('mqtt_address', "mqtt://router.dev.thethings.network:1883")
|
||||
router = urlparse.urlparse(router)
|
||||
router = router.hostname # mp_pkt_fwd only wants the hostname, not the protocol and port
|
||||
else:
|
||||
router = "router.dev.thethings.network"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user