TTN API changed to include protocol in url.
Only pass hostname to mp_kt_fwd.
This commit is contained in:
		
							
								
								
									
										9
									
								
								run.py
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								run.py
									
									
									
									
									
								
							| @@ -12,6 +12,10 @@ import time | |||||||
| import uuid | import uuid | ||||||
| import json | import json | ||||||
| import subprocess | import subprocess | ||||||
|  | try: | ||||||
|  |   import urlparse | ||||||
|  | except: | ||||||
|  |   import urllib.parse as urlparse | ||||||
| try: | try: | ||||||
|   import RPi.GPIO as GPIO |   import RPi.GPIO as GPIO | ||||||
| except RuntimeError: | 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") |   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: |   if "router" in ttn_config: | ||||||
|     router = ttn_config['router'].get('mqtt_address', "router.dev.thethings.network:1883") |     router = ttn_config['router'].get('mqtt_address', "mqtt://router.dev.thethings.network:1883") | ||||||
|     router = router[:router.index(':')] #strip port from url, as this is added by mp_pkt_fwd |     router = urlparse.urlparse(router) | ||||||
|  |     router = router.hostname # mp_pkt_fwd only wants the hostname, not the protocol and port | ||||||
|   else: |   else: | ||||||
|     router = "router.dev.thethings.network" |     router = "router.dev.thethings.network" | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jpmeijers
					jpmeijers